summaryrefslogtreecommitdiff
path: root/sftp.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-08 22:04:05 +1100
committerDamien Miller <djm@mindrot.org>2002-02-08 22:04:05 +1100
commit8829d3669d154dbd06f9ee2cc779f14e2af8e15f (patch)
tree06c5dc3d5c2352c1466d76512d2d9cd5e6b6513a /sftp.c
parente8c9ed436a23d0fdbad1881092a3f9d2e7d5f822 (diff)
- djm@cvs.openbsd.org 2002/02/05 00:00:46
[sftp.1 sftp.c sftp-client.c sftp-client.h sftp-int.c] Add "-B" option to specify copy buffer length (default 32k); ok markus@
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sftp.c b/sftp.c
index 3748d055d..c2282b502 100644
--- a/sftp.c
+++ b/sftp.c
@@ -24,7 +24,7 @@
24 24
25#include "includes.h" 25#include "includes.h"
26 26
27RCSID("$OpenBSD: sftp.c,v 1.23 2002/02/04 21:53:12 djm Exp $"); 27RCSID("$OpenBSD: sftp.c,v 1.24 2002/02/05 00:00:46 djm Exp $");
28 28
29/* XXX: short-form remote directory listings (like 'ls -C') */ 29/* XXX: short-form remote directory listings (like 'ls -C') */
30 30
@@ -46,6 +46,7 @@ char *__progname;
46#endif 46#endif
47 47
48FILE* infile; 48FILE* infile;
49size_t copy_buffer_len = 32768;
49 50
50static void 51static void
51connect_to_server(char *path, char **args, int *in, int *out, pid_t *sshpid) 52connect_to_server(char *path, char **args, int *in, int *out, pid_t *sshpid)
@@ -93,7 +94,8 @@ usage(void)
93{ 94{
94 fprintf(stderr, 95 fprintf(stderr,
95 "usage: sftp [-1Cv] [-b batchfile] [-F config] [-o option] [-s subsystem|path]\n" 96 "usage: sftp [-1Cv] [-b batchfile] [-F config] [-o option] [-s subsystem|path]\n"
96 " [-S program] [user@]host[:file [file]]\n"); 97 " [-P direct server path] [-S program] \n"
98 " [-B buffer_size] [user@]host[:file [file]]\n");
97 exit(1); 99 exit(1);
98} 100}
99 101
@@ -121,7 +123,7 @@ main(int argc, char **argv)
121 ll = SYSLOG_LEVEL_INFO; 123 ll = SYSLOG_LEVEL_INFO;
122 infile = stdin; /* Read from STDIN unless changed by -b */ 124 infile = stdin; /* Read from STDIN unless changed by -b */
123 125
124 while ((ch = getopt(argc, argv, "1hvCo:s:S:b:F:P:")) != -1) { 126 while ((ch = getopt(argc, argv, "1hvCo:s:S:b:B:F:P:")) != -1) {
125 switch (ch) { 127 switch (ch) {
126 case 'C': 128 case 'C':
127 addargs(&args, "-C"); 129 addargs(&args, "-C");
@@ -159,6 +161,11 @@ main(int argc, char **argv)
159 case 'P': 161 case 'P':
160 sftp_direct = optarg; 162 sftp_direct = optarg;
161 break; 163 break;
164 case 'B':
165 copy_buffer_len = strtol(optarg, &cp, 10);
166 if (copy_buffer_len == 0 || *cp != '\0')
167 fatal("Invalid buffer size \"%s\"", optarg);
168 break;
162 case 'h': 169 case 'h':
163 default: 170 default:
164 usage(); 171 usage();