X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/510132b69d4fdceca750f6de39b2be84c49006c8..7aa46e5966683ecf73cf348de47fbcc062df1ca3:/openssh/scp.c diff --git a/openssh/scp.c b/openssh/scp.c index 1fab483..fb4d309 100644 --- a/openssh/scp.c +++ b/openssh/scp.c @@ -75,7 +75,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: scp.c,v 1.88 2002/04/06 18:24:09 mouring Exp $"); +RCSID("$OpenBSD: scp.c,v 1.85 2001/10/01 08:06:28 markus Exp $"); #include "xmalloc.h" #include "atomicio.h" @@ -94,6 +94,14 @@ char *__progname; /* alarm() interval for updating progress meter */ #define PROGRESSTIME 1 +/* Progress meter bar */ +#define BAR \ + "************************************************************"\ + "************************************************************"\ + "************************************************************"\ + "************************************************************" +#define MAX_BARLENGTH (sizeof(BAR) - 1) + /* Visual statistics about files as they are transferred. */ void progressmeter(int); @@ -540,13 +548,14 @@ syserr: run_err("%s: %s", name, strerror(errno)); #ifdef HAVE_LONG_LONG_INT snprintf(buf, sizeof buf, "C%04o %lld %s\n", (u_int) (stb.st_mode & FILEMODEMASK), - (long long)stb.st_size, last); + (long long) stb.st_size, last); #else /* XXX: Handle integer overflow? */ snprintf(buf, sizeof buf, "C%04o %lu %s\n", (u_int) (stb.st_mode & FILEMODEMASK), (u_long) stb.st_size, last); #endif + if (verbose_mode) { fprintf(stderr, "Sending file modes: %s", buf); fflush(stderr); @@ -774,7 +783,7 @@ sink(argc, argv) cursize = need; } (void) snprintf(namebuf, need, "%s%s%s", targ, - strcmp(targ, "/") ? "/" : "", cp); + *targ ? "/" : "", cp); np = namebuf; } else np = targ; @@ -921,7 +930,7 @@ screwup: } int -response(void) +response() { char ch, *cp, resp, rbuf[2048]; @@ -954,7 +963,7 @@ response(void) } void -usage(void) +usage() { (void) fprintf(stderr, "usage: scp [-pqrvBC46] [-F config] [-S ssh] [-P port] [-c cipher] [-i identity]\n" @@ -1108,7 +1117,7 @@ progressmeter(int flag) off_t cursize, abbrevsize; double elapsed; int ratio, barlength, i, remaining; - char buf[512]; + char buf[256]; if (flag == -1) { (void) gettimeofday(&start, (struct timezone *) 0); @@ -1130,18 +1139,11 @@ progressmeter(int flag) snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); barlength = getttywidth() - 51; + barlength = (barlength <= MAX_BARLENGTH)?barlength:MAX_BARLENGTH; if (barlength > 0) { i = barlength * ratio / 100; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "|%.*s%*s|", i, - "*******************************************************" - "*******************************************************" - "*******************************************************" - "*******************************************************" - "*******************************************************" - "*******************************************************" - "*******************************************************", - barlength - i, ""); + "|%.*s%*s|", i, BAR, barlength - i, ""); } i = 0; abbrevsize = cursize;