Warn rather than fail if flags have trailing parts

This commit is contained in:
Matt Johnston 2015-10-28 21:37:35 +08:00
parent 00798ca8cc
commit e4827025be
2 changed files with 6 additions and 4 deletions

View File

@ -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 */

View File

@ -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':