From 7fc141712f9a1002cfdb7d3db668c0baa32cd301 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 1 Feb 2018 10:08:34 -0700 Subject: [PATCH] blobcli: print usage when run without arguments Previously, running blobcli with no arguments would just print "ERROR: Invalid option" and exit; tweak the tests in usage() so the command help gets printed in this case. Change-Id: I70dbe82f2e83a6f068d4bd61c7baa9d2bbc6f829 Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/398078 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Paul Luse Reviewed-by: Jim Harris --- examples/blob/cli/blobcli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/blob/cli/blobcli.c b/examples/blob/cli/blobcli.c index 446854189..91f9c470c 100644 --- a/examples/blob/cli/blobcli.c +++ b/examples/blob/cli/blobcli.c @@ -173,7 +173,7 @@ usage(struct cli_context_t *cli_context, char *msg) printf("%s", msg); } - if (cli_context && cli_context->cli_mode == CLI_MODE_CMD) { + if (!cli_context || cli_context->cli_mode == CLI_MODE_CMD) { printf("Version %s\n", SPDK_VERSION_STRING); printf("Usage: %s [-c SPDK config_file] Command\n", program_name); printf("\n%s is a command line tool for interacting with blobstore\n", @@ -181,7 +181,7 @@ usage(struct cli_context_t *cli_context, char *msg) printf("on the underlying device specified in the conf file passed\n"); printf("in as a command line option.\n"); } - if (cli_context && cli_context->cli_mode != CLI_MODE_SCRIPT) { + if (!cli_context || cli_context->cli_mode != CLI_MODE_SCRIPT) { print_cmds(); } }