diff cli-runopts.c @ 1890:45e552ee4391

merge
author Matt Johnston <matt@ucc.asn.au>
date Tue, 22 Mar 2022 16:17:47 +0800
parents 33363a68784d
children 3442105b2aba
line wrap: on
line diff
--- a/cli-runopts.c	Tue Mar 22 16:17:05 2022 +0800
+++ b/cli-runopts.c	Tue Mar 22 16:17:47 2022 +0800
@@ -62,6 +62,7 @@
 					"-T    Don't allocate a pty\n"
 					"-N    Don't run a remote command\n"
 					"-f    Run in background after auth\n"
+					"-q    quiet, don't show remote banner\n"
 					"-y    Always accept remote host key if unknown\n"
 					"-y -y Don't perform any remote host key checking (caution)\n"
 					"-s    Request a subsystem (use by external sftp)\n"
@@ -141,6 +142,7 @@
 	cli_opts.username = NULL;
 	cli_opts.cmd = NULL;
 	cli_opts.no_cmd = 0;
+	cli_opts.quiet = 0;
 	cli_opts.backgrounded = 0;
 	cli_opts.wantpty = 9; /* 9 means "it hasn't been touched", gets set later */
 	cli_opts.always_accept_key = 0;
@@ -214,6 +216,9 @@
 					}
 					cli_opts.always_accept_key = 1;
 					break;
+				case 'q': /* quiet */
+					cli_opts.quiet = 1;
+					break;
 				case 'p': /* remoteport */
 					next = (char**)&cli_opts.remoteport;
 					break;
@@ -540,6 +545,12 @@
 	ret = m_malloc(len);
 	total = 0;
 
+	if (cli_opts.quiet)
+	{
+		int written = snprintf(ret+total, len-total, "-q ");
+		total += written;
+	}
+
 	if (cli_opts.no_hostkey_check)
 	{
 		int written = snprintf(ret+total, len-total, "-y -y ");