X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=pager.c;h=05584dead6728ceff818630fbccaa91bb6c6b686;hb=HEAD;hp=b7909678f459d90d1c8907c78bb5fcb512fe558d;hpb=0e20414f106e22fb13aa4d00201dbeb7422b83fb;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; +}