diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-10-08 01:25:21 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-10-08 01:25:21 +0000 |
commit | 342d39e25336ee61b3baf4157de48b6898f44cf6 (patch) | |
tree | 47ae7600cad172582a4df2a59ef0d7ab5c960b4d /usr.bin/ssh/scp.c | |
parent | e8642771eb1b4ba56f2f3fc0ffc15e663c5354e8 (diff) |
Print out the progress meter for 0 length files, too; deraadt@
Diffstat (limited to 'usr.bin/ssh/scp.c')
-rw-r--r-- | usr.bin/ssh/scp.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index 7238ec69603..e39a96bd4b5 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -42,11 +42,11 @@ and ssh has the necessary privileges.) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scp.c,v 1.12 1999/10/05 12:17:05 aaron Exp $ + * $Id: scp.c,v 1.13 1999/10/08 01:25:20 aaron Exp $ */ #include "includes.h" -RCSID("$Id: scp.c,v 1.12 1999/10/05 12:17:05 aaron Exp $"); +RCSID("$Id: scp.c,v 1.13 1999/10/08 01:25:20 aaron Exp $"); #include "ssh.h" #include "xmalloc.h" @@ -976,7 +976,7 @@ run_err(const char *fmt, ...) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scp.c,v 1.12 1999/10/05 12:17:05 aaron Exp $ + * $Id: scp.c,v 1.13 1999/10/08 01:25:20 aaron Exp $ */ char * @@ -1130,12 +1130,15 @@ progressmeter(int flag) lastsize = 0; } (void)gettimeofday(&now, (struct timezone *)0); - if (totalbytes <= 0) - return; cursize = statbytes; - ratio = cursize * 100 / totalbytes; - ratio = MAX(ratio, 0); - ratio = MIN(ratio, 100); + if (totalbytes != 0) { + ratio = cursize * 100 / totalbytes; + ratio = MAX(ratio, 0); + ratio = MIN(ratio, 100); + } + else + ratio = 100; + snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio); barlength = getttywidth() - 51; |