- added pmo_chomp support (from pacman 2.9.3)
- fixed a typo with pmo_proxyport usage
This commit is contained in:
parent
4744a2a764
commit
950839b557
3 changed files with 38 additions and 2 deletions
|
@ -39,6 +39,7 @@ extern list_t *pmo_holdpkg;
|
||||||
extern char *pmo_proxyhost;
|
extern char *pmo_proxyhost;
|
||||||
extern unsigned short pmo_proxyport;
|
extern unsigned short pmo_proxyport;
|
||||||
extern char *pmo_xfercommand;
|
extern char *pmo_xfercommand;
|
||||||
|
extern unsigned short pmo_chomp;
|
||||||
extern unsigned short pmo_nopassiveftp;
|
extern unsigned short pmo_nopassiveftp;
|
||||||
|
|
||||||
extern list_t *pmc_syncs;
|
extern list_t *pmc_syncs;
|
||||||
|
@ -126,6 +127,8 @@ int parseconfig(char *file)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
vprint("config: usesyslog\n");
|
vprint("config: usesyslog\n");
|
||||||
|
} else if(!strcmp(key, "ILOVECANDY")) {
|
||||||
|
pmo_chomp = 1;
|
||||||
} else {
|
} else {
|
||||||
ERR(NL, "config: line %d: syntax error\n", linenum);
|
ERR(NL, "config: line %d: syntax error\n", linenum);
|
||||||
return(1);
|
return(1);
|
||||||
|
|
|
@ -50,6 +50,7 @@ extern char *pmo_xfercommand;
|
||||||
|
|
||||||
extern unsigned short pmo_proxyport;
|
extern unsigned short pmo_proxyport;
|
||||||
extern unsigned short pmo_nopassiveftp;
|
extern unsigned short pmo_nopassiveftp;
|
||||||
|
extern unsigned short pmo_chomp;
|
||||||
|
|
||||||
extern int maxcols;
|
extern int maxcols;
|
||||||
|
|
||||||
|
@ -60,6 +61,11 @@ static int log_progress(netbuf *ctl, int xfered, void *arg)
|
||||||
int i, cur;
|
int i, cur;
|
||||||
struct timeval t1;
|
struct timeval t1;
|
||||||
float timediff;
|
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);
|
gettimeofday(&t1, NULL);
|
||||||
if(xfered+offset == fsz) {
|
if(xfered+offset == fsz) {
|
||||||
|
@ -92,13 +98,39 @@ static int log_progress(netbuf *ctl, int xfered, void *arg)
|
||||||
printf(" %s [", sync_fnm);
|
printf(" %s [", sync_fnm);
|
||||||
cur = (int)((maxcols-64)*pct/100);
|
cur = (int)((maxcols-64)*pct/100);
|
||||||
for(i = 0; i < maxcols-64; i++) {
|
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) {
|
if(rate > 1000) {
|
||||||
printf("] %3d%% %6dK %6.0fK/s %02d:%02d:%02d\r", pct, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s);
|
printf("] %3d%% %6dK %6.0fK/s %02d:%02d:%02d\r", pct, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s);
|
||||||
} else {
|
} else {
|
||||||
printf("] %3d%% %6dK %6.1fK/s %02d:%02d:%02d\r", pct, ((xfered+offset) / 1024), rate, eta_h, eta_m, eta_s);
|
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);
|
fflush(stdout);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +234,7 @@ int downloadfiles_forreal(list_t *servers, const char *localpath,
|
||||||
char *host;
|
char *host;
|
||||||
unsigned port;
|
unsigned port;
|
||||||
host = (pmo_proxyhost) ? pmo_proxyhost : server->server;
|
host = (pmo_proxyhost) ? pmo_proxyhost : server->server;
|
||||||
port = (pmo_proxyhost) ? pmo_proxyport : 80;
|
port = (pmo_proxyport) ? pmo_proxyport : 80;
|
||||||
if(strchr(host, ':')) {
|
if(strchr(host, ':')) {
|
||||||
vprint("connecting to %s\n", host);
|
vprint("connecting to %s\n", host);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -73,6 +73,7 @@ list_t *pmo_holdpkg = NULL;
|
||||||
char *pmo_proxyhost = NULL;
|
char *pmo_proxyhost = NULL;
|
||||||
unsigned short pmo_proxyport = 0;
|
unsigned short pmo_proxyport = 0;
|
||||||
char *pmo_xfercommand = NULL;
|
char *pmo_xfercommand = NULL;
|
||||||
|
unsigned short pmo_chomp = 0;
|
||||||
unsigned short pmo_nopassiveftp = 0;
|
unsigned short pmo_nopassiveftp = 0;
|
||||||
|
|
||||||
PM_DB *db_local;
|
PM_DB *db_local;
|
||||||
|
|
Loading…
Add table
Reference in a new issue