diff 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
line wrap: on
line diff
--- a/cli-runopts.c	Wed Jun 07 15:01:20 2006 +0000
+++ b/cli-runopts.c	Wed Jun 07 15:47:04 2006 +0000
@@ -51,6 +51,7 @@
 					"-t    Allocate a pty\n"
 					"-T    Don't allocate a pty\n"
 					"-N    Don't run a remote command\n"
+					"-f    Run in background after auth\n"
 #ifdef ENABLE_CLI_PUBKEY_AUTH
 					"-i <identityfile>   (multiple allowed)\n"
 #endif
@@ -90,6 +91,7 @@
 	cli_opts.username = NULL;
 	cli_opts.cmd = NULL;
 	cli_opts.no_cmd = 0;
+	cli_opts.backgrounded = 0;
 	cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */
 #ifdef ENABLE_CLI_PUBKEY_AUTH
 	cli_opts.privkeys = NULL;
@@ -168,6 +170,9 @@
 				case 'N':
 					cli_opts.no_cmd = 1;
 					break;
+				case 'f':
+					cli_opts.backgrounded = 1;
+					break;
 #ifdef ENABLE_CLI_LOCALTCPFWD
 				case 'L':
 					nextislocal = 1;
@@ -274,6 +279,11 @@
 			cli_opts.wantpty = 0;
 		}
 	}
+
+	if (cli_opts.backgrounded && cli_opts.cmd == NULL
+			&& cli_opts.no_cmd == 0) {
+		dropbear_exit("command required for -f");
+	}
 }
 
 #ifdef ENABLE_CLI_PUBKEY_AUTH