summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-08-21 11:01:29 -0700
committerJens Axboe <axboe@fb.com>2015-08-21 11:01:29 -0700
commit3701636d7d8e8c60b27a54f32a94ede6e15b0380 (patch)
tree621f9bcec928961d4f2e20b12de4cae929782ae4 /parse.c
parentd264264a084e4989f7be577001484981bd606669 (diff)
downloadfio-3701636d7d8e8c60b27a54f32a94ede6e15b0380.tar.gz
fio-3701636d7d8e8c60b27a54f32a94ede6e15b0380.tar.bz2
parse: only print option mismatch help, if the distance is close enough
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 745056bd..3e94c7d5 100644
--- a/parse.c
+++ b/parse.c
@@ -1061,6 +1061,19 @@ int string_distance(const char *s1, const char *s2)
return i;
}
+/*
+ * Make a guess of whether the distance from 's1' is significant enough
+ * to warrant printing the guess. We set this to a 1/2 match.
+ */
+int string_distance_ok(const char *opt, int distance)
+{
+ size_t len;
+
+ len = strlen(opt);
+ len = (len + 1) / 2;
+ return distance <= len;
+}
+
static struct fio_option *find_child(struct fio_option *options,
struct fio_option *o)
{