From 320beefe2d0c5f05f24b4e0c1d13fcb2f1286a78 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 1 Mar 2007 10:44:12 +0100 Subject: [PATCH] Don't require 'all' argument to --cmdhelp to dump all options 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 --- init.c | 2 +- parse.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/init.c b/init.c index c6837c9f..19424243 100644 --- a/init.c +++ b/init.c @@ -581,7 +581,7 @@ static struct option long_options[FIO_JOB_OPTS + FIO_CMD_OPTS] = { }, { .name = "cmdhelp", - .has_arg = required_argument, + .has_arg = optional_argument, .val = 'c', }, { diff --git a/parse.c b/parse.c index d13a6033..ee7ddf29 100644 --- a/parse.c +++ b/parse.c @@ -439,7 +439,6 @@ int parse_option(const char *opt, struct fio_option *options, void *data) 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)", @@ -453,9 +452,16 @@ int show_cmd_help(struct fio_option *options, const char *name) }; 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; -- 2.25.1