From b1daf518b5efb1a126df1c598d3255d395889e73 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 19 May 2001 13:41:18 +0000 Subject: [PATCH] Be prepared to print spaces at the end of a statistics line in case the previously printed line was longer. Avoids multiple trailing percents. git-svn-id: svn://svn.tartarus.org/sgt/putty@1135 cda61777-01e9-0310-a592-d414129be87e --- scp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scp.c b/scp.c index dcf80b2f..3e6fcf21 100644 --- a/scp.c +++ b/scp.c @@ -53,6 +53,7 @@ static int preserve = 0; static int targetshouldbedirectory = 0; static int statistics = 1; static int portnumber = 0; +static int prev_stats_len = 0; static char *password = NULL; static int errs = 0; /* GUI Adaptation - Sept 2000 */ @@ -566,6 +567,7 @@ static void print_stats(char *name, unsigned long size, unsigned long done, unsigned long eta; char etastr[10]; int pct; + int len; /* GUI Adaptation - Sept 2000 */ if (gui_mode) @@ -586,8 +588,11 @@ static void print_stats(char *name, unsigned long size, unsigned long done, pct = (int) (100.0 * (float) done / size); - printf("\r%-25.25s | %10ld kB | %5.1f kB/s | ETA: %8s | %3d%%", - name, done / 1024, ratebs / 1024.0, etastr, pct); + len = printf("\r%-25.25s | %10ld kB | %5.1f kB/s | ETA: %8s | %3d%%", + name, done / 1024, ratebs / 1024.0, etastr, pct); + if (len < prev_stats_len) + printf("%*s", prev_stats_len - len, ""); + prev_stats_len = len; if (done == size) printf("\n"); -- 2.11.0