diff options
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | scp.c | 65 |
2 files changed, 47 insertions, 35 deletions
@@ -20,17 +20,17 @@ | |||
20 | [auth-krb5.c auth1.c hostfile.h monitor_wrap.c sftp-client.c sftp-int.c ssh-add.c ssh-rsa.c | 20 | [auth-krb5.c auth1.c hostfile.h monitor_wrap.c sftp-client.c sftp-int.c ssh-add.c ssh-rsa.c |
21 | sshconnect.c] | 21 | sshconnect.c] |
22 | KNF | 22 | KNF |
23 | - markus@cvs.openbsd.org 2002/11/21 23:04:33 | 23 | - markus@cvs.openbsd.org 2002/11/21 23:04:33 |
24 | [ssh.c] | 24 | [ssh.c] |
25 | debug->debug2 | 25 | debug->debug2 |
26 | - stevesk@cvs.openbsd.org 2002/11/24 21:46:24 | 26 | - stevesk@cvs.openbsd.org 2002/11/24 21:46:24 |
27 | [ssh-keysign.8] | 27 | [ssh-keysign.8] |
28 | typo: "the the" | 28 | typo: "the the" |
29 | - wcobb@cvs.openbsd.org 2002/11/26 00:45:03 | 29 | - wcobb@cvs.openbsd.org 2002/11/26 00:45:03 |
30 | [scp.c ssh-keygen.c] | 30 | [scp.c ssh-keygen.c] |
31 | Remove unnecessary fflush(stderr) calls, stderr is unbuffered by default. | 31 | Remove unnecessary fflush(stderr) calls, stderr is unbuffered by default. |
32 | ok markus@ | 32 | ok markus@ |
33 | - stevesk@cvs.openbsd.org 2002/11/26 02:35:30 | 33 | - stevesk@cvs.openbsd.org 2002/11/26 02:35:30 |
34 | [ssh-keygen.1] | 34 | [ssh-keygen.1] |
35 | remove outdated statement; ok markus@ deraadt@ | 35 | remove outdated statement; ok markus@ deraadt@ |
36 | - stevesk@cvs.openbsd.org 2002/11/26 02:38:54 | 36 | - stevesk@cvs.openbsd.org 2002/11/26 02:38:54 |
@@ -48,7 +48,7 @@ | |||
48 | [scp.c] | 48 | [scp.c] |
49 | use roundup() similar to rcp/util.c and avoid problems with strange | 49 | use roundup() similar to rcp/util.c and avoid problems with strange |
50 | filesystem block sizes, noted by tjr@freebsd.org; ok djm@ | 50 | filesystem block sizes, noted by tjr@freebsd.org; ok djm@ |
51 | - djm@cvs.openbsd.org 2002/12/06 05:20:02 | 51 | - djm@cvs.openbsd.org 2002/12/06 05:20:02 |
52 | [sftp.1] | 52 | [sftp.1] |
53 | Fix cut'n'paste error, spotted by matthias.riese@b-novative.de; ok deraadt@ | 53 | Fix cut'n'paste error, spotted by matthias.riese@b-novative.de; ok deraadt@ |
54 | - millert@cvs.openbsd.org 2002/12/09 16:50:30 | 54 | - millert@cvs.openbsd.org 2002/12/09 16:50:30 |
@@ -68,6 +68,13 @@ | |||
68 | - markus@cvs.openbsd.org 2002/12/13 10:03:15 | 68 | - markus@cvs.openbsd.org 2002/12/13 10:03:15 |
69 | [channels.c misc.c sshconnect2.c] | 69 | [channels.c misc.c sshconnect2.c] |
70 | cleanup debug messages, more useful information for the client user. | 70 | cleanup debug messages, more useful information for the client user. |
71 | - markus@cvs.openbsd.org 2002/12/13 15:20:52 | ||
72 | [scp.c] | ||
73 | 1) include stalling time in total time | ||
74 | 2) truncate filenames to 45 instead of 20 characters | ||
75 | 3) print rate instead of progress bar, no more stars | ||
76 | 4) scale output to tty width | ||
77 | based on a patch from Niels; ok fries@ lebel@ fgs@ millert@ | ||
71 | 78 | ||
72 | 20021205 | 79 | 20021205 |
73 | - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org | 80 | - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org |
@@ -903,4 +910,4 @@ | |||
903 | save auth method before monitor_reset_key_state(); bugzilla bug #284; | 910 | save auth method before monitor_reset_key_state(); bugzilla bug #284; |
904 | ok provos@ | 911 | ok provos@ |
905 | 912 | ||
906 | $Id: ChangeLog,v 1.2534 2002/12/23 02:44:36 mouring Exp $ | 913 | $Id: ChangeLog,v 1.2535 2002/12/23 02:53:08 mouring Exp $ |
@@ -75,7 +75,7 @@ | |||
75 | */ | 75 | */ |
76 | 76 | ||
77 | #include "includes.h" | 77 | #include "includes.h" |
78 | RCSID("$OpenBSD: scp.c,v 1.95 2002/12/05 11:08:35 markus Exp $"); | 78 | RCSID("$OpenBSD: scp.c,v 1.96 2002/12/13 15:20:52 markus Exp $"); |
79 | 79 | ||
80 | #include "xmalloc.h" | 80 | #include "xmalloc.h" |
81 | #include "atomicio.h" | 81 | #include "atomicio.h" |
@@ -1119,13 +1119,19 @@ foregroundproc(void) | |||
1119 | void | 1119 | void |
1120 | progressmeter(int flag) | 1120 | progressmeter(int flag) |
1121 | { | 1121 | { |
1122 | static const char spaces[] = " " | ||
1123 | " " | ||
1124 | " " | ||
1125 | " " | ||
1126 | " " | ||
1127 | " "; | ||
1122 | static const char prefixes[] = " KMGTP"; | 1128 | static const char prefixes[] = " KMGTP"; |
1123 | static struct timeval lastupdate; | 1129 | static struct timeval lastupdate; |
1124 | static off_t lastsize; | 1130 | static off_t lastsize; |
1125 | struct timeval now, td, wait; | 1131 | struct timeval now, td, wait; |
1126 | off_t cursize, abbrevsize; | 1132 | off_t cursize, abbrevsize, bytespersec; |
1127 | double elapsed; | 1133 | double elapsed; |
1128 | int ratio, barlength, i, remaining; | 1134 | int ratio, remaining, i, ai, bi, nspaces; |
1129 | char buf[512]; | 1135 | char buf[512]; |
1130 | 1136 | ||
1131 | if (flag == -1) { | 1137 | if (flag == -1) { |
@@ -1145,45 +1151,44 @@ progressmeter(int flag) | |||
1145 | } else | 1151 | } else |
1146 | ratio = 100; | 1152 | ratio = 100; |
1147 | 1153 | ||
1148 | snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); | ||
1149 | |||
1150 | barlength = getttywidth() - 51; | ||
1151 | if (barlength > 0) { | ||
1152 | i = barlength * ratio / 100; | ||
1153 | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), | ||
1154 | "|%.*s%*s|", i, | ||
1155 | "*******************************************************" | ||
1156 | "*******************************************************" | ||
1157 | "*******************************************************" | ||
1158 | "*******************************************************" | ||
1159 | "*******************************************************" | ||
1160 | "*******************************************************" | ||
1161 | "*******************************************************", | ||
1162 | barlength - i, ""); | ||
1163 | } | ||
1164 | i = 0; | ||
1165 | abbrevsize = cursize; | 1154 | abbrevsize = cursize; |
1166 | while (abbrevsize >= 100000 && i < sizeof(prefixes)) { | 1155 | for (ai = 0; abbrevsize >= 10000 && ai < sizeof(prefixes); ai++) |
1167 | i++; | ||
1168 | abbrevsize >>= 10; | 1156 | abbrevsize >>= 10; |
1169 | } | ||
1170 | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %5lu %c%c ", | ||
1171 | (unsigned long) abbrevsize, prefixes[i], | ||
1172 | prefixes[i] == ' ' ? ' ' : 'B'); | ||
1173 | 1157 | ||
1174 | timersub(&now, &lastupdate, &wait); | 1158 | timersub(&now, &lastupdate, &wait); |
1175 | if (cursize > lastsize) { | 1159 | if (cursize > lastsize) { |
1176 | lastupdate = now; | 1160 | lastupdate = now; |
1177 | lastsize = cursize; | 1161 | lastsize = cursize; |
1178 | if (wait.tv_sec >= STALLTIME) { | ||
1179 | start.tv_sec += wait.tv_sec; | ||
1180 | start.tv_usec += wait.tv_usec; | ||
1181 | } | ||
1182 | wait.tv_sec = 0; | 1162 | wait.tv_sec = 0; |
1183 | } | 1163 | } |
1184 | timersub(&now, &start, &td); | 1164 | timersub(&now, &start, &td); |
1185 | elapsed = td.tv_sec + (td.tv_usec / 1000000.0); | 1165 | elapsed = td.tv_sec + (td.tv_usec / 1000000.0); |
1186 | 1166 | ||
1167 | bytespersec = 0; | ||
1168 | if (statbytes > 0) { | ||
1169 | bytespersec = statbytes; | ||
1170 | if (elapsed > 0.0) | ||
1171 | bytespersec /= elapsed; | ||
1172 | } | ||
1173 | for (bi = 1; bytespersec >= 1024000 && bi < sizeof(prefixes); bi++) | ||
1174 | bytespersec >>= 10; | ||
1175 | |||
1176 | nspaces = MIN(getttywidth() - 79, sizeof(spaces) - 1); | ||
1177 | |||
1178 | snprintf(buf, sizeof(buf), | ||
1179 | "\r%-45.45s%.*s%3d%% %4lld%c%c %3lld.%01d%cB/s", | ||
1180 | curfile, | ||
1181 | nspaces, | ||
1182 | spaces, | ||
1183 | ratio, | ||
1184 | (long long)abbrevsize, | ||
1185 | prefixes[ai], | ||
1186 | ai == 0 ? ' ' : 'B', | ||
1187 | (long long)(bytespersec / 1024), | ||
1188 | (int)((bytespersec % 1024) * 10 / 1024), | ||
1189 | prefixes[bi] | ||
1190 | ); | ||
1191 | |||
1187 | if (flag != 1 && | 1192 | if (flag != 1 && |
1188 | (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes)) { | 1193 | (statbytes <= 0 || elapsed <= 0.0 || cursize > totalbytes)) { |
1189 | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), | 1194 | snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), |