Left justify help output
[fio.git] / parse.c
diff --git a/parse.c b/parse.c
index 21fb3c2eeda611fd6ab1b43010ec5c36f868fbc3..84a0f52ab54f025d48a0bca3a4f8650ed421a825 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -257,10 +257,20 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
                }
                break;
        }
-       case FIO_OPT_STR_STORE:
+       case FIO_OPT_STR_STORE: {
+               fio_opt_str_fn *fn = o->cb;
+
                cp = td_var(data, o->off1);
                *cp = strdup(ptr);
+               if (fn) {
+                       ret = fn(data, ptr);
+                       if (ret) {
+                               free(*cp);
+                               *cp = NULL;
+                       }
+               }
                break;
+       }
        case FIO_OPT_RANGE: {
                char tmp[128];
                char *p1, *p2;
@@ -527,9 +537,12 @@ int show_cmd_help(struct fio_option *options, const char *name)
 
                if (show_all || match) {
                        found = 1;
-                       printf("%20s: %s\n", o->name, o->help);
-                       if (show_all)
+                       if (match)
+                               printf("%20s: %s\n", o->name, o->help);
+                       if (show_all) {
+                               printf("%-20s: %s\n", o->name, o->help);
                                continue;
+                       }
                }
 
                if (!match)
@@ -579,7 +592,7 @@ void options_init(struct fio_option *options)
                }
                if (!o->cb && !o->off1)
                        fprintf(stderr, "Option %s: neither cb nor offset given\n", o->name);
-               if (o->type == FIO_OPT_STR)
+               if (o->type == FIO_OPT_STR || o->type == FIO_OPT_STR_STORE)
                        continue;
                if (o->cb && (o->off1 || o->off2 || o->off3 || o->off4))
                        fprintf(stderr, "Option %s: both cb and offset given\n", o->name);