]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Don't print non-existent command line options
authorKeith Busch <keith.busch@intel.com>
Fri, 2 Mar 2018 15:29:33 +0000 (08:29 -0700)
committerKeith Busch <keith.busch@intel.com>
Fri, 2 Mar 2018 15:29:33 +0000 (08:29 -0700)
Link: https://github.com/linux-nvme/nvme-cli/issues/309
Signed-off-by: Keith Busch <keith.busch@intel.com>
argconfig.c

index 87cccfbcf3bd4f9fc6e4d1b8851a825c90542e80..0eca5eed09507193bc74df2ad32b7d5bc2be0bc9 100644 (file)
@@ -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);
 }