df: implement -B n<suff> and -B <suff> formats of -B option

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2016-12-12 19:56:31 +01:00
parent 76de3257f7
commit e184a88356
4 changed files with 41 additions and 24 deletions

View File

@ -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 }
};