diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2021-10-24 13:08:28 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2022-01-02 20:57:42 +1000 |
commit | 446972b404bcba0d79656d42b58cd95b3712081e (patch) | |
tree | ff12f0d3650241e09171626f55eae0f940951b47 /src | |
parent | e654aa8ac60ba462bb0b1962f3383e098549501b (diff) |
pacman: simplify chomp mouth logic
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/callback.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 4982e721..a06f3bcc 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -156,13 +156,8 @@ static void fill_progress(const int bar_percent, const int disp_percent, /* 8 = 1 space + 1 [ + 1 ] + 5 for percent */ const int hashlen = proglen > 8 ? proglen - 8 : 0; const int hash = bar_percent * hashlen / 100; - static int lasthash = 0; int i; - if(bar_percent == 0) { - lasthash = 0; - } - if(hashlen > 0) { fputs(" [", stdout); for(i = hashlen; i > 0; --i) { @@ -171,19 +166,10 @@ static void fill_progress(const int bar_percent, const int disp_percent, if(i > hashlen - hash) { putchar('-'); } else if(i == hashlen - hash) { - if(lasthash == hash) { - if(i % 2 == 0) { - fputs("\033[1;33mC\033[m", stdout); - } else { - fputs("\033[1;33mc\033[m", stdout); - } + if(i % 2 == 0) { + fputs("\033[1;33mC\033[m", stdout); } else { - lasthash = hash; - if(i % 2 == 0) { - fputs("\033[1;33mC\033[m", stdout); - } else { - fputs("\033[1;33mc\033[m", stdout); - } + fputs("\033[1;33mc\033[m", stdout); } } else if(i % 3 == 0) { fputs("\033[0;37mo\033[m", stdout); |