summaryrefslogtreecommitdiff
path: root/sftp-int.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2004-01-21 10:58:47 +1100
committerDamien Miller <djm@mindrot.org>2004-01-21 10:58:47 +1100
commit44f75c14f6f1eacfe6e1c98eae742019de24ad6a (patch)
treec0e6e41441881c57b9bdd66bb43fab41d0814a37 /sftp-int.c
parenta8df9248cea285d1a6d6d1ec8d33a24f208fdc42 (diff)
- 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@
Diffstat (limited to 'sftp-int.c')
-rw-r--r--sftp-int.c11
1 files changed, 8 insertions, 3 deletions
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 @@
25/* XXX: recursive operations */ 25/* XXX: recursive operations */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: sftp-int.c,v 1.65 2003/11/21 11:57:03 djm Exp $"); 28RCSID("$OpenBSD: sftp-int.c,v 1.66 2004/01/13 09:25:05 djm Exp $");
29 29
30#include "buffer.h" 30#include "buffer.h"
31#include "xmalloc.h" 31#include "xmalloc.h"
@@ -41,6 +41,9 @@ RCSID("$OpenBSD: sftp-int.c,v 1.65 2003/11/21 11:57:03 djm Exp $");
41/* File to read commands from */ 41/* File to read commands from */
42extern FILE *infile; 42extern FILE *infile;
43 43
44/* Are we in batchfile mode? */
45extern int batchmode;
46
44/* Size of buffer used when copying files */ 47/* Size of buffer used when copying files */
45extern size_t copy_buffer_len; 48extern size_t copy_buffer_len;
46 49
@@ -1172,14 +1175,16 @@ interactive_loop(int fd_in, int fd_out, char *file1, char *file2)
1172 if (fgets(cmd, sizeof(cmd), infile) == NULL) { 1175 if (fgets(cmd, sizeof(cmd), infile) == NULL) {
1173 printf("\n"); 1176 printf("\n");
1174 break; 1177 break;
1175 } else if (infile != stdin) /* Bluff typing */ 1178 }
1179
1180 if (batchmode) /* Echo command */
1176 printf("%s", cmd); 1181 printf("%s", cmd);
1177 1182
1178 cp = strrchr(cmd, '\n'); 1183 cp = strrchr(cmd, '\n');
1179 if (cp) 1184 if (cp)
1180 *cp = '\0'; 1185 *cp = '\0';
1181 1186
1182 err = parse_dispatch_command(conn, cmd, &pwd, infile != stdin); 1187 err = parse_dispatch_command(conn, cmd, &pwd, batchmode);
1183 if (err != 0) 1188 if (err != 0)
1184 break; 1189 break;
1185 } 1190 }