mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Be prepared to print spaces at the end of a statistics line in case
the previously printed line was longer. Avoids multiple trailing percents. [originally from svn r1135]
This commit is contained in:
parent
b5a6c88da4
commit
78a37a5122
9
scp.c
9
scp.c
@ -53,6 +53,7 @@ static int preserve = 0;
|
|||||||
static int targetshouldbedirectory = 0;
|
static int targetshouldbedirectory = 0;
|
||||||
static int statistics = 1;
|
static int statistics = 1;
|
||||||
static int portnumber = 0;
|
static int portnumber = 0;
|
||||||
|
static int prev_stats_len = 0;
|
||||||
static char *password = NULL;
|
static char *password = NULL;
|
||||||
static int errs = 0;
|
static int errs = 0;
|
||||||
/* GUI Adaptation - Sept 2000 */
|
/* GUI Adaptation - Sept 2000 */
|
||||||
@ -566,6 +567,7 @@ static void print_stats(char *name, unsigned long size, unsigned long done,
|
|||||||
unsigned long eta;
|
unsigned long eta;
|
||||||
char etastr[10];
|
char etastr[10];
|
||||||
int pct;
|
int pct;
|
||||||
|
int len;
|
||||||
|
|
||||||
/* GUI Adaptation - Sept 2000 */
|
/* GUI Adaptation - Sept 2000 */
|
||||||
if (gui_mode)
|
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);
|
pct = (int) (100.0 * (float) done / size);
|
||||||
|
|
||||||
printf("\r%-25.25s | %10ld kB | %5.1f kB/s | ETA: %8s | %3d%%",
|
len = printf("\r%-25.25s | %10ld kB | %5.1f kB/s | ETA: %8s | %3d%%",
|
||||||
name, done / 1024, ratebs / 1024.0, etastr, pct);
|
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)
|
if (done == size)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user