summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2004-03-01 02:25:32 +0000
committerColin Watson <cjwatson@debian.org>2004-03-01 02:25:32 +0000
commitea8116a11e3de70036dbc665ccb0d486cf89cac9 (patch)
treed73ccdff78d8608e156465af42e6a1b3527fb2d6 /scp.c
parente39b311381a5609cc05acf298c42fba196dc524b (diff)
parentf5bda272678ec6dccaa5f29379cf60cb855018e8 (diff)
Merge 3.8p1 to the trunk. This builds and runs, but I haven't tested it
extensively yet. ProtocolKeepAlives is now just a compatibility alias for ServerAliveInterval.
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/scp.c b/scp.c
index 4f9247c2d..1daa2ccf7 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
71 */ 71 */
72 72
73#include "includes.h" 73#include "includes.h"
74RCSID("$OpenBSD: scp.c,v 1.108 2003/07/18 01:54:25 deraadt Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.113 2003/11/23 23:21:21 djm Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -92,7 +92,7 @@ void bwlimit(int);
92arglist args; 92arglist args;
93 93
94/* Bandwidth limit */ 94/* Bandwidth limit */
95off_t limitbw = 0; 95off_t limit_rate = 0;
96 96
97/* Name of current file being transferred. */ 97/* Name of current file being transferred. */
98char *curfile; 98char *curfile;
@@ -257,7 +257,7 @@ main(int argc, char **argv)
257 speed = strtod(optarg, &endp); 257 speed = strtod(optarg, &endp);
258 if (speed <= 0 || *endp != '\0') 258 if (speed <= 0 || *endp != '\0')
259 usage(); 259 usage();
260 limitbw = speed * 1024; 260 limit_rate = speed * 1024;
261 break; 261 break;
262 case 'p': 262 case 'p':
263 pflag = 1; 263 pflag = 1;
@@ -273,6 +273,7 @@ main(int argc, char **argv)
273 verbose_mode = 1; 273 verbose_mode = 1;
274 break; 274 break;
275 case 'q': 275 case 'q':
276 addargs(&args, "-q");
276 showprogress = 0; 277 showprogress = 0;
277 break; 278 break;
278 279
@@ -426,7 +427,8 @@ toremote(char *targ, int argc, char **argv)
426 } 427 }
427 if (verbose_mode) 428 if (verbose_mode)
428 fprintf(stderr, "Executing: %s\n", bp); 429 fprintf(stderr, "Executing: %s\n", bp);
429 (void) system(bp); 430 if (system(bp) != 0)
431 errs = 1;
430 (void) xfree(bp); 432 (void) xfree(bp);
431 } else { /* local to remote */ 433 } else { /* local to remote */
432 if (remin == -1) { 434 if (remin == -1) {
@@ -587,7 +589,7 @@ next: (void) close(fd);
587 haderr = result >= 0 ? EIO : errno; 589 haderr = result >= 0 ? EIO : errno;
588 statbytes += result; 590 statbytes += result;
589 } 591 }
590 if (limitbw) 592 if (limit_rate)
591 bwlimit(amt); 593 bwlimit(amt);
592 } 594 }
593 if (showprogress) 595 if (showprogress)
@@ -679,7 +681,7 @@ bwlimit(int amount)
679 return; 681 return;
680 682
681 lamt *= 8; 683 lamt *= 8;
682 wait = (double)1000000L * lamt / limitbw; 684 wait = (double)1000000L * lamt / limit_rate;
683 685
684 bwstart.tv_sec = wait / 1000000L; 686 bwstart.tv_sec = wait / 1000000L;
685 bwstart.tv_usec = wait % 1000000L; 687 bwstart.tv_usec = wait % 1000000L;
@@ -905,8 +907,8 @@ bad: run_err("%s: %s", np, strerror(errno));
905 cp += j; 907 cp += j;
906 statbytes += j; 908 statbytes += j;
907 } while (amt > 0); 909 } while (amt > 0);
908 910
909 if (limitbw) 911 if (limit_rate)
910 bwlimit(4096); 912 bwlimit(4096);
911 913
912 if (count == bp->cnt) { 914 if (count == bp->cnt) {
@@ -1018,8 +1020,8 @@ void
1018usage(void) 1020usage(void)
1019{ 1021{
1020 (void) fprintf(stderr, 1022 (void) fprintf(stderr,
1021 "usage: scp [-pqrvBC1246] [-F config] [-S program] [-P port]\n" 1023 "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n"
1022 " [-c cipher] [-i identity] [-l limit] [-o option]\n" 1024 " [-l limit] [-o ssh_option] [-P port] [-S program]\n"
1023 " [[user@]host1:]file1 [...] [[user@]host2:]file2\n"); 1025 " [[user@]host1:]file1 [...] [[user@]host2:]file2\n");
1024 exit(1); 1026 exit(1);
1025} 1027}