summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/scp.c b/scp.c
index 83e7769d6..fcf55abde 100644
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
75 */ 75 */
76 76
77#include "includes.h" 77#include "includes.h"
78RCSID("$OpenBSD: scp.c,v 1.86 2001/12/05 03:56:39 itojun Exp $"); 78RCSID("$OpenBSD: scp.c,v 1.87 2002/03/30 17:45:46 deraadt Exp $");
79 79
80#include "xmalloc.h" 80#include "xmalloc.h"
81#include "atomicio.h" 81#include "atomicio.h"
@@ -94,14 +94,6 @@ char *__progname;
94/* alarm() interval for updating progress meter */ 94/* alarm() interval for updating progress meter */
95#define PROGRESSTIME 1 95#define PROGRESSTIME 1
96 96
97/* Progress meter bar */
98#define BAR \
99 "************************************************************"\
100 "************************************************************"\
101 "************************************************************"\
102 "************************************************************"
103#define MAX_BARLENGTH (sizeof(BAR) - 1)
104
105/* Visual statistics about files as they are transferred. */ 97/* Visual statistics about files as they are transferred. */
106void progressmeter(int); 98void progressmeter(int);
107 99
@@ -1116,7 +1108,7 @@ progressmeter(int flag)
1116 off_t cursize, abbrevsize; 1108 off_t cursize, abbrevsize;
1117 double elapsed; 1109 double elapsed;
1118 int ratio, barlength, i, remaining; 1110 int ratio, barlength, i, remaining;
1119 char buf[256]; 1111 char buf[512];
1120 1112
1121 if (flag == -1) { 1113 if (flag == -1) {
1122 (void) gettimeofday(&start, (struct timezone *) 0); 1114 (void) gettimeofday(&start, (struct timezone *) 0);
@@ -1138,11 +1130,18 @@ progressmeter(int flag)
1138 snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); 1130 snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio);
1139 1131
1140 barlength = getttywidth() - 51; 1132 barlength = getttywidth() - 51;
1141 barlength = (barlength <= MAX_BARLENGTH)?barlength:MAX_BARLENGTH;
1142 if (barlength > 0) { 1133 if (barlength > 0) {
1143 i = barlength * ratio / 100; 1134 i = barlength * ratio / 100;
1144 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), 1135 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
1145 "|%.*s%*s|", i, BAR, barlength - i, ""); 1136 "|%.*s%*s|", i,
1137 "*******************************************************"
1138 "*******************************************************"
1139 "*******************************************************"
1140 "*******************************************************"
1141 "*******************************************************"
1142 "*******************************************************"
1143 "*******************************************************",
1144 barlength - i, "");
1146 } 1145 }
1147 i = 0; 1146 i = 0;
1148 abbrevsize = cursize; 1147 abbrevsize = cursize;