From e6e7ab87927c009bc0652ab57aa70b28e81b17c1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 9 Feb 2010 11:02:44 -0800 Subject: [PATCH] ovs-vsctl: Improve error message when options follow command names. --- utilities/ovs-vsctl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 { -- 2.30.2