summaryrefslogtreecommitdiffhomepage
path: root/svr-runopts.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2015-10-21 22:05:50 +0800
committerMatt Johnston <matt@ucc.asn.au>2015-10-21 22:05:50 +0800
commit23cc2bfb8cf82d378c4e678b9505ec328998aee7 (patch)
tree6bc7e7501480e71eaa9a2fe142225e5d02522fd7 /svr-runopts.c
parent9e379835c4ebbfef41440416fc72518e48ea8dde (diff)
don't silently ignore extra flag arguments
Diffstat (limited to 'svr-runopts.c')
-rw-r--r--svr-runopts.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/svr-runopts.c b/svr-runopts.c
index 09fc9af..acb7cc1 100644
--- a/svr-runopts.c
+++ b/svr-runopts.c
@@ -189,7 +189,12 @@ void svr_getopts(int argc, char ** argv) {
}
if (argv[i][0] == '-') {
- switch (argv[i][1]) {
+ char c = argv[i][1];
+ if (strlen(argv[i]) != 2) {
+ /* Ensure only one flag per hyphen. '?' falls through to print help */
+ c = '?';
+ }
+ switch (c) {
case 'b':
next = &svr_opts.bannerfile;
break;