From: Andre Noll Date: Fri, 11 Apr 2008 17:05:07 +0000 (+0200) Subject: Server/audiod option parsing improvements. X-Git-Tag: v0.3.2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=353e26aabd3849379ee960874d2219d36cc4d62f;p=paraslash.git Server/audiod option parsing improvements. 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. --- diff --git a/audiod.c b/audiod.c index 69357779..b880eb7f 100644 --- 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, ¶ms); 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, ¶ms)) { PARA_EMERG_LOG("parse error in config file\n"); exit(EXIT_FAILURE); diff --git a/server.c b/server.c index 90dfc1f5..4765cff4 100644 --- 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, ¶ms); 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, ¶ms); HANDLE_VERSION_FLAG("server", conf); para_drop_privileges(conf.user_arg, conf.group_arg); /* parse config file, open log and set defaults */