ovs-vsctl: Improve error message when options follow command names.
authorBen Pfaff <blp@nicira.com>
Tue, 9 Feb 2010 19:02:44 +0000 (11:02 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 9 Feb 2010 19:05:19 +0000 (11:05 -0800)
utilities/ovs-vsctl.c

index e2e577be8758564efde4c4e47211c6110197099a..18f3fd645a37a549609d21bd01f02150850c5237 100644 (file)
@@ -317,6 +317,17 @@ parse_command(int argc, char *argv[], struct vsctl_command *command)
                 vsctl_fatal("'%s' command requires at least %d arguments",
                             p->name, p->min_args);
             } else if (n_arg > p->max_args) {
+                int j;
+
+                for (j = i + 1; j < argc; j++) {
+                    if (argv[j][0] == '-') {
+                        vsctl_fatal("'%s' command takes at most %d arguments "
+                                    "(note that options must precede command "
+                                    "names and follow a \"--\" argument)",
+                                    p->name, p->max_args);
+                    }
+                }
+
                 vsctl_fatal("'%s' command takes at most %d arguments",
                             p->name, p->max_args);
             } else {