]> andersk Git - openssh.git/blobdiff - scp.c
- deraadt@cvs.openbsd.org 2002/05/22 23:18:25
[openssh.git] / scp.c
diff --git a/scp.c b/scp.c
index d285f9f55ff1f0e3ee2fbd355e57b77ab9d015ac..1fab48385688c1289b6c8ff473af3c699d91c11a 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.86 2001/12/05 03:56:39 itojun Exp $");
+RCSID("$OpenBSD: scp.c,v 1.88 2002/04/06 18:24:09 mouring Exp $");
 
 #include "xmalloc.h"
 #include "atomicio.h"
@@ -94,14 +94,6 @@ 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);
 
@@ -548,14 +540,13 @@ 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);
@@ -783,7 +774,7 @@ sink(argc, argv)
                                cursize = need;
                        }
                        (void) snprintf(namebuf, need, "%s%s%s", targ,
-                           *targ ? "/" : "", cp);
+                           strcmp(targ, "/") ? "/" : "", cp);
                        np = namebuf;
                } else
                        np = targ;
@@ -1117,7 +1108,7 @@ progressmeter(int flag)
        off_t cursize, abbrevsize;
        double elapsed;
        int ratio, barlength, i, remaining;
-       char buf[256];
+       char buf[512];
 
        if (flag == -1) {
                (void) gettimeofday(&start, (struct timezone *) 0);
@@ -1139,11 +1130,18 @@ 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, BAR, barlength - i, "");
+                   "|%.*s%*s|", i,
+                   "*******************************************************"
+                   "*******************************************************"
+                   "*******************************************************"
+                   "*******************************************************"
+                   "*******************************************************"
+                   "*******************************************************"
+                   "*******************************************************",
+                   barlength - i, "");
        }
        i = 0;
        abbrevsize = cursize;
This page took 0.2338 seconds and 4 git commands to generate.