The following changes since commit 74a92cdd178ac5434d2bbbc1649fe66ff341c1d0:

  lib/rand: cleanup __fill_random_buffer() (2014-12-05 11:04:19 -0700)

are available in the git repository at:

  git://git.kernel.dk/fio.git master

for you to fetch changes up to f8b8f7da1f64353ebc1dfa47de3b7ff1e8cca303:

  Update date and email in man page (2014-12-06 18:47:43 -0700)

----------------------------------------------------------------
Jens Axboe (3):
      options: show closest match for unknown job option
      options: strip off =optval when matching
      Update date and email in man page

 fio.1     |    4 ++--
 options.c |   39 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

---

Diff of recent changes:

diff --git a/fio.1 b/fio.1
index c3193a2..0e66206 100644
--- a/fio.1
+++ b/fio.1
@@ -1,4 +1,4 @@
-.TH fio 1 "October 2013" "User Manual"
+.TH fio 1 "December 2014" "User Manual"
 .SH NAME
 fio \- flexible I/O tester
 .SH SYNOPSIS
@@ -1873,7 +1873,7 @@ of being passed one from the client.
 
 .B fio
 was written by Jens Axboe <[email protected]>,
-now Jens Axboe <[email protected]>.
+now Jens Axboe <[email protected]>.
 .br
 This man page was written by Aaron Carroll <[email protected]> based
 on documentation by Jens Axboe.
diff --git a/options.c b/options.c
index c3c6292..2c703fd 100644
--- a/options.c
+++ b/options.c
@@ -3933,6 +3933,39 @@ static char **dup_and_sub_options(char **opts, int 
num_opts)
        return opts_copy;
 }
 
+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;
+       i = 0;
+       while (fio_options[i].name) {
+               distance = string_distance(name, fio_options[i].name);
+               if (distance < best_distance) {
+                       best_distance = distance;
+                       best_option = i;
+               }
+               i++;
+       }
+
+       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,
                        int dump_cmdline)
 {
@@ -3968,6 +4001,7 @@ int fio_options_parse(struct thread_data *td, char 
**opts, int num_opts,
                for (i = 0; i < num_opts; i++) {
                        struct fio_option *o = NULL;
                        int newret = 1;
+
                        if (!opts_copy[i])
                                continue;
 
@@ -3977,9 +4011,10 @@ int fio_options_parse(struct thread_data *td, char 
**opts, int num_opts,
                                                      td->eo, dump_cmdline);
 
                        ret |= newret;
-                       if (!o)
+                       if (!o) {
                                log_err("Bad option <%s>\n", opts[i]);
-
+                               show_closest_option(opts[i]);
+                       }
                        free(opts_copy[i]);
                        opts_copy[i] = NULL;
                }
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to