projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Only do the root warning once per thread
[fio.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index 4d8e95db7fbe88b84a45c7bb215b1b7f3db47223..f0e644f113bf63171fbebc8e0bd2545ae5d0fcd8 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-142,13
+142,25
@@
void strip_blank_front(char **p)
while (isspace(*s))
s++;
while (isspace(*s))
s++;
+
+ *p = s;
}
void strip_blank_end(char *p)
{
}
void strip_blank_end(char *p)
{
- char *s = p + strlen(p) - 1;
-
- while (isspace(*s) || iscntrl(*s))
+ char *s;
+
+ s = strchr(p, ';');
+ if (s)
+ *s = '\0';
+ s = strchr(p, '#');
+ if (s)
+ *s = '\0';
+ if (s)
+ p = s;
+
+ s = p + strlen(p);
+ while ((isspace(*s) || iscntrl(*s)) && (s > p))
s--;
*(s + 1) = '\0';
s--;
*(s + 1) = '\0';
@@
-450,9
+462,9
@@
int parse_option(const char *opt, struct fio_option *options, void *data)
{
struct fio_option *o;
char *pre, *post;
{
struct fio_option *o;
char *pre, *post;
- char
tmp[64]
;
+ char
*tmp
;
-
strncpy(tmp, opt, sizeof(tmp) - 1
);
+
tmp = strdup(opt
);
pre = strchr(tmp, '=');
if (pre) {
pre = strchr(tmp, '=');
if (pre) {
@@
-468,13
+480,17
@@
int parse_option(const char *opt, struct fio_option *options, void *data)
if (!o) {
fprintf(stderr, "Bad option %s\n", tmp);
if (!o) {
fprintf(stderr, "Bad option %s\n", tmp);
+ free(tmp);
return 1;
}
return 1;
}
- if (!handle_option(o, post, data))
+ if (!handle_option(o, post, data)) {
+ free(tmp);
return 0;
return 0;
+ }
fprintf(stderr, "fio: failed parsing %s\n", opt);
fprintf(stderr, "fio: failed parsing %s\n", opt);
+ free(tmp);
return 1;
}
return 1;
}
@@
-625,6
+641,8
@@
void options_init(struct fio_option *options)
o->minval = 0;
o->maxval = 1;
}
o->minval = 0;
o->maxval = 1;
}
+ if (o->type == FIO_OPT_STR_SET && o->def)
+ fprintf(stderr, "Option %s: string set option with default will always be true\n", o->name);
if (!o->cb && !o->off1)
fprintf(stderr, "Option %s: neither cb nor offset given\n", o->name);
if (o->type == FIO_OPT_STR || o->type == FIO_OPT_STR_STORE)
if (!o->cb && !o->off1)
fprintf(stderr, "Option %s: neither cb nor offset given\n", o->name);
if (o->type == FIO_OPT_STR || o->type == FIO_OPT_STR_STORE)