X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client_common.c;h=1ecba73068f04c4dbf43480f5ccf32a932e01279;hp=f4b09cd23c2eeedf7974583f3bf2cf145c993fc5;hb=515f354dc706ad4eb209822c20ac63542a396887;hpb=5ec373417adc2fc80e407e7a5bcd8329f02b314c diff --git a/client_common.c b/client_common.c index f4b09cd2..1ecba730 100644 --- a/client_common.c +++ b/client_common.c @@ -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. * @@ -641,7 +651,9 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, ret = -E_CLIENT_SYNTAX; if (client_cmdline_parser(argc, argv, &ct->conf)) goto out; - HANDLE_VERSION_FLAG("client", ct->conf); + 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) :