From 2e762978782f60ae96bd87f5f8fcdb02f3073646 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 30 Apr 2010 19:05:11 +0200 Subject: [PATCH] options.c: Read mpd host from environment if not specified. This fixes the "Connecting to localhost" message if "MPD_HOST=mpd ncmpc" is used. --- src/options.c | 5 +++++ 1 file changed, 5 insertions(+) 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 -- 2.30.2