Hi Max,

This patch (two part patch series) adds a new runtime option
--no-config to get MPDs defaults (which works as well as src/mpd
/dev/null, but is portable), and orders the runtime options like other
GNU projects.

git://git.musicpd.org/avuton/mpd.git

src/cmdline.c |   17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)

Avuton Olrich (2):
      cmdline: Add --no-config to explicitly set daemon default options.
      cmdline: Alphabetical help order like other GNU projects.

diff --git a/src/cmdline.c b/src/cmdline.c
index 43fe46d..d4d96cf 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -81,14 +81,15 @@ void parseOptions(int argc, char **argv, Options *options)
        GOptionContext *context;
        bool ret;
        static gboolean option_version,
-               option_create_db, option_no_create_db, option_no_daemon;
+               option_create_db, option_no_create_db, option_no_daemon,
+               option_no_config;
        const GOptionEntry entries[] = {
-               { "version", 'V', 0, G_OPTION_ARG_NONE, &option_version,
-                 "print version number", NULL },
-               { "kill", 0, 0, G_OPTION_ARG_NONE, &options->kill,
-                 "kill the currently running mpd session", NULL },
                { "create-db", 0, 0, G_OPTION_ARG_NONE, &option_create_db,
                  "force (re)creation of database", NULL },
+               { "kill", 0, 0, G_OPTION_ARG_NONE, &options->kill,
+                 "kill the currently running mpd session", NULL },
+               { "no-config", 0, 0, G_OPTION_ARG_NONE, &option_no_config,
+                 "don't read from config", NULL },
                { "no-create-db", 0, 0, G_OPTION_ARG_NONE, &option_no_create_db,
                  "don't create database, even if it doesn't exist", NULL },
                { "no-daemon", 0, 0, G_OPTION_ARG_NONE, &option_no_daemon,
@@ -97,6 +98,8 @@ void parseOptions(int argc, char **argv, Options *options)
                  "print messages to stderr", NULL },
                { "verbose", 'v', 0, G_OPTION_ARG_NONE, &options->verbose,
                  "verbose logging", NULL },
+               { "version", 'V', 0, G_OPTION_ARG_NONE, &option_version,
+                 "print version number", NULL },
                { .long_name = NULL }
        };

@@ -138,7 +141,9 @@ void parseOptions(int argc, char **argv, Options *options)

        options->daemon = !option_no_daemon;

-       if (argc <= 1) {
+       if (option_no_config) {
+               g_debug("Ignoring config, using daemon defaults\n");
+       } else if (argc <= 1) {
                /* default configuration file path */
                char *path1;
                char *path2;
-- 
avuton
--
|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to