From 44f75c14f6f1eacfe6e1c98eae742019de24ad6a Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 21 Jan 2004 10:58:47 +1100 Subject: - djm@cvs.openbsd.org 2004/01/13 09:25:05 [sftp-int.c sftp.1 sftp.c] Tidy sftp batchmode handling, eliminate junk to stderr (bugzilla #754) and enable use of "-b -" to accept batchfile from stdin; ok markus@ --- sftp-int.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sftp-int.c') diff --git a/sftp-int.c b/sftp-int.c index edb475bbb..a9423fe69 100644 --- a/sftp-int.c +++ b/sftp-int.c @@ -25,7 +25,7 @@ /* XXX: recursive operations */ #include "includes.h" -RCSID("$OpenBSD: sftp-int.c,v 1.65 2003/11/21 11:57:03 djm Exp $"); +RCSID("$OpenBSD: sftp-int.c,v 1.66 2004/01/13 09:25:05 djm Exp $"); #include "buffer.h" #include "xmalloc.h" @@ -41,6 +41,9 @@ RCSID("$OpenBSD: sftp-int.c,v 1.65 2003/11/21 11:57:03 djm Exp $"); /* File to read commands from */ extern FILE *infile; +/* Are we in batchfile mode? */ +extern int batchmode; + /* Size of buffer used when copying files */ extern size_t copy_buffer_len; @@ -1172,14 +1175,16 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2) if (fgets(cmd, sizeof(cmd), infile) == NULL) { printf("\n"); break; - } else if (infile != stdin) /* Bluff typing */ + } + + if (batchmode) /* Echo command */ printf("%s", cmd); cp = strrchr(cmd, '\n'); if (cp) *cp = '\0'; - err = parse_dispatch_command(conn, cmd, &pwd, infile != stdin); + err = parse_dispatch_command(conn, cmd, &pwd, batchmode); if (err != 0) break; } -- cgit v1.2.3