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