Adjust progress bar to align with frugalware's progressbar
This commit is contained in:
parent
558e49698d
commit
6f5bf3fa54
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue