comparison cli-runopts.c @ 326:d965110e3f5c

add -f background option to dbclient
author Matt Johnston <matt@ucc.asn.au>
date Wed, 07 Jun 2006 15:47:04 +0000
parents 0e4f225b7e07
children 9341570412e5
comparison
equal deleted inserted replaced
325:0e4f225b7e07 326:d965110e3f5c
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" 53 "-N Don't run a remote command\n"
54 "-f Run in background after auth\n"
54 #ifdef ENABLE_CLI_PUBKEY_AUTH 55 #ifdef ENABLE_CLI_PUBKEY_AUTH
55 "-i <identityfile> (multiple allowed)\n" 56 "-i <identityfile> (multiple allowed)\n"
56 #endif 57 #endif
57 #ifdef ENABLE_CLI_LOCALTCPFWD 58 #ifdef ENABLE_CLI_LOCALTCPFWD
58 "-L <listenport:remotehost:remoteport> Local port forwarding\n" 59 "-L <listenport:remotehost:remoteport> Local port forwarding\n"
88 cli_opts.remotehost = NULL; 89 cli_opts.remotehost = NULL;
89 cli_opts.remoteport = NULL; 90 cli_opts.remoteport = NULL;
90 cli_opts.username = NULL; 91 cli_opts.username = NULL;
91 cli_opts.cmd = NULL; 92 cli_opts.cmd = NULL;
92 cli_opts.no_cmd = 0; 93 cli_opts.no_cmd = 0;
94 cli_opts.backgrounded = 0;
93 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 */
94 #ifdef ENABLE_CLI_PUBKEY_AUTH 96 #ifdef ENABLE_CLI_PUBKEY_AUTH
95 cli_opts.privkeys = NULL; 97 cli_opts.privkeys = NULL;
96 #endif 98 #endif
97 #ifdef ENABLE_CLI_LOCALTCPFWD 99 #ifdef ENABLE_CLI_LOCALTCPFWD
165 case 'T': /* don't want a pty */ 167 case 'T': /* don't want a pty */
166 cli_opts.wantpty = 0; 168 cli_opts.wantpty = 0;
167 break; 169 break;
168 case 'N': 170 case 'N':
169 cli_opts.no_cmd = 1; 171 cli_opts.no_cmd = 1;
172 break;
173 case 'f':
174 cli_opts.backgrounded = 1;
170 break; 175 break;
171 #ifdef ENABLE_CLI_LOCALTCPFWD 176 #ifdef ENABLE_CLI_LOCALTCPFWD
172 case 'L': 177 case 'L':
173 nextislocal = 1; 178 nextislocal = 1;
174 break; 179 break;
272 cli_opts.wantpty = 1; 277 cli_opts.wantpty = 1;
273 } else { 278 } else {
274 cli_opts.wantpty = 0; 279 cli_opts.wantpty = 0;
275 } 280 }
276 } 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 }
277 } 287 }
278 288
279 #ifdef ENABLE_CLI_PUBKEY_AUTH 289 #ifdef ENABLE_CLI_PUBKEY_AUTH
280 static void loadidentityfile(const char* filename) { 290 static void loadidentityfile(const char* filename) {
281 291