[PATCH] Abort early for bad option given to --cmdhelp
[fio.git] / parse.c
diff --git a/parse.c b/parse.c
index bc308ffe82902f99728890d1108fa6e300c52d42..03856dc298f163e6f91e28f8b148b84e3130eced 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -437,6 +437,9 @@ int show_cmd_help(struct fio_option *options, const char *name)
                                continue;
                }
 
+               if (!match)
+                       continue;
+
                printf("%16s: %s\n", "type", typehelp[o->type]);
                printf("%16s: %s\n", "default", o->def ? o->def : "no default");
                show_option_range(o);
@@ -464,7 +467,7 @@ void fill_default_options(void *data, struct fio_option *options)
 
 /*
  * Sanitize the options structure. For now it just sets min/max for bool
- * values.
+ * values and whether both callback and offsets are given.
  */
 void options_init(struct fio_option *options)
 {
@@ -475,5 +478,7 @@ void options_init(struct fio_option *options)
                        o->minval = 0;
                        o->maxval = 1;
                }
+               if (o->cb && (o->off1 || o->off2 || o->off3 || o->off4))
+                       fprintf(stderr, "Option %s: both cb and offset given\n", o->name);
        }
 }