index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Xavier Chantry <shiningxc@gmail.com> | 2009-12-16 02:38:32 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-03-14 18:39:43 -0500 |
commit | e4be3e06af7f96c279851c3f2d7f1d294b8b8e70 (patch) | |
tree | 57f094709d2a48a409015d9a29d4fb09c4451e0a | |
parent | e5dce888c09976f1ef4664613c742d0d015e534e (diff) |
-rw-r--r-- | src/pacman/callback.c | 19 |
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index aa1d2633..d2d94d9b 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -320,7 +320,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, float timediff; /* size of line to allocate for text printing (e.g. not progressbar) */ - const int infolen = 50; + int infolen; int tmp, digits, textlen; char *opr = NULL; /* used for wide character width determination and printing */ @@ -331,6 +331,11 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, return; } + infolen = getcols() * 6 / 10; + if (infolen < 50) { + infolen = 50; + } + if(percent == 0) { timediff = get_update_timediff(1); } else { @@ -449,9 +454,8 @@ void cb_dl_total(off_t total) /* callback to handle display of download progress */ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) { - const int infolen = 50; - /* explanation of magic 28 number at the end */ - const int filenamelen = infolen - 28; + int infolen; + int filenamelen; char *fname, *p; /* used for wide character width determination and printing */ int len, wclen, wcwid, padwid; @@ -472,6 +476,13 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) return; } + infolen = getcols() * 6 / 10; + if (infolen < 50) { + infolen = 50; + } + /* explanation of magic 28 number at the end */ + filenamelen = infolen - 28; + /* only use TotalDownload if enabled and we have a callback value */ if(config->totaldownload && list_total) { /* sanity check */ |