Code

options.c: Read mpd host from environment if not specified.
authorDaniel Friesel <derf@derf.homelinux.org>
Fri, 30 Apr 2010 17:05:11 +0000 (19:05 +0200)
committerMax Kellermann <max@duempel.org>
Wed, 21 Jul 2010 06:04:56 +0000 (08:04 +0200)
This fixes the "Connecting to localhost" message if "MPD_HOST=mpd ncmpc" is used.

src/options.c

index db72e3b549f64d510a755d9be78528f703cb6bb4..e863c726f7173ddb73870d9338ee2aff4d92e42a 100644 (file)
@@ -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