comparison cli-runopts.c @ 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 67d8a904f5a9
children ff9bd50f1457
comparison
equal deleted inserted replaced
1159:f567a4152c14 1160:1b583b2994ba
218 218
219 if (argv[i][0] == '-') { 219 if (argv[i][0] == '-') {
220 /* A flag *waves* */ 220 /* A flag *waves* */
221 char c = argv[i][1]; 221 char c = argv[i][1];
222 if (strlen(argv[i]) != 2) { 222 if (strlen(argv[i]) != 2) {
223 /* Ensure only one flag per hyphen. '?' falls through to print help */ 223 /* We only handle one flag per hyphen */
224 c = '?'; 224 fprintf(stderr, "Warning, trailing '%s' of '%s' is ignored.\n",
225 &argv[i][2], argv[i]);
225 } 226 }
226 switch (c) { 227 switch (c) {
227 case 'y': /* always accept the remote hostkey */ 228 case 'y': /* always accept the remote hostkey */
228 if (cli_opts.always_accept_key) { 229 if (cli_opts.always_accept_key) {
229 /* twice means no checking at all */ 230 /* twice means no checking at all */