summaryrefslogtreecommitdiff
path: root/lib/human.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-11-16 07:53:08 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-11-16 07:53:08 +0000
commit7ce1f197f36e1064d4f411ee8ae7f2f70ddb1255 (patch)
tree1258b15af95f9f7fd888d569eaa67d41e508cffb /lib/human.c
parentc49c8d6feeabdb41f8e5340c41005f4150b55d11 (diff)
downloadcoreutils-7ce1f197f36e1064d4f411ee8ae7f2f70ddb1255.tar.xz
(human_readable): Support human_space_before_unit.
Diffstat (limited to 'lib/human.c')
-rw-r--r--lib/human.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/human.c b/lib/human.c
index f024c73ea..4960876dd 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -158,6 +158,9 @@ group_number (char *number, size_t numberlen,
so on. Numbers smaller than the power aren't modified.
human_autoscale is normally used together with human_SI.
+ If (OPTS & human_space_before_unit), use a space to separate the
+ number from any suffix that is appended as described below.
+
If (OPTS & human_SI), append an SI prefix indicating which power is
being used. If in addition (OPTS & human_B), append "B" (if base
1000) or "iB" (if base 1024) to the SI prefix. When ((OPTS &
@@ -384,6 +387,9 @@ human_readable (uintmax_t n, char *buf, int opts,
break;
}
+ if ((exponent | (opts & human_B)) && (opts & human_space_before_unit))
+ *psuffix++ = ' ';
+
if (exponent)
*psuffix++ = (! (opts & human_base_1024) && exponent == 1
? 'k'