changeset 1160:1b583b2994ba

Warn rather than fail if flags have trailing parts
author Matt Johnston <matt@ucc.asn.au>
date Wed, 28 Oct 2015 21:37:35 +0800
parents f567a4152c14
children b8f362078209
files cli-runopts.c svr-runopts.c
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cli-runopts.c	Wed Oct 21 23:08:22 2015 +0800
+++ b/cli-runopts.c	Wed Oct 28 21:37:35 2015 +0800
@@ -220,8 +220,9 @@
 			/* A flag *waves* */
 			char c = argv[i][1];
 			if (strlen(argv[i]) != 2) {
-				/* Ensure only one flag per hyphen. '?' falls through to print help */
-				c = '?';
+				/* We only handle one flag per hyphen */
+				fprintf(stderr, "Warning, trailing '%s' of '%s' is ignored.\n",
+					&argv[i][2], argv[i]);
 			}
 			switch (c) {
 				case 'y': /* always accept the remote hostkey */
--- a/svr-runopts.c	Wed Oct 21 23:08:22 2015 +0800
+++ b/svr-runopts.c	Wed Oct 28 21:37:35 2015 +0800
@@ -191,8 +191,9 @@
 		if (argv[i][0] == '-') {
 			char c = argv[i][1];
 			if (strlen(argv[i]) != 2) {
-				/* Ensure only one flag per hyphen. '?' falls through to print help */
-				c = '?';
+				/* We only handle one flag per hyphen */
+				fprintf(stderr, "Warning, trailing '%s' of '%s' is ignored.\n",
+					&argv[i][2], argv[i]);
 			}
 			switch (c) {
 				case 'b':