struct afh_info afhi;
afh_cmdline_parser(argc, argv, &conf);
- HANDLE_VERSION_FLAG("afh", conf);
loglevel = get_loglevel_by_name(conf.loglevel_arg);
+ HANDLE_VERSION_FLAG("afh", conf);
ret = -E_AFH_SYNTAX;
if (conf.inputs_num == 0)
goto out;
audioc_cmdline_parser(argc, argv, &conf);
HANDLE_VERSION_FLAG("audioc", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
cf = configfile_exists();
if (cf) {
struct audioc_cmdline_parser_params params = {
};
audioc_cmdline_parser_config_file(cf, &conf, ¶ms);
free(cf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (conf.socket_given)
socket_name = para_strdup(conf.socket_arg);
else {
PARA_EMERG_LOG("can not read config file %s\n", config_file);
goto err;
}
- if (ret)
+ if (ret) {
audiod_cmdline_parser_config_file(config_file, &conf, ¶ms);
+ daemon_set_loglevel(conf.loglevel_arg);
+ }
free(config_file);
- daemon_set_loglevel(conf.loglevel_arg);
return;
err:
free(config_file);
valid_fd_012();
audiod_cmdline_parser_ext(argc, argv, &conf, ¶ms);
HANDLE_VERSION_FLAG("audiod", conf);
+ daemon_set_loglevel(conf.loglevel_arg);
/* init receivers/filters/writers early to make help work */
recv_init();
filter_init();
fade_cmdline_parser(argc, argv, &conf);
HANDLE_VERSION_FLAG("fade", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
ret = configfile_exists();
if (!ret && conf.config_file_given) {
PARA_EMERG_LOG("can not read config file %s\n",
};
fade_cmdline_parser_config_file(conf.config_file_arg,
&conf, ¶ms);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
init_mixers();
m = get_mixer_or_die();
ret = m->open(conf.mixer_device_arg, &h);
exit(0);
}
-static int parse_config(int argc, char *argv[])
+static int parse_config(void)
{
static char *cf; /* config file */
struct stat statbuf;
- filter_cmdline_parser(argc, argv, &conf);
HANDLE_VERSION_FLAG("filter", conf);
if (conf.help_given || conf.detailed_help_given)
print_help_and_die();
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (!cf) {
char *home = para_homedir();
cf = make_message("%s/.paraslash/filter.conf", home);
.print_errors = 1
};
filter_cmdline_parser_config_file(cf, &conf, ¶ms);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
if (!conf.filter_given)
return -E_NO_FILTERS;
struct btr_node *parent;
struct filter_node **fns;
+ filter_cmdline_parser(argc, argv, &conf); /* aborts on errors */
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
filter_init();
- ret = parse_config(argc, argv);
+ ret = parse_config();
if (ret < 0)
goto out;
sit->btrn = btr_new_node(&(struct btr_node_description)
gui_cmdline_parser(argc, argv, &conf); /* exits on errors */
HANDLE_VERSION_FLAG("gui", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
cf = configfile_exists();
if (!cf && conf.config_file_given) {
fprintf(stderr, "can not read config file %s\n",
.print_errors = 1,
};
gui_cmdline_parser_config_file(cf, &conf, ¶ms);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (check_key_map_args() < 0) {
fprintf(stderr, "invalid key map\n");
exit(EXIT_FAILURE);
play_cmdline_parser_ext(argc, argv, &conf, ¶ms);
HANDLE_VERSION_FLAG("play", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (conf.help_given || conf.detailed_help_given)
print_help_and_die();
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (conf.config_file_given)
config_file = para_strdup(conf.config_file_arg);
else {
params.initialize = 0;
params.check_required = 1;
play_cmdline_parser_config_file(config_file, &conf, ¶ms);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
for (i = 0; i < conf.key_map_given; i++) {
char *s = strchr(conf.key_map_arg[i] + 1, ':');
exit(0);
}
-static void *parse_config(int argc, char *argv[], int *receiver_num)
-{
- recv_cmdline_parser(argc, argv, &conf);
- HANDLE_VERSION_FLAG("recv", conf);
- if (conf.help_given || conf.detailed_help_given)
- print_help_and_die();
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
- return check_receiver_arg(conf.receiver_arg, receiver_num);
-}
-
/**
* The main function of para_recv.
*
struct stdout_task sot;
static struct sched s;
- s.default_timeout.tv_sec = 1;
- s.default_timeout.tv_usec = 0;
+ recv_cmdline_parser(argc, argv, &conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
+ HANDLE_VERSION_FLAG("recv", conf);
+ recv_init();
+ if (conf.help_given || conf.detailed_help_given)
+ print_help_and_die();
- memset(&sot, 0, sizeof(struct stdout_task));
memset(&rn, 0, sizeof(struct receiver_node));
- recv_init();
- ret = -E_RECV_SYNTAX;
- rn.conf = parse_config(argc, argv, &receiver_num);
+ rn.conf = check_receiver_arg(conf.receiver_arg, &receiver_num);
if (!rn.conf) {
- PARA_EMERG_LOG("parse failed\n");
+ PARA_EMERG_LOG("invalid receiver specifier\n");
+ ret = -E_RECV_SYNTAX;
goto out;
}
r = &receivers[receiver_num];
goto out;
r_opened = 1;
+ memset(&sot, 0, sizeof(struct stdout_task));
sot.btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.parent = rn.btrn, .name = "stdout"));
stdout_set_defaults(&sot);
sprintf(rn.task.status, "%s", r->name);
register_task(&s, &rn.task);
+ s.default_timeout.tv_sec = 1;
+ s.default_timeout.tv_usec = 0;
ret = schedule(&s);
out:
if (r_opened)
.print_errors = !conf.daemon_given
};
server_cmdline_parser_config_file(cf, &conf, ¶ms);
+ daemon_set_loglevel(conf.loglevel_arg);
conf.daemon_given = tmp;
}
if (conf.logfile_given) {
daemon_set_logfile(conf.logfile_arg);
daemon_open_log_or_die();
}
- daemon_set_loglevel(conf.loglevel_arg);
init_colors_or_die();
daemon_set_flag(DF_LOG_PID);
daemon_set_flag(DF_LOG_LL);
server_cmdline_parser_ext(argc, argv, &conf, ¶ms);
HANDLE_VERSION_FLAG("server", conf);
drop_privileges_or_die(conf.user_arg, conf.group_arg);
+ daemon_set_loglevel(conf.loglevel_arg);
/* parse config file, open log and set defaults */
parse_config_or_die(0);
log_welcome("para_server");
},
};
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
sit.btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = "stdin"));
stdin_set_defaults(&sit);
{
int ret;
- writer_init();
write_cmdline_parser(argc, argv, &conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
+ writer_init();
HANDLE_VERSION_FLAG("write", conf);
if (conf.help_given || conf.detailed_help_given)
print_help_and_die();