index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2007-04-25 20:02:07 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-04-26 14:34:41 -0400 |
commit | dc05cd107cd158e3d8ee9256205aec20615a674f (patch) | |
tree | fec60599b46af26d51c0b08acd6afed2c0c0fc03 /src/pacman/util.c | |
parent | 97313ba31645796148c3f413d9ebde365df06dbe (diff) |
-rw-r--r-- | src/pacman/util.c | 67 |
diff --git a/src/pacman/util.c b/src/pacman/util.c index a7259e25..376582a7 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -369,71 +369,4 @@ float get_update_timediff(int first_call) return(retval); } -/* refactored from cb_trans_progress */ -void fill_progress(const int percent, const int proglen) -{ - const unsigned short chomp = alpm_option_get_chomp(); - const unsigned int hashlen = proglen - 8; - const unsigned int hash = percent * hashlen / 100; - static unsigned int lasthash = 0, mouth = 0; - unsigned int i; - - /* printf("\ndebug: proglen: %i\n", proglen); DEBUG*/ - - if(percent == 0) { - lasthash = 0; - mouth = 0; - } - - /* magic numbers, how I loathe thee */ - if(proglen > 8) { - printf(" ["); - for(i = hashlen; i > 1; --i) { - /* if special progress bar enabled */ - if(chomp) { - if(i > hashlen - hash) { - printf("-"); - } else if(i == hashlen - hash) { - if(lasthash == hash) { - if(mouth) { - printf("\033[1;33mC\033[m"); - } else { - printf("\033[1;33mc\033[m"); - } - } else { - lasthash = hash; - mouth = mouth == 1 ? 0 : 1; - if(mouth) { - printf("\033[1;33mC\033[m"); - } else { - printf("\033[1;33mc\033[m"); - } - } - } else if(i%3 == 0) { - printf("\033[0;37mo\033[m"); - } else { - printf("\033[0;37m \033[m"); - } - } /* else regular progress bar */ - else if(i > hashlen - hash) { - printf("#"); - } else { - printf("-"); - } - } - printf("]"); - } - /* print percent after progress bar */ - if(proglen > 5) { - printf(" %3d%%", percent); - } - - if(percent == 100) { - printf("\n"); - } else { - printf("\r"); - } - fflush(stdout); -} - /* vim: set ts=2 sw=2 noet: */ |