[PATCH] Complain if bad option given to 'cmdhelp'
authorJens Axboe <jens.axboe@oracle.com>
Tue, 9 Jan 2007 20:22:02 +0000 (21:22 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 9 Jan 2007 20:22:02 +0000 (21:22 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
init.c
parse.c

diff --git a/init.c b/init.c
index 4ac2783d28a4ced91c1076e3b069a3e4bc659a5b..aca607dc92cee6860a91e0c5830bac64c36f0632 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1205,8 +1205,8 @@ static int parse_cmd_line(int argc, char *argv[])
                        usage();
                        exit(0);
                case 'c':
-                       show_cmd_help(options, optarg);
-                       exit(0);
+                       ret = show_cmd_help(options, optarg);
+                       exit(ret);
                case 'v':
                        printf("%s\n", fio_version_string);
                        exit(0);
diff --git a/parse.c b/parse.c
index 7ff474b1dfec5f1daaa31418910aaad4e6fda1fc..ad0969187819297a0186ee878fff3de78676565a 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -376,11 +376,13 @@ int show_cmd_help(struct fio_option *options, const char *name)
                "integer value (opt=100)",
                "no argument (opt)",
        };
+       int found = 0;
 
        while (o->name) {
                int match = !strcmp(name, o->name);
 
                if (show_all || match) {
+                       found = 1;
                        printf("%s: %s\n", o->name, o->help);
                        if (match)
                                printf("type: %s\n", typehelp[o->type]);
@@ -389,6 +391,9 @@ int show_cmd_help(struct fio_option *options, const char *name)
                o++;
        }
 
+       if (found)
+               return 0;
 
-       return 0;
+       printf("No such command: %s\n", name);
+       return 1;
 }