[PATCH] Complain if bad option given to 'cmdhelp'
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/init.c b/init.c
index 4ac2783..aca607d 100644
--- a/init.c
+++ b/init.c
@@ -1205,8 +1205,8 @@
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 7ff474b..ad09691 100644
--- a/parse.c
+++ b/parse.c
@@ -376,11 +376,13 @@
"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 @@
o++;
}
+ if (found)
+ return 0;
- return 0;
+ printf("No such command: %s\n", name);
+ return 1;
}