index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-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: */ |