check whether getenv returns NULL or not

This commit is contained in:
unK
2008-10-18 16:07:56 +02:00
parent 336ad46c12
commit a980e77e0a
2 changed files with 4 additions and 3 deletions

View File

@@ -56,6 +56,8 @@ extern string UNKNOWN_ARTIST;
extern string UNKNOWN_TITLE;
extern string UNKNOWN_ALBUM;
const string term_type = getenv("TERM") ? getenv("TERM") : "";
bool ConnectToMPD()
{
if (!Mpd->Connect())
@@ -265,7 +267,7 @@ bool SortSongsByTrack(Song *a, Song *b)
void WindowTitle(const string &status)
{
if (TERMINAL_TYPE != "linux" && Config.set_window_title)
if (term_type != "linux" && Config.set_window_title)
std::cout << "\033]0;" << status << "\7";
}

View File

@@ -46,8 +46,7 @@ enum NcmpcppScreen
const int ncmpcpp_window_timeout = 500;
const string home_folder = getenv("HOME");
const string TERMINAL_TYPE = getenv("TERM");
const string home_folder = getenv("HOME") ? getenv("HOME") : "";
const string search_mode_normal = "Match if tag contains searched phrase";
const string search_mode_strict = "Match only if both values are the same";