X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=fade.c;h=878b83a17e26f40da9c33c6035dba345353257d4;hp=d2ab8287e88973e38066ff97e80ff738a17e144b;hb=0fd87393066ba5a6f0245b8a54b4fd47b281dfce;hpb=625fdbbafaf3842753bff02b349eaaf9554d846d diff --git a/fade.c b/fade.c index d2ab8287..878b83a1 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; @@ -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,7 +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", @@ -310,8 +323,8 @@ int main(int argc, char *argv[]) }; 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);