X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fade.c;h=a8424d67a5db24ea2967670ee6eb90ccaf284100;hp=e6f550a1c94d37806b28b25b8ac17bf5b7bd10ed;hb=30f966fa968e966465df2ef47a84976f8d598cdb;hpb=b01605d7062e4d1f005d5aaaaed158d8efe06d79 diff --git a/fade.c b/fade.c index e6f550a1..a8424d67 100644 --- a/fade.c +++ b/fade.c @@ -14,6 +14,7 @@ #include "string.h" #include "mix.h" #include "error.h" +#include "ggo.h" #include "version.h" INIT_FADE_ERRLISTS; @@ -26,7 +27,7 @@ static struct mixer supported_mixer[] = {MIXER_ARRAY}; #define FOR_EACH_MIXER(i) for ((i) = 0; (i) < NUM_SUPPORTED_MIXERS; (i)++) static int loglevel; -__printf_2_3 void date_log(int ll, const char *fmt, ...) +static __printf_2_3 void date_log(int ll, const char *fmt, ...) { va_list argp; time_t t1; @@ -286,6 +287,15 @@ static struct mixer *get_mixer_or_die(void) exit(EXIT_FAILURE); } +__noreturn static void print_help_and_die(void) +{ + struct ggo_help h = DEFINE_GGO_HELP(fade); + bool d = conf.detailed_help_given; + + ggo_print_help(&h, d? GPH_STANDARD_FLAGS_DETAILED : GPH_STANDARD_FLAGS); + exit(0); +} + int main(int argc, char *argv[]) { int ret; @@ -293,8 +303,10 @@ int main(int argc, char *argv[]) struct mixer_handle *h = NULL; fade_cmdline_parser(argc, argv, &conf); - HANDLE_VERSION_FLAG("fade", conf); loglevel = get_loglevel_by_name(conf.loglevel_arg); + version_handle_flag("fade", conf.version_given); + if (conf.help_given || conf.detailed_help_given) + print_help_and_die(); ret = configfile_exists(); if (!ret && conf.config_file_given) { PARA_EMERG_LOG("can not read config file %s\n",