comparison cli-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 36557295418e
children 1b583b2994ba
comparison
equal deleted inserted replaced
1152:57d09741d46d 1153:67d8a904f5a9
216 continue; 216 continue;
217 } 217 }
218 218
219 if (argv[i][0] == '-') { 219 if (argv[i][0] == '-') {
220 /* A flag *waves* */ 220 /* A flag *waves* */
221 221 char c = argv[i][1];
222 switch (argv[i][1]) { 222 if (strlen(argv[i]) != 2) {
223 /* Ensure only one flag per hyphen. '?' falls through to print help */
224 c = '?';
225 }
226 switch (c) {
223 case 'y': /* always accept the remote hostkey */ 227 case 'y': /* always accept the remote hostkey */
224 if (cli_opts.always_accept_key) { 228 if (cli_opts.always_accept_key) {
225 /* twice means no checking at all */ 229 /* twice means no checking at all */
226 cli_opts.no_hostkey_check = 1; 230 cli_opts.no_hostkey_check = 1;
227 } 231 }