const struct value_pair *vp;
int i;
- ret = 1;
for (i = 0; i < PARSE_MAX_VP; i++) {
vp = &o->posval[i];
if (!vp->ival || vp->ival[0] == '\0')
break;
+ ret = 1;
if (!strncmp(vp->ival, ptr, strlen(vp->ival))) {
ret = 0;
if (!o->off1)
}
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;
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)
}
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);