summaryrefslogtreecommitdiffstats
path: root/src/pacman/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-04-26 02:02:07 +0200
committerDan McGee <dan@archlinux.org>2007-04-26 20:34:41 +0200
commitdc05cd107cd158e3d8ee9256205aec20615a674f (patch)
treefec60599b46af26d51c0b08acd6afed2c0c0fc03 /src/pacman/util.c
parent97313ba31645796148c3f413d9ebde365df06dbe (diff)
downloadpacman-dc05cd107cd158e3d8ee9256205aec20615a674f.tar.gz
pacman-dc05cd107cd158e3d8ee9256205aec20615a674f.tar.xz
Pacman side code consolidation- unify callback functions to one file
Some more major code reorginization here. The download progress callback function has been renamed and moved to callback.c, which is the former trans.c with the download and log callbacks added. In addition, this allows util.c to be cleaned up as fill_progress can now be static in callback.c. We've also cut two more source files out. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r--src/pacman/util.c67
1 files changed, 0 insertions, 67 deletions
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: */