diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -56,6 +56,14 @@ RCSID("$OpenBSD: scp.c,v 1.32 2000/06/20 01:39:44 markus Exp $"); | |||
56 | /* For progressmeter() -- number of seconds before xfer considered "stalled" */ | 56 | /* For progressmeter() -- number of seconds before xfer considered "stalled" */ |
57 | #define STALLTIME 5 | 57 | #define STALLTIME 5 |
58 | 58 | ||
59 | /* Progress meter bar */ | ||
60 | #define BAR \ | ||
61 | "************************************************************"\ | ||
62 | "************************************************************"\ | ||
63 | "************************************************************"\ | ||
64 | "************************************************************" | ||
65 | #define MAX_BARLENGTH (sizeof(BAR) - 1) | ||
66 | |||
59 | /* Visual statistics about files as they are transferred. */ | 67 | /* Visual statistics about files as they are transferred. */ |
60 | void progressmeter(int); | 68 | void progressmeter(int); |
61 | 69 | ||
@@ -1172,13 +1180,11 @@ progressmeter(int flag) | |||
1172 | snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); | 1180 | snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); |
1173 | 1181 | ||
1174 | barlength = getttywidth() - 51; | 1182 | barlength = getttywidth() - 51; |
1183 | barlength = (barlength <= MAX_BARLENGTH)?barlength:MAX_BARLENGTH; | ||
1175 | if (barlength > 0) { | 1184 | if (barlength > 0) { |
1176 | i = barlength * ratio / 100; | 1185 | i = barlength * ratio / 100; |
1177 | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), | 1186 | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), |
1178 | "|%.*s%*s|", i, | 1187 | "|%.*s%*s|", i, BAR, barlength - i, ""); |
1179 | "*****************************************************************************" | ||
1180 | "*****************************************************************************", | ||
1181 | barlength - i, ""); | ||
1182 | } | 1188 | } |
1183 | i = 0; | 1189 | i = 0; |
1184 | abbrevsize = cursize; | 1190 | abbrevsize = cursize; |