]> andersk Git - openssh.git/blobdiff - scp.c
- (djm) Add --with-superuser-path=xxx configure option to specify what $PATH
[openssh.git] / scp.c
diff --git a/scp.c b/scp.c
index b5cb541b4feab46b0730a892986aa53d261aff39..1fab48385688c1289b6c8ff473af3c699d91c11a 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.85 2001/10/01 08:06:28 markus 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;
@@ -930,7 +921,7 @@ screwup:
 }
 
 int
-response()
+response(void)
 {
        char ch, *cp, resp, rbuf[2048];
 
@@ -963,7 +954,7 @@ response()
 }
 
 void
-usage()
+usage(void)
 {
        (void) fprintf(stderr,
            "usage: scp [-pqrvBC46] [-F config] [-S ssh] [-P port] [-c cipher] [-i identity]\n"
@@ -1040,7 +1031,7 @@ allocbuf(bp, fd, blksize)
        int fd, blksize;
 {
        size_t size;
-#ifdef HAVE_ST_BLKSIZE
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
        struct stat stb;
 
        if (fstat(fd, &stb) < 0) {
@@ -1052,9 +1043,9 @@ allocbuf(bp, fd, blksize)
        else
                size = blksize + (stb.st_blksize - blksize % stb.st_blksize) %
                    stb.st_blksize;
-#else /* HAVE_ST_BLKSIZE */
+#else /* HAVE_STRUCT_STAT_ST_BLKSIZE */
        size = blksize;
-#endif /* HAVE_ST_BLKSIZE */
+#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
        if (bp->cnt >= size)
                return (bp);
        if (bp->buf == NULL)
@@ -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.134538 seconds and 4 git commands to generate.