From e4827025be46a3a257a3070dcb14265f0c40d7b9 Mon Sep 17 00:00:00 2001
From: Matt Johnston <matt@ucc.asn.au>
Date: Wed, 28 Oct 2015 21:37:35 +0800
Subject: [PATCH] Warn rather than fail if flags have trailing parts

---
 cli-runopts.c | 5 +++--
 svr-runopts.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/cli-runopts.c b/cli-runopts.c
index b251550f..2b0cb7d5 100644
--- a/cli-runopts.c
+++ b/cli-runopts.c
@@ -220,8 +220,9 @@ void cli_getopts(int argc, char ** argv) {
 			/* 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 */
diff --git a/svr-runopts.c b/svr-runopts.c
index acb7cc1f..26c199b1 100644
--- a/svr-runopts.c
+++ b/svr-runopts.c
@@ -191,8 +191,9 @@ void svr_getopts(int argc, char ** argv) {
 		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':
-- 
GitLab