From: Keith Busch Date: Fri, 2 Mar 2018 15:29:33 +0000 (-0700) Subject: Don't print non-existent command line options X-Git-Tag: v1.6~69 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3e4648e38f2f05a78c96200320c4762d4c642972;p=users%2Fhch%2Fnvme-cli.git Don't print non-existent command line options Link: https://github.com/linux-nvme/nvme-cli/issues/309 Signed-off-by: Keith Busch --- diff --git a/argconfig.c b/argconfig.c index 87cccfb..0eca5ee 100644 --- a/argconfig.c +++ b/argconfig.c @@ -128,8 +128,12 @@ void argconfig_print_help(const char *program_desc, append_usage_str); print_word_wrapped(program_desc, 0, 0); - printf("\n\n\033[1mOptions:\033[0m\n"); + printf("\n"); + if (!options || !options->option) + return; + + printf("\n\033[1mOptions:\033[0m\n"); for (s = options; (s->option != NULL) && (s != NULL); s++) show_option(s); }