diff options
Diffstat (limited to 'src/pacsync.c')
-rw-r--r-- | src/pacsync.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/pacsync.c b/src/pacsync.c index bb1ad2ac..2b6e5b05 100644 --- a/src/pacsync.c +++ b/src/pacsync.c @@ -28,12 +28,12 @@ #include <sys/time.h> #include <ftplib.h> /* pacman */ +#include "pacconf.h" #include "list.h" #include "package.h" #include "db.h" #include "util.h" #include "pacsync.h" -#include "pacman.h" /* progress bar */ static int log_progress(netbuf *ctl, int xfered, void *arg); @@ -52,6 +52,7 @@ extern char *pmo_xfercommand; extern unsigned short pmo_proxyport; extern unsigned short pmo_nopassiveftp; +extern unsigned short pmo_chomp; /* sync servers */ extern PMList *pmc_syncs; @@ -205,7 +206,7 @@ int downloadfiles_forreal(PMList *servers, const char *localpath, char *host; unsigned port; host = (pmo_proxyhost) ? pmo_proxyhost : server->server; - port = (pmo_proxyhost) ? pmo_proxyport : 80; + port = (pmo_proxyport) ? pmo_proxyport : 80; if(strchr(host, ':')) { vprint("connecting to %s\n", host); } else { @@ -306,7 +307,7 @@ int downloadfiles_forreal(PMList *servers, const char *localpath, if(ptr && (ptr-fn) < 24) { sync_fnm[ptr-fn] = '\0'; } - ptr = strstr(fn, ".pkg.tar.gz"); + ptr = strstr(fn, PKGEXT); if(ptr && (ptr-fn) < 24) { sync_fnm[ptr-fn] = '\0'; } @@ -469,6 +470,11 @@ static int log_progress(netbuf *ctl, int xfered, void *arg) int i, cur; struct timeval t1; float timediff; + /* a little hard to conceal easter eggs in open-source software, but + * they're still fun. ;) + */ + static unsigned short mouth; + static unsigned int lastcur = 0; gettimeofday(&t1, NULL); if(xfered+offset == fsz) { @@ -501,13 +507,39 @@ static int log_progress(netbuf *ctl, int xfered, void *arg) printf(" %s [", sync_fnm); cur = (int)((maxcols-64)*pct/100); for(i = 0; i < maxcols-64; i++) { - (i < cur) ? printf("#") : printf(" "); + if(pmo_chomp) { + if(i < cur) { + printf("-"); + } else { + if(i == cur) { + if(lastcur == cur) { + if(mouth) { + printf("\033[1;33mC\033[m"); + } else { + printf("\033[1;33mc\033[m"); + } + } else { + mouth = mouth == 1 ? 0 : 1; + if(mouth) { + printf("\033[1;33mC\033[m"); + } else { + printf("\033[1;33mc\033[m"); + } + } + } else { + printf("\033[0;37m*\033[m"); + } + } + } else { + (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); } + lastcur = cur; fflush(stdout); return(1); } |