X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=client_common.c;h=1ecba73068f04c4dbf43480f5ccf32a932e01279;hb=515f354dc706ad4eb209822c20ac63542a396887;hp=754b5bf235d6817714cb28e922ff60fbed2e0649;hpb=06b3e7bc1b04def7488a5c5cd65de00aca655612;p=paraslash.git diff --git a/client_common.c b/client_common.c index 754b5bf2..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. * @@ -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) :