changeset 1877:33363a68784d

use option -q for suppression remote banner output, pass option also for proxy command
author HansH111 <hans@atbas.org>
date Sun, 13 Mar 2022 14:20:02 +0000
parents bfd0f3248df3
children d512da7b1198
files cli-runopts.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cli-runopts.c	Sun Mar 13 14:16:50 2022 +0000
+++ b/cli-runopts.c	Sun Mar 13 14:20:02 2022 +0000
@@ -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 ");