From: Ben Pfaff Date: Tue, 9 Feb 2010 19:02:44 +0000 (-0800) Subject: ovs-vsctl: Improve error message when options follow command names. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6e7ab87927c009bc0652ab57aa70b28e81b17c1;p=openvswitch ovs-vsctl: Improve error message when options follow command names. --- diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index e2e577be..18f3fd64 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -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 {