aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2017-11-13 10:09:05 +0100
committerTobias Brunner <tobias@strongswan.org>2017-11-13 10:09:41 +0100
commitc87b16d256f4e0a214b68935e7de8eee816f4fb7 (patch)
treedf2df718f0b90f3b2281eeaece729d09d589cc67
parentf0c7cbd1d731ff7e69a29b53bb32a493bd442af9 (diff)
downloadstrongswan-c87b16d256f4e0a214b68935e7de8eee816f4fb7.tar.bz2
strongswan-c87b16d256f4e0a214b68935e7de8eee816f4fb7.tar.xz
swanctl: Add check for conflicting short options
-rw-r--r--src/swanctl/command.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/swanctl/command.c b/src/swanctl/command.c
index 7f65d2b0e..225dff617 100644
--- a/src/swanctl/command.c
+++ b/src/swanctl/command.c
@@ -147,6 +147,15 @@ void command_register(command_t command)
"MAX_COMMANDS\n");
return;
}
+ for (i = 0; i < MAX_COMMANDS && cmds[i].cmd; i++)
+ {
+ if (cmds[i].op == command.op)
+ {
+ fprintf(stderr, "unable to register command --%s, short option "
+ "conflicts with --%s\n", command.cmd, cmds[i].cmd);
+ return;
+ }
+ }
cmds[registered] = command;
/* append default options, but not to --help */