]> git.tue.mpg.de Git - paraslash.git/commitdiff
Server/audiod option parsing improvements.
authorAndre Noll <maan@systemlinux.org>
Fri, 11 Apr 2008 17:05:07 +0000 (19:05 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 11 Apr 2008 17:05:07 +0000 (19:05 +0200)
Do not refuse to start if -L is given in config file and -d at the
command line.

Without this patch, para_server and para_audiod would error out
complaining about -d requiring -L without even looking at the config
file.

audiod.c
server.c

index 693577794627c83c5e369164c76a075eb6375d56..b880eb7f5d819ec60924587b32c72eee20b3bde9 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1033,20 +1033,25 @@ int main(int argc, char *argv[])
        int ret, i;
        struct sched s;
        struct command_task command_task_struct, *cmd_task = &command_task_struct;
+       struct audiod_cmdline_parser_params params = {
+               .override = 0,
+               .initialize = 1,
+               .check_required = 0,
+               .check_ambiguity = 0,
+               .print_errors = 1
+       };
 
        valid_fd_012();
-       audiod_cmdline_parser(argc, argv, &conf);
+       audiod_cmdline_parser_ext(argc, argv, &conf, &params);
        HANDLE_VERSION_FLAG("audiod", conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        config_file = configfile_exists();
        if (config_file) {
-               struct audiod_cmdline_parser_params params = {
-                       .override = 0,
-                       .initialize = 0,
-                       .check_required = 0,
-                       .check_ambiguity = 0
-
-               };
+               params.override = 0;
+               params.initialize = 0;
+               params.check_required = 1;
+               params.check_ambiguity = 0;
+               params.print_errors = 1;
                if (audiod_cmdline_parser_config_file(config_file, &conf, &params)) {
                        PARA_EMERG_LOG("parse error in config file\n");
                        exit(EXIT_FAILURE);
index 90dfc1f58962f69355775fd87e4c08f8253efeac..4765cff4d45db856334e1e987f9c7ca5366fe6f1 100644 (file)
--- a/server.c
+++ b/server.c
@@ -257,8 +257,9 @@ static void parse_config(int override)
                struct server_cmdline_parser_params params = {
                        .override = override,
                        .initialize = 0,
-                       .check_required = 0,
-                       .check_ambiguity = 0
+                       .check_required = 1,
+                       .check_ambiguity = 0,
+                       .print_errors = 1
                };
                server_cmdline_parser_config_file(cf, &conf, &params);
                conf.daemon_given = tmp;
@@ -379,10 +380,16 @@ static unsigned server_init(int argc, char **argv)
 {
        /* connector's address information */
        int sockfd;
-
+       struct server_cmdline_parser_params params = {
+               .override = 0,
+               .initialize = 1,
+               .check_required = 0,
+               .check_ambiguity = 0,
+               .print_errors = 1
+       };
        init_random_seed();
        /* parse command line options */
-       server_cmdline_parser(argc, argv, &conf);
+       server_cmdline_parser_ext(argc, argv, &conf, &params);
        HANDLE_VERSION_FLAG("server", conf);
        para_drop_privileges(conf.user_arg, conf.group_arg);
        /* parse config file, open log and set defaults */