From 6f5bf3fa545c0e236f425c5a77c4fe1a5ea9a454 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Mon, 16 Oct 2006 04:32:15 +0000 Subject: Adjust progress bar to align with frugalware's progressbar --- src/pacman/download.c | 18 +++++++++--------- src/pacman/download.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/pacman/download.c b/src/pacman/download.c index 63d2ccbf..2be6e242 100644 --- a/src/pacman/download.c +++ b/src/pacman/download.c @@ -40,7 +40,7 @@ #include "conf.h" /* progress bar */ -char sync_fnm[25]; +char sync_fnm[23]; int offset; struct timeval t0, t; float rate; @@ -104,9 +104,13 @@ int log_progress(netbuf *ctl, int xfered, void *arg) eta_s -= eta_m * 60; } - printf(" %s [", sync_fnm); - cur = (int)((maxcols-64)*pct/100); - for(i = 0; i < maxcols-64; i++) { + if(rate > 1000) { + printf("%s %6dK %6.0fK/s %02d:%02d:%02d [", sync_fnm, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s); + } else { + printf("%s %6dK %6.1fK/s %02d:%02d:%02d [", sync_fnm, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s); + } + cur = (int)((maxcols-57)*pct/100); + for(i = 0; i < maxcols-57; i++) { if(chomp) { if(i < cur) { printf("-"); @@ -134,11 +138,7 @@ int log_progress(netbuf *ctl, int xfered, void *arg) (i < cur) ? printf("#") : printf(" "); } } - if(rate > 1000) { - printf("] %3d%% %6dK %6.0fK/s %02d:%02d:%02d\r", pct, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s); - } else { - printf("] %3d%% %6dK %6.1fK/s %02d:%02d:%02d\r", pct, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s); - } + printf("] %3d%%\r", pct); if(lastpct != 100 && pct == 100) { printf("\n"); } diff --git a/src/pacman/download.h b/src/pacman/download.h index 45afa647..a3ff45c2 100644 --- a/src/pacman/download.h +++ b/src/pacman/download.h @@ -21,7 +21,7 @@ #ifndef _PM_DOWNLOAD_H #define _PM_DOWNLOAD_H -extern char sync_fnm[25]; +extern char sync_fnm[23]; extern int offset; extern struct timeval t0, t; extern float rate; -- cgit v1.2.3-54-g00ecf