X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=pager.c;h=05584dead6728ceff818630fbccaa91bb6c6b686;hb=90e6ef53203e5567aadda2f76b69a40251987a07;hp=b7909678f459d90d1c8907c78bb5fcb512fe558d;hpb=a09a0c27094f15774e513286c02adacc11b6e6b2;p=git.git diff --git a/pager.c b/pager.c index b7909678f..05584dead 100644 --- a/pager.c +++ b/pager.c @@ -147,3 +147,15 @@ int term_columns(void) return term_columns_at_startup; } + +/* + * How many columns do we need to show this number in decimal? + */ +int decimal_width(int number) +{ + int i, width; + + for (width = 1, i = 10; i <= number; width++) + i *= 10; + return width; +}