From be38a51750705bba67daa430955d2332870c38a1 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Sat, 28 Jan 2006 05:07:50 +0000 Subject: added a --noprogressbar switch for scripts to use --- src/pacman/conf.h | 1 + src/pacman/download.c | 4 ++++ src/pacman/pacman.c | 3 +++ 3 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/pacman/conf.h b/src/pacman/conf.h index 549da7e0..fdd4b20a 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -33,6 +33,7 @@ typedef struct __config_t { unsigned short help; unsigned short upgrade; unsigned short noconfirm; + unsigned short noprogressbar; unsigned short op_d_vertest; unsigned short op_d_resolve; unsigned short op_q_isfile; diff --git a/src/pacman/download.c b/src/pacman/download.c index ad19f4d4..ce595495 100644 --- a/src/pacman/download.c +++ b/src/pacman/download.c @@ -64,6 +64,10 @@ static int log_progress(netbuf *ctl, int xfered, void *arg) static unsigned short mouth; static unsigned int lastcur = 0; + if(config->noprogressbar) { + return(1); + } + gettimeofday(&t1, NULL); if(xfered+offset == fsz) { t = t0; diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index ea3babe3..715b3244 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -300,6 +300,7 @@ int parseargs(int argc, char *argv[]) {"config", required_argument, 0, 1001}, {"ignore", required_argument, 0, 1002}, {"debug", required_argument, 0, 1003}, + {"noprogressbar", no_argument, 0, 1004}, {0, 0, 0, 0} }; char root[PATH_MAX]; @@ -319,6 +320,7 @@ int parseargs(int argc, char *argv[]) break; case 1002: config->op_s_ignore = list_add(config->op_s_ignore, strdup(optarg)); break; case 1003: config->debug = atoi(optarg); break; + case 1004: config->noprogressbar = 1; break; case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break; case 'D': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_DEPTEST); @@ -482,6 +484,7 @@ void usage(int op, char *myname) } printf(" --config set an alternate configuration file\n"); printf(" --noconfirm do not ask for anything confirmation\n"); + printf(" --noprogressbar do not show a progress bar when downloading files\n"); printf(" -v, --verbose be verbose\n"); printf(" -r, --root set an alternate installation root\n"); printf(" -b, --dbpath set an alternate database location\n"); -- cgit v1.2.3-70-g09d2