X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fxatonum.c;h=b63b7f54d4185b80dd2649240e86e29a3cf4dab9;hb=959cb6742832a3b403a5d0116088a09f33afe927;hp=6f4e023bbc166de84cadcc6e0bc38afdc8ff325d;hpb=c72b43c2f07e5fae288fff9e220b1f88e2889a72;p=oweals%2Fbusybox.git diff --git a/libbb/xatonum.c b/libbb/xatonum.c index 6f4e023bb..b63b7f54d 100644 --- a/libbb/xatonum.c +++ b/libbb/xatonum.c @@ -75,3 +75,43 @@ const struct suffix_mult bkm_suffixes[] = { { "m", 1024*1024 }, { "", 0 } }; + +const struct suffix_mult cwbkMG_suffixes[] = { + { "c", 1 }, + { "w", 2 }, + { "b", 512 }, + { "kB", 1000 }, + { "kD", 1000 }, + { "k", 1024 }, + { "KB", 1000 }, /* compat with coreutils dd */ + { "KD", 1000 }, /* compat with coreutils dd */ + { "K", 1024 }, /* compat with coreutils dd */ + { "MB", 1000000 }, + { "MD", 1000000 }, + { "M", 1024*1024 }, + { "GB", 1000000000 }, + { "GD", 1000000000 }, + { "G", 1024*1024*1024 }, + /* "D" suffix for decimal is not in coreutils manpage, looks like it's deprecated */ + /* 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 } +};