X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=client_common.c;h=1ecba73068f04c4dbf43480f5ccf32a932e01279;hb=b6161b3a38321a3d6fb019f71f9a00d71e105f5d;hp=f0efe42fd49769db17d341f1d325b72661e4918d;hpb=6d5159ed6235647bca461a9414543f76eb0b6da6;p=paraslash.git diff --git a/client_common.c b/client_common.c index f0efe42f..1ecba730 100644 --- a/client_common.c +++ b/client_common.c @@ -22,16 +22,17 @@ #include "client.h" #include "buffer_tree.h" #include "version.h" +#include "ggo.h" /** The size of the receiving buffer. */ #define CLIENT_BUFSIZE 4000 /** - * Close the connection to para_server and deallocate per-command ressources. + * Close the connection to para_server and deallocate per-command resources. * * \param ct The client task. * - * This frees all ressources of the current command but keeps the configuration + * This frees all resources of the current command but keeps the configuration * in \p ct->conf. * * \sa \ref client_close(). @@ -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) :