]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - audioc.c
Use self-made help to avoid recompilations on version changes.
[paraslash.git] / audioc.c
index 0147b4cf411b0a277b4378cd708e3874f05ba831..164a1554f0ee2ceba94f6a509ea4911fba8a66f9 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -17,6 +17,7 @@
 #include "net.h"
 #include "string.h"
 #include "fd.h"
+#include "ggo.h"
 #include "version.h"
 
 INIT_AUDIOC_ERRLISTS;
@@ -263,6 +264,15 @@ static char *configfile_exists(void)
        return NULL;
 }
 
+__noreturn static void print_help_and_die(void)
+{
+       struct ggo_help h = DEFINE_GGO_HELP(audioc);
+       bool d = conf.detailed_help_given;
+
+       ggo_print_help(&h, d? GPH_STANDARD_FLAGS_DETAILED : GPH_STANDARD_FLAGS);
+       exit(0);
+}
+
 /**
  * The client program to connect to para_audiod.
  *
@@ -288,6 +298,8 @@ int main(int argc, char *argv[])
        audioc_cmdline_parser(argc, argv, &conf);
        loglevel = get_loglevel_by_name(conf.loglevel_arg);
        version_handle_flag("audioc", conf.version_given);
+       if (conf.help_given || conf.detailed_help_given)
+               print_help_and_die();
        cf = configfile_exists();
        if (cf) {
                struct audioc_cmdline_parser_params params = {