options: strip off =optval when matching
authorJens Axboe <axboe@fb.com>
Sat, 6 Dec 2014 16:53:46 +0000 (09:53 -0700)
committerJens Axboe <axboe@fb.com>
Sat, 6 Dec 2014 16:53:46 +0000 (09:53 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
options.c

index 98f4b2b04a6638f092ef0f26c1491c65f45e88f6..2c703fdb85e622c79f8537d80bd2681d87f85d05 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3933,10 +3933,20 @@ static char **dup_and_sub_options(char **opts, int num_opts)
        return opts_copy;
 }
 
-static void show_closest_option(const char *name)
+static void show_closest_option(const char *opt)
 {
        int best_option, best_distance;
        int i, distance;
+       char *name;
+
+       if (!strlen(opt))
+               return;
+
+       name = strdup(opt);
+       i = 0;
+       while (name[i] != '\0' && name[i] != '=')
+               i++;
+       name[i] = '\0';
 
        best_option = -1;
        best_distance = INT_MAX;
@@ -3952,6 +3962,8 @@ static void show_closest_option(const char *name)
 
        if (best_option != -1)
                log_err("Did you mean %s?\n", fio_options[best_option].name);
+
+       free(name);
 }
 
 int fio_options_parse(struct thread_data *td, char **opts, int num_opts,