- char *home = para_homedir();
- char *config_file = make_message("%s/.paraslash/audiod.conf",
- home);
- free(home);
- if (file_exists(config_file))
- return config_file;
+ char *config_file;
+
+ if (conf.config_file_given)
+ config_file = para_strdup(conf.config_file_arg);
+ else {
+ char *home = para_homedir();
+ config_file = make_message("%s/.paraslash/audiod.conf", home);
+ free(home);
+ }
+ if (conf.config_file_given && !file_exists(config_file)) {
+ PARA_EMERG_LOG("can not read config file %s\n", config_file);
+ goto err;
+ }
+ if (config_file) {
+ struct audiod_cmdline_parser_params params = {
+ .override = 0,
+ .initialize = 0,
+ .check_required = 1,
+ .check_ambiguity = 0,
+ .print_errors = 1
+ };
+ if (audiod_cmdline_parser_config_file(config_file, &conf, ¶ms)) {
+ PARA_EMERG_LOG("parse error in config file\n");
+ goto err;
+ }
+ }
+ free(config_file);
+ return;
+err: