diff svr-runopts.c @ 1153:67d8a904f5a9

don't silently ignore extra flag arguments
author Matt Johnston <matt@ucc.asn.au>
date Wed, 21 Oct 2015 22:05:50 +0800
parents 47643024fc90
children 1b583b2994ba
line wrap: on
line diff
--- a/svr-runopts.c	Tue Sep 29 22:19:11 2015 +0800
+++ b/svr-runopts.c	Wed Oct 21 22:05:50 2015 +0800
@@ -189,7 +189,12 @@
 		}
 
 		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;