]> diplodocus.org Git - nmh/commitdiff
change mhlist to use decimal math when abbreviating sizes
authorPaul Fox <pgf@foxharp.boston.ma.us>
Thu, 15 May 2014 12:55:45 +0000 (08:55 -0400)
committerPaul Fox <pgf@foxharp.boston.ma.us>
Thu, 15 May 2014 12:59:04 +0000 (08:59 -0400)
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.

man/mhlist.man
uip/mhlistsbr.c

index 69394fec7b80489d0b37acf556a12625c3e59e87..509e91364c062ef4fa93f8eb1e30fa246f4dbe47 100644 (file)
@@ -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
index ee2800a834ac65d92f47998ce4e70fb05fdb7ed7..fea4ea285d69a03a241fec476520c13167441b7c 100644 (file)
@@ -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;