From: Daniel Friesel Date: Fri, 30 Apr 2010 17:05:11 +0000 (+0200) Subject: options.c: Read mpd host from environment if not specified. X-Git-Tag: release-0.18~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2e762978782f60ae96bd87f5f8fcdb02f3073646;p=ncmpc.git options.c: Read mpd host from environment if not specified. This fixes the "Connecting to localhost" message if "MPD_HOST=mpd ncmpc" is used. --- diff --git a/src/options.c b/src/options.c index db72e3b..e863c72 100644 --- a/src/options.c +++ b/src/options.c @@ -363,6 +363,11 @@ options_parse(int argc, const char *argv[]) option_cb (opt->shortopt, NULL); else if (opt && opt->argument) option_error(ERROR_MISSING_ARGUMENT, opt->longopt, opt->argument); + + if (!options.host && getenv("MPD_HOST")) { + g_free(options.host); + options.host = g_strdup(getenv("MPD_HOST")); + } } void