If an argument isn't given, just dump all commands. This has the
downside that one MUST use --cmdhelp=option to get option help,
where as before --cmdhelp option worked as well.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
},
{
.name = "cmdhelp",
- .has_arg = required_argument,
+ .has_arg = optional_argument,
.val = 'c',
},
{
int show_cmd_help(struct fio_option *options, const char *name)
{
- int show_all = !strcmp(name, "all");
const char *typehelp[] = {
"string (opt=bla)",
"string with possible k/m/g postfix (opt=4k)",
};
struct fio_option *o;
int found = 0;
+ int show_all = 0;
+
+ if (!name || !strcmp(name, "all"))
+ show_all = 1;
for (o = &options[0]; o->name; o++) {
- int match = !strcmp(name, o->name);
+ int match = 0;
+
+ if (name && !strcmp(name, o->name))
+ match = 1;
if (show_all || match) {
found = 1;