comparison cli-runopts.c @ 378:a124aff0cbf1

merge of '182c2d8dbd5321ef4d1df8758936f4dc7127015f' and '31dcd7a22983ef19d6c63248e415e71d292dd0ec'
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Dec 2006 13:11:41 +0000
parents 9341570412e5
children b895f91c2ee6
comparison
equal deleted inserted replaced
377:1bfa65fed772 378:a124aff0cbf1
42 #endif 42 #endif
43 43
44 static void printhelp() { 44 static void printhelp() {
45 45
46 fprintf(stderr, "Dropbear client v%s\n" 46 fprintf(stderr, "Dropbear client v%s\n"
47 "Usage: %s [options] [user@]host\n" 47 "Usage: %s [options] [user@]host [command]\n"
48 "Options are:\n" 48 "Options are:\n"
49 "-p <remoteport>\n" 49 "-p <remoteport>\n"
50 "-l <username>\n" 50 "-l <username>\n"
51 "-t Allocate a pty\n" 51 "-t Allocate a pty\n"
52 "-T Don't allocate a pty\n" 52 "-T Don't allocate a pty\n"
53 "-N Don't run a remote command\n"
54 "-f Run in background after auth\n"
53 #ifdef ENABLE_CLI_PUBKEY_AUTH 55 #ifdef ENABLE_CLI_PUBKEY_AUTH
54 "-i <identityfile> (multiple allowed)\n" 56 "-i <identityfile> (multiple allowed)\n"
55 #endif 57 #endif
56 #ifdef ENABLE_CLI_LOCALTCPFWD 58 #ifdef ENABLE_CLI_LOCALTCPFWD
57 "-L <listenport:remotehost:remoteport> Local port forwarding\n" 59 "-L <listenport:remotehost:remoteport> Local port forwarding\n"
86 cli_opts.progname = argv[0]; 88 cli_opts.progname = argv[0];
87 cli_opts.remotehost = NULL; 89 cli_opts.remotehost = NULL;
88 cli_opts.remoteport = NULL; 90 cli_opts.remoteport = NULL;
89 cli_opts.username = NULL; 91 cli_opts.username = NULL;
90 cli_opts.cmd = NULL; 92 cli_opts.cmd = NULL;
93 cli_opts.no_cmd = 0;
94 cli_opts.backgrounded = 0;
91 cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */ 95 cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */
92 #ifdef ENABLE_CLI_PUBKEY_AUTH 96 #ifdef ENABLE_CLI_PUBKEY_AUTH
93 cli_opts.privkeys = NULL; 97 cli_opts.privkeys = NULL;
94 #endif 98 #endif
95 #ifdef ENABLE_CLI_LOCALTCPFWD 99 #ifdef ENABLE_CLI_LOCALTCPFWD
160 case 't': /* we want a pty */ 164 case 't': /* we want a pty */
161 cli_opts.wantpty = 1; 165 cli_opts.wantpty = 1;
162 break; 166 break;
163 case 'T': /* don't want a pty */ 167 case 'T': /* don't want a pty */
164 cli_opts.wantpty = 0; 168 cli_opts.wantpty = 0;
169 break;
170 case 'N':
171 cli_opts.no_cmd = 1;
172 break;
173 case 'f':
174 cli_opts.backgrounded = 1;
165 break; 175 break;
166 #ifdef ENABLE_CLI_LOCALTCPFWD 176 #ifdef ENABLE_CLI_LOCALTCPFWD
167 case 'L': 177 case 'L':
168 nextislocal = 1; 178 nextislocal = 1;
169 break; 179 break;
267 cli_opts.wantpty = 1; 277 cli_opts.wantpty = 1;
268 } else { 278 } else {
269 cli_opts.wantpty = 0; 279 cli_opts.wantpty = 0;
270 } 280 }
271 } 281 }
282
283 if (cli_opts.backgrounded && cli_opts.cmd == NULL
284 && cli_opts.no_cmd == 0) {
285 dropbear_exit("command required for -f");
286 }
272 } 287 }
273 288
274 #ifdef ENABLE_CLI_PUBKEY_AUTH 289 #ifdef ENABLE_CLI_PUBKEY_AUTH
275 static void loadidentityfile(const char* filename) { 290 static void loadidentityfile(const char* filename) {
276 291