1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-16 14:25:21 -05:00

Adjust progress bar to align with frugalware's progressbar

This commit is contained in:
Aaron Griffin 2006-10-16 04:32:15 +00:00
parent 558e49698d
commit 6f5bf3fa54
4 changed files with 16 additions and 16 deletions

View File

@ -24,8 +24,8 @@ rm -rf doc/Makefile
rm -rf doc/Makefile.in rm -rf doc/Makefile.in
rm -rf doc/hu/Makefile rm -rf doc/hu/Makefile
rm -rf doc/hu/Makefile.in rm -rf doc/hu/Makefile.in
rm -rf doc/html/* rm -rf doc/html/*.html
rm -rf doc/man3/* rm -rf doc/man3/*.3
rm -rf compile rm -rf compile
rm -rf libtool rm -rf libtool
rm -rf mkinstalldirs rm -rf mkinstalldirs

View File

@ -300,11 +300,11 @@ int _alpm_downloadfiles_forreal(PMList *servers, const char *localpath,
struct stat st; struct stat st;
snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn); snprintf(output, PATH_MAX, "%s/%s.part", localpath, fn);
if(pm_dlfnm) { if(pm_dlfnm) {
strncpy(pm_dlfnm, fn, 24); strncpy(pm_dlfnm, fn, 22);
} }
/* drop filename extension */ /* drop filename extension */
ptr = strstr(fn, PM_EXT_DB); 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'; pm_dlfnm[ptr-fn] = '\0';
} }
ptr = strstr(fn, PM_EXT_PKG); ptr = strstr(fn, PM_EXT_PKG);
@ -312,10 +312,10 @@ int _alpm_downloadfiles_forreal(PMList *servers, const char *localpath,
pm_dlfnm[ptr-fn] = '\0'; pm_dlfnm[ptr-fn] = '\0';
} }
if(pm_dlfnm) { if(pm_dlfnm) {
for(j = strlen(pm_dlfnm); j < 24; j++) { for(j = strlen(pm_dlfnm); j < 22; j++) {
(pm_dlfnm)[j] = ' '; (pm_dlfnm)[j] = ' ';
} }
pm_dlfnm[24] = '\0'; pm_dlfnm[22] = '\0';
} }
if(pm_dloffset) { if(pm_dloffset) {
*pm_dloffset = 0; *pm_dloffset = 0;

View File

@ -40,7 +40,7 @@
#include "conf.h" #include "conf.h"
/* progress bar */ /* progress bar */
char sync_fnm[25]; char sync_fnm[23];
int offset; int offset;
struct timeval t0, t; struct timeval t0, t;
float rate; float rate;
@ -104,9 +104,13 @@ int log_progress(netbuf *ctl, int xfered, void *arg)
eta_s -= eta_m * 60; eta_s -= eta_m * 60;
} }
printf(" %s [", sync_fnm); if(rate > 1000) {
cur = (int)((maxcols-64)*pct/100); printf("%s %6dK %6.0fK/s %02d:%02d:%02d [", sync_fnm, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s);
for(i = 0; i < maxcols-64; i++) { } 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(chomp) {
if(i < cur) { if(i < cur) {
printf("-"); printf("-");
@ -134,11 +138,7 @@ int log_progress(netbuf *ctl, int xfered, void *arg)
(i < cur) ? printf("#") : printf(" "); (i < cur) ? printf("#") : printf(" ");
} }
} }
if(rate > 1000) { printf("] %3d%%\r", pct);
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);
}
if(lastpct != 100 && pct == 100) { if(lastpct != 100 && pct == 100) {
printf("\n"); printf("\n");
} }

View File

@ -21,7 +21,7 @@
#ifndef _PM_DOWNLOAD_H #ifndef _PM_DOWNLOAD_H
#define _PM_DOWNLOAD_H #define _PM_DOWNLOAD_H
extern char sync_fnm[25]; extern char sync_fnm[23];
extern int offset; extern int offset;
extern struct timeval t0, t; extern struct timeval t0, t;
extern float rate; extern float rate;