]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - client_common.c
paraslash 0.4.14
[paraslash.git] / client_common.c
index 754b5bf235d6817714cb28e922ff60fbed2e0649..1ecba73068f04c4dbf43480f5ccf32a932e01279 100644 (file)
@@ -22,6 +22,7 @@
 #include "client.h"
 #include "buffer_tree.h"
 #include "version.h"
+#include "ggo.h"
 
 /** The size of the receiving buffer. */
 #define CLIENT_BUFSIZE 4000
@@ -611,6 +612,15 @@ err_out:
        return ret;
 }
 
+__noreturn static void print_help_and_die(struct client_task *ct)
+{
+       struct ggo_help h = DEFINE_GGO_HELP(client);
+       bool d = ct->conf.detailed_help_given;
+
+       ggo_print_help(&h, d? GPH_STANDARD_FLAGS_DETAILED : GPH_STANDARD_FLAGS);
+       exit(0);
+}
+
 /**
  * Parse a client configuration.
  *
@@ -642,6 +652,8 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr,
        if (client_cmdline_parser(argc, argv, &ct->conf))
                goto out;
        version_handle_flag("client", ct->conf.version_given);
+       if (ct->conf.help_given || ct->conf.detailed_help_given)
+               print_help_and_die(ct);
 
        ct->config_file = ct->conf.config_file_given?
                para_strdup(ct->conf.config_file_arg) :