pacman: simplify chomp mouth logic
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
e654aa8ac6
commit
446972b404
1 changed files with 3 additions and 17 deletions
|
@ -156,13 +156,8 @@ static void fill_progress(const int bar_percent, const int disp_percent,
|
||||||
/* 8 = 1 space + 1 [ + 1 ] + 5 for percent */
|
/* 8 = 1 space + 1 [ + 1 ] + 5 for percent */
|
||||||
const int hashlen = proglen > 8 ? proglen - 8 : 0;
|
const int hashlen = proglen > 8 ? proglen - 8 : 0;
|
||||||
const int hash = bar_percent * hashlen / 100;
|
const int hash = bar_percent * hashlen / 100;
|
||||||
static int lasthash = 0;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(bar_percent == 0) {
|
|
||||||
lasthash = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hashlen > 0) {
|
if(hashlen > 0) {
|
||||||
fputs(" [", stdout);
|
fputs(" [", stdout);
|
||||||
for(i = hashlen; i > 0; --i) {
|
for(i = hashlen; i > 0; --i) {
|
||||||
|
@ -171,20 +166,11 @@ static void fill_progress(const int bar_percent, const int disp_percent,
|
||||||
if(i > hashlen - hash) {
|
if(i > hashlen - hash) {
|
||||||
putchar('-');
|
putchar('-');
|
||||||
} else if(i == hashlen - hash) {
|
} else if(i == hashlen - hash) {
|
||||||
if(lasthash == hash) {
|
|
||||||
if(i % 2 == 0) {
|
if(i % 2 == 0) {
|
||||||
fputs("\033[1;33mC\033[m", stdout);
|
fputs("\033[1;33mC\033[m", stdout);
|
||||||
} else {
|
} else {
|
||||||
fputs("\033[1;33mc\033[m", stdout);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(i % 3 == 0) {
|
} else if(i % 3 == 0) {
|
||||||
fputs("\033[0;37mo\033[m", stdout);
|
fputs("\033[0;37mo\033[m", stdout);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue