Code

options.c: Read mpd host from environment if not specified.
[ncmpc.git] / src / options.c
index c9eb5e8a954c3fcbb812caa4651e36b1f5888548..e863c726f7173ddb73870d9338ee2aff4d92e42a 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
 
  * This program is free software; you can redistribute it and/or modify
@@ -65,6 +65,7 @@ options_t options = {
        .scroll = DEFAULT_SCROLL,
        .welcome_screen_list = true,
        .jump_prefix_only = true,
+       .second_column = true,
 #endif
 };
 
@@ -362,21 +363,16 @@ 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
 options_init(void)
 {
-       /* XXX
-       if ((tmp = g_strstr_len(options.host, strlen(options.host), "@"))) {
-               char *oldhost = options.host;
-               *tmp  = '\0';
-               options.password = locale_to_utf8(oldhost);
-               options.host = g_strdup(tmp+1);
-               g_free(oldhost);
-       }
-       */
-
        /* default option values */
        options.list_format = g_strdup(DEFAULT_LIST_FORMAT);
        options.status_format = g_strdup(DEFAULT_STATUS_FORMAT);