#include "audiod.cmdline.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "recv.h"
#include "filter.h"
#include "grab_client.cmdline.h"
/** The array of status items sent by para_server. */
-char *stat_item_values[NUM_STAT_ITEMS];
+char *stat_item_values[NUM_STAT_ITEMS] = {NULL};
/**
* the current mode of operation of which can be changed by the on/off/cycle
* \param ll loglevel
* \param fmt the format string
*/
-void para_log(int ll, const char* fmt,...)
+__printf_2_3 void para_log(int ll, const char* fmt,...)
{
va_list argp;
FILE *outfd;
struct audio_format_info *a;
init_supported_writers();
- nw = PARA_MAX(1, conf.writer_given);
+ nw = PARA_MAX(1U, conf.writer_given);
PARA_INFO_LOG("maximal number of writers: %d\n", nw);
FOR_EACH_AUDIO_FORMAT(i) {
a = &afi[i];
int i, ret, nf;
filter_init(filters);
- nf = PARA_MAX(1, conf.filter_given);
+ nf = PARA_MAX(1U, conf.filter_given);
PARA_INFO_LOG("maximal number of filters: %d\n", nf);
FOR_EACH_AUDIO_FORMAT(i) {
afi[i].filter_conf = para_malloc(nf * sizeof(void *));
stat_task->offset_seconds = 0;
audiod_status_dump();
stat_task->playing = 0;
- stat_item_values[SI_BASENAME] = make_message(
- "%s: no connection to para_server\n",
- status_item_list[SI_BASENAME]);
- stat_client_write(stat_item_values[SI_BASENAME],
- SI_BASENAME);
}
/**
client_open(argc, argv, &st->ct);
set_stat_task_restart_barrier(5);
}
+ free(stat_item_values[SI_BASENAME]);
+ stat_item_values[SI_BASENAME] = make_message(
+ "%s: no connection to para_server\n",
+ status_item_list[SI_BASENAME]);
+ stat_client_write(stat_item_values[SI_BASENAME],
+ SI_BASENAME);
st->last_status_read = *now;
out:
start_stop_decoders(s);
PARA_WARNING_LOG("invalid mode\n");
}
+__noreturn static void print_help_and_die(void)
+{
+ int d = conf.detailed_help_given;
+ const char **p = d? audiod_args_info_detailed_help
+ : audiod_args_info_help;
+
+ printf_or_die("%s\n\n", AUDIOD_CMDLINE_PARSER_PACKAGE "-"
+ AUDIOD_CMDLINE_PARSER_VERSION);
+ printf_or_die("%s\n\n", audiod_args_info_usage);
+ for (; *p; p++)
+ printf_or_die("%s\n", *p);
+ print_receiver_helps(d);
+ print_filter_helps(d);
+ print_writer_helps(d);
+ exit(0);
+}
+
+
/**
* the main function of para_audiod
*
}
if (conf.logfile_given)
logfile = open_log(conf.logfile_arg);
- log_welcome("para_audiod", conf.loglevel_arg);
i = init_stream_io();
+ if (conf.help_given || conf.detailed_help_given)
+ print_help_and_die();
+ log_welcome("para_audiod", conf.loglevel_arg);
if (i < 0) {
PARA_EMERG_LOG("init stream io error: %s\n", para_strerror(-i));
exit(EXIT_FAILURE);