summaryrefslogtreecommitdiffstats
path: root/src/printf-utils.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-12-25 11:47:22 +0100
committerPali Rohár <pali.rohar@gmail.com>2016-12-25 11:47:22 +0100
commit71e0eb87ea7a04882d53d6b15cd4a4bb3f3b5695 (patch)
tree58f069cd1b4972124a9f891946929fb18c121cf3 /src/printf-utils.c
parent04f94d957a412ae99965fce2106469eb5051d3d1 (diff)
parent9bf886c04169cd2ee6bb0916f3422d4d54e158f4 (diff)
download0xFFFF-71e0eb87ea7a04882d53d6b15cd4a4bb3f3b5695.tar.bz2
Merge branch 'master' into maemo
Diffstat (limited to 'src/printf-utils.c')
-rw-r--r--src/printf-utils.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/printf-utils.c b/src/printf-utils.c
index 3520d0b..d43c063 100644
--- a/src/printf-utils.c
+++ b/src/printf-utils.c
@@ -39,20 +39,20 @@ void printf_progressbar(unsigned long long part, unsigned long long total) {
int tmp, cols = 80;
/* percentage calculation */
- pc = total==0?100:(int)(part*100/total);
- (pc<0)?pc=0:(pc>100)?pc=100:0;
+ pc = total == 0 ? 100 : (int)(part*100/total);
+ ( pc < 0 ) ? pc = 0 : ( pc > 100 ) ? pc = 100 : 0;
PRINTF_BACK();
PRINTF_ADD("\x1b[K %3d%% [", pc);
- if (columns)
+ if ( columns )
cols = atoi(columns);
- if (cols > 115)
+ if ( cols > 115 )
cols = 115;
cols-=15;
- for(tmp=cols*pc/100;tmp;tmp--) PRINTF_ADD("#");
- for(tmp=cols-(cols*pc/100);tmp;tmp--) PRINTF_ADD("-");
+ for ( tmp = cols*pc/100; tmp; tmp-- ) PRINTF_ADD("#");
+ for ( tmp = cols-(cols*pc/100); tmp; tmp-- ) PRINTF_ADD("-");
PRINTF_ADD("]");
- if (part == total) PRINTF_END();
+ if ( part == total ) PRINTF_END();
fflush(stdout);
}