summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko2016-12-12 19:56:31 +0100
committerDenys Vlasenko2016-12-12 19:56:31 +0100
commite184a883567ee3fd735644416e4bd683f1894ac5 (patch)
tree7eae83fb609ecc41c44803e5969db5b1bb726f10 /libbb
parent76de3257f7133a760c3d8908a99b850ea2d0f0b0 (diff)
downloadbusybox-e184a883567ee3fd735644416e4bd683f1894ac5.zip
busybox-e184a883567ee3fd735644416e4bd683f1894ac5.tar.gz
df: implement -B n<suff> and -B <suff> formats of -B option
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xatonum.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbb/xatonum.c b/libbb/xatonum.c
index 9dd5c3e..b63b7f5 100644
--- a/libbb/xatonum.c
+++ b/libbb/xatonum.c
@@ -96,3 +96,22 @@ const struct suffix_mult cwbkMG_suffixes[] = {
/* coreutils also understands TPEZY suffixes for tera- and so on, with B suffix for decimal */
{ "", 0 }
};
+
+const struct suffix_mult kmg_i_suffixes[] = {
+ { "KiB", 1024 },
+ { "kiB", 1024 },
+ { "K", 1024 },
+ { "k", 1024 },
+ { "MiB", 1048576 },
+ { "miB", 1048576 },
+ { "M", 1048576 },
+ { "m", 1048576 },
+ { "GiB", 1073741824 },
+ { "giB", 1073741824 },
+ { "G", 1073741824 },
+ { "g", 1073741824 },
+ { "KB", 1000 },
+ { "MB", 1000000 },
+ { "GB", 1000000000 },
+ { "", 0 }
+};