summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/scp.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-12-11 17:27:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-12-11 17:27:34 +0000
commita84fcdbfe16dff279aa8be5f2d01944533cbed4a (patch)
tree9c16b16d1080b5fa4f7562ca50ab3531a575d53b /usr.bin/ssh/scp.c
parenteb2cb734a1fdff8a3876506ab1b764d7b7a9da45 (diff)
when copying 0-sized files, do not re-print ETA time at completion
Diffstat (limited to 'usr.bin/ssh/scp.c')
-rw-r--r--usr.bin/ssh/scp.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index a412b8d92f2..be1cf4d242b 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -75,7 +75,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.43 2000/10/18 18:23:02 markus Exp $");
+RCSID("$OpenBSD: scp.c,v 1.44 2000/12/11 17:27:33 deraadt Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -397,20 +397,20 @@ toremote(targ, argc, argv)
suser = pwd->pw_name;
else if (!okname(suser))
continue;
- (void) sprintf(bp,
+ sprintf(bp,
"%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'",
- ssh_program, verbose_mode ? " -v" : "",
- suser, host, cmd, src,
- tuser ? tuser : "", tuser ? "@" : "",
- thost, targ);
+ ssh_program, verbose_mode ? " -v" : "",
+ suser, host, cmd, src,
+ tuser ? tuser : "", tuser ? "@" : "",
+ thost, targ);
} else {
host = cleanhostname(argv[i]);
- (void) sprintf(bp,
+ sprintf(bp,
"exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'",
- ssh_program, verbose_mode ? " -v" : "",
- host, cmd, src,
- tuser ? tuser : "", tuser ? "@" : "",
- thost, targ);
+ ssh_program, verbose_mode ? " -v" : "",
+ host, cmd, src,
+ tuser ? tuser : "", tuser ? "@" : "",
+ thost, targ);
}
if (verbose_mode)
fprintf(stderr, "Executing: %s\n", bp);
@@ -539,10 +539,9 @@ syserr: run_err("%s: %s", name, strerror(errno));
goto next;
}
#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
- (void) sprintf(buf, "C%04o %lu %s\n",
- (unsigned int) (stb.st_mode & FILEMODEMASK),
- (unsigned long) stb.st_size,
- last);
+ sprintf(buf, "C%04o %lu %s\n",
+ (unsigned int) (stb.st_mode & FILEMODEMASK),
+ (unsigned long) stb.st_size, last);
if (verbose_mode) {
fprintf(stderr, "Sending file modes: %s", buf);
fflush(stderr);
@@ -697,7 +696,7 @@ sink(argc, argv)
if (buf[0] == '\01' || buf[0] == '\02') {
if (iamremote == 0)
(void) atomicio(write, STDERR_FILENO,
- buf + 1, strlen(buf + 1));
+ buf + 1, strlen(buf + 1));
if (buf[0] == '\02')
exit(1);
++errs;
@@ -1148,8 +1147,7 @@ progressmeter(int flag)
abbrevsize >>= 10;
}
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5qd %c%c ",
- (quad_t) abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' :
- 'B');
+ (quad_t) abbrevsize, prefixes[i], prefixes[i] == ' ' ? ' ' : 'B');
timersub(&now, &lastupdate, &wait);
if (cursize > lastsize) {
@@ -1164,16 +1162,17 @@ progressmeter(int flag)
timersub(&now, &start, &td);
elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
- if (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes) {
+ if (flag != 1 &&
+ (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes)) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
- " --:-- ETA");
+ " --:-- ETA");
} else if (wait.tv_sec >= STALLTIME) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
- " - stalled -");
+ " - stalled -");
} else {
if (flag != 1)
- remaining =
- (int)(totalbytes / (statbytes / elapsed) - elapsed);
+ remaining = (int)(totalbytes / (statbytes / elapsed) -
+ elapsed);
else
remaining = elapsed;