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 --- autoclean.sh | 4 ++-- lib/libalpm/server.c | 8 ++++---- src/pacman/download.c | 18 +++++++++--------- src/pacman/download.h | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/autoclean.sh b/autoclean.sh index 003e43b1..c73063b7 100755 --- a/autoclean.sh +++ b/autoclean.sh @@ -24,8 +24,8 @@ rm -rf doc/Makefile rm -rf doc/Makefile.in rm -rf doc/hu/Makefile rm -rf doc/hu/Makefile.in -rm -rf doc/html/* -rm -rf doc/man3/* +rm -rf doc/html/*.html +rm -rf doc/man3/*.3 rm -rf compile rm -rf libtool rm -rf mkinstalldirs diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c index a0f38c42..86271b57 100644 --- a/lib/libalpm/server.c +++ b/lib/libalpm/server.c @@ -300,11 +300,11 @@ int _alpm_downloadfiles_forreal(PMList *servers, const char *localpath, struct stat st; snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn); if(pm_dlfnm) { - strncpy(pm_dlfnm, fn, 24); + strncpy(pm_dlfnm, fn, 22); } /* drop filename extension */ ptr = strstr(fn, PM_EXT_DB); - if(pm_dlfnm && ptr && (ptr-fn) < 24) { + if(pm_dlfnm && ptr && (ptr-fn) < 22) { pm_dlfnm[ptr-fn] = '\0'; } ptr = strstr(fn, PM_EXT_PKG); @@ -312,10 +312,10 @@ int _alpm_downloadfiles_forreal(PMList *servers, const char *localpath, pm_dlfnm[ptr-fn] = '\0'; } if(pm_dlfnm) { - for(j = strlen(pm_dlfnm); j < 24; j++) { + for(j = strlen(pm_dlfnm); j < 22; j++) { (pm_dlfnm)[j] = ' '; } - pm_dlfnm[24] = '\0'; + pm_dlfnm[22] = '\0'; } if(pm_dloffset) { *pm_dloffset = 0; 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-24-g4f1b