upstream: Add a flag to re-enable verbose output when in batch

mode; requested in bz3135; ok dtucker

OpenBSD-Commit-ID: 5ad2ed0e6440562ba9c84b666a5bbddc1afe2e2b
This commit is contained in:
djm@openbsd.org 2020-04-03 04:34:15 +00:00 committed by Damien Miller
parent 6ce51a5da5
commit 9cd40b829a
2 changed files with 16 additions and 6 deletions

10
sftp.1
View File

@ -1,4 +1,4 @@
.\" $OpenBSD: sftp.1,v 1.128 2019/11/30 07:07:59 jmc Exp $ .\" $OpenBSD: sftp.1,v 1.129 2020/04/03 04:34:15 djm Exp $
.\" .\"
.\" Copyright (c) 2001 Damien Miller. All rights reserved. .\" Copyright (c) 2001 Damien Miller. All rights reserved.
.\" .\"
@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: November 30 2019 $ .Dd $Mdocdate: April 3 2020 $
.Dt SFTP 1 .Dt SFTP 1
.Os .Os
.Sh NAME .Sh NAME
@ -30,7 +30,7 @@
.Nd OpenSSH secure file transfer .Nd OpenSSH secure file transfer
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm sftp .Nm sftp
.Op Fl 46aCfpqrv .Op Fl 46aCfNpqrv
.Op Fl B Ar buffer_size .Op Fl B Ar buffer_size
.Op Fl b Ar batchfile .Op Fl b Ar batchfile
.Op Fl c Ar cipher .Op Fl c Ar cipher
@ -275,6 +275,10 @@ For full details of the options listed below, and their possible values, see
.El .El
.It Fl P Ar port .It Fl P Ar port
Specifies the port to connect to on the remote host. Specifies the port to connect to on the remote host.
.It Fl N
Disables quiet mode, e.g. to override the implicit quiet mode set by the
.Fl b
flag.
.It Fl p .It Fl p
Preserves modification times, access times, and modes from the Preserves modification times, access times, and modes from the
original files transferred. original files transferred.

12
sftp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp.c,v 1.198 2020/02/26 11:46:51 dtucker Exp $ */ /* $OpenBSD: sftp.c,v 1.199 2020/04/03 04:34:15 djm Exp $ */
/* /*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
* *
@ -2375,7 +2375,7 @@ usage(void)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int in, out, ch, err, tmp, port = -1; int in, out, ch, err, tmp, port = -1, noisy = 0;
char *host = NULL, *user, *cp, *file2 = NULL; char *host = NULL, *user, *cp, *file2 = NULL;
int debug_level = 0; int debug_level = 0;
char *file1 = NULL, *sftp_server = NULL; char *file1 = NULL, *sftp_server = NULL;
@ -2409,7 +2409,7 @@ main(int argc, char **argv)
infile = stdin; infile = stdin;
while ((ch = getopt(argc, argv, while ((ch = getopt(argc, argv,
"1246afhpqrvCc:D:i:l:o:s:S:b:B:F:J:P:R:")) != -1) { "1246afhNpqrvCc:D:i:l:o:s:S:b:B:F:J:P:R:")) != -1) {
switch (ch) { switch (ch) {
/* Passed through to ssh(1) */ /* Passed through to ssh(1) */
case '4': case '4':
@ -2473,6 +2473,9 @@ main(int argc, char **argv)
case 'f': case 'f':
global_fflag = 1; global_fflag = 1;
break; break;
case 'N':
noisy = 1; /* Used to clear quiet mode after getopt */
break;
case 'p': case 'p':
global_pflag = 1; global_pflag = 1;
break; break;
@ -2511,6 +2514,9 @@ main(int argc, char **argv)
if (!isatty(STDERR_FILENO)) if (!isatty(STDERR_FILENO))
showprogress = 0; showprogress = 0;
if (noisy)
quiet = 0;
log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1); log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1);
if (sftp_direct == NULL) { if (sftp_direct == NULL) {