Use kB instead of KB in --si mode

Backport of db96bc698c from the Zig
branch.
This commit is contained in:
Yorhel 2024-12-23 10:13:53 +01:00
parent b4b82d96a3
commit 61feee5657
2 changed files with 2 additions and 2 deletions

2
ncdu.1
View file

@ -210,7 +210,7 @@ when given twice it will also add
thus ensuring that there is no way to modify the file system from within
.Nm .
.It Fl \-si , \-no\-si
List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB, etc), as
List sizes using base 10 prefixes, that is, powers of 1000 (kB, MB, etc), as
defined in the International System of Units (SI), instead of the usual base 2
prefixes (KiB, MiB, etc).
.It Fl \-disk\-usage , \-apparent\-size

View file

@ -76,7 +76,7 @@ float formatsize(int64_t from, const char **unit) {
float r = from;
if (si) {
if(r < 1000.0f) { *unit = " B"; }
else if(r < 1e6f) { *unit = "KB"; r/=1e3f; }
else if(r < 1e6f) { *unit = "kB"; r/=1e3f; }
else if(r < 1e9f) { *unit = "MB"; r/=1e6f; }
else if(r < 1e12f){ *unit = "GB"; r/=1e9f; }
else if(r < 1e15f){ *unit = "TB"; r/=1e12f; }