Subject: bug#14113: [PATCH] human: add unambiguous block_size_args

From: Mihai Capotă <[email-masked]>
Date: Mon, 1 Apr 2013 14:38:25 +0200

The units used in the outputs of "human-readable" and "si" look
identical when "K/k" is not present. Add two block_size_args, "binary"
and "decimal", that disambiguate between the outputs of "human-readable"
and "si" by adding human_B to the list of options.

See bug 7176 in GNU coreutils,
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7176>.
---
 lib/human.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/human.c b/lib/human.c
index 613dc65..66a1835 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -394,11 +394,21 @@ human_readable (uintmax_t n, char *buf, int opts,
 # define DEFAULT_BLOCK_SIZE 1024
 #endif
 
-static char const *const block_size_args[] = { "human-readable", "si", 0 };
+static char const *const block_size_args[] =
+  {
+    "human-readable",
+    "si",
+    "binary",
+    "decimal",
+    0
+  };
+
 static int const block_size_opts[] =
   {
     human_autoscale + human_SI + human_base_1024,
-    human_autoscale + human_SI
+    human_autoscale + human_SI,
+    human_autoscale + human_SI + human_base_1024 + human_B,
+    human_autoscale + human_SI + human_B
   };
 
 static uintmax_t
-- 
1.7.9.5