From 61feee56570a12cebe2779f11ddc644c47180426 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 23 Dec 2024 10:13:53 +0100 Subject: [PATCH] Use kB instead of KB in --si mode Backport of db96bc698c8cea630e79782f95435f3705ef8fd7 from the Zig branch. --- ncdu.1 | 2 +- src/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ncdu.1 b/ncdu.1 index 1bdb761..84d41b5 100644 --- a/ncdu.1 +++ b/ncdu.1 @@ -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 diff --git a/src/util.c b/src/util.c index 6b36b9b..7fd30ba 100644 --- a/src/util.c +++ b/src/util.c @@ -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; }