---
 doc/mpc.1     | 2 ++
 src/options.c | 9 ++++++++-
 src/options.h | 2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/mpc.1 b/doc/mpc.1
index 54084da..ebcba10 100644
--- a/doc/mpc.1
+++ b/doc/mpc.1
@@ -272,6 +272,8 @@ Wait for at least one message on the specified channel.
 Subscribe to the specified channel and continuously receive messages.
 .SH "ENVIRONMENT VARIABLES"
 All environment variables are overridden by any values specified via command 
line switches.
+.IP MPC_FORMAT
+Specifies the format of song display for status and the playlist.
 .IP MPD_HOST
 Specifies the hostname of the mpd server.  This can be a hostname, IP address 
or an absolute path.  If it is an absolute path, mpc will use Unix Domain 
Sockets instead of TCP/IP.
 
diff --git a/src/options.c b/src/options.c
index 69fc46a..5c601bf 100644
--- a/src/options.c
+++ b/src/options.c
@@ -44,7 +44,7 @@ options_t options = {
        .verbosity = V_DEFAULT,
        .password = NULL,
        .port_str = NULL,
-       .format = "[%name%: &[%artist% - ]%title%]|%name%|[%artist% - 
]%title%|%file%",
+       .format = NULL,
 };
 
 static const arg_opt_t option_table[] = {
@@ -278,6 +278,13 @@ parse_options(int * argc_p, char ** argv)
                }
        }
 
+       if (options.format == NULL) {
+               if ((options.format = getenv("MPC_FORMAT")) == NULL)
+                       options.format = F_DEFAULT;
+               else
+                       options.custom_format = true;
+       }
+
        /* Fix argv for command processing, which wants
           argv[1] to be the command, and so on. */
        if (cmdind != 0)
diff --git a/src/options.h b/src/options.h
index 45d2de5..456bc9b 100644
--- a/src/options.h
+++ b/src/options.h
@@ -26,6 +26,8 @@
 #define V_QUIET 0
 #define V_DEFAULT 1
 #define V_VERBOSE 2
+#define F_DEFAULT \
+    "[%name%: &[%artist% - ]%title%]|%name%|[%artist% - ]%title%|%file%"
 
 typedef struct {
        const char *host;
-- 
Dmitri Vereshchagin

_______________________________________________
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to