From: Paul Fox Date: Thu, 15 May 2014 12:55:45 +0000 (-0400) Subject: change mhlist to use decimal math when abbreviating sizes X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/252f672ba218d1ed1f5018844dd007b5d2e6a860?ds=inline;hp=-c change mhlist to use decimal math when abbreviating sizes the K/M/G/T units imply factors of 1000, so make the code match. (the alternative would be to change the units to Ki/Mi/Gi/Ti.) mhlist output might someday be configurable using mh-format, in which case the user will be able to choose. --- 252f672ba218d1ed1f5018844dd007b5d2e6a860 diff --git a/man/mhlist.man b/man/mhlist.man index 69394fec..509e9136 100644 --- a/man/mhlist.man +++ b/man/mhlist.man @@ -55,6 +55,8 @@ switch tells to evaluate the \*(lqnative\*(rq (decoded) format of each content prior to listing. This provides an accurate count at the expense of a small delay. +In either case, sizes will be expressed using SI prefix abbreviations +(K/M/G/T), which are based on factors of 1000. .PP If the .B \-verbose diff --git a/uip/mhlistsbr.c b/uip/mhlistsbr.c index ee2800a8..fea4ea28 100644 --- a/uip/mhlistsbr.c +++ b/uip/mhlistsbr.c @@ -164,7 +164,7 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug, size = ct->c_end - ct->c_begin; /* find correct scale for size (Kilo/Mega/Giga/Tera) */ - for (cp = " KMGT"; size > 9999; size >>= 10) + for (cp = " KMGT"; size > 9999; size /= 1000) if (!*++cp) break;