aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/du.c
diff options
context:
space:
mode:
authorIsaac Dunham <ibid.ag@gmail.com>2014-04-12 17:26:44 -0500
committerIsaac Dunham <ibid.ag@gmail.com>2014-04-12 17:26:44 -0500
commit931425ca05b93348dd497598af077d16cdc1cd3c (patch)
tree1c5d8a9c9cf0d9953b8d74077b762e1d87b6fdf0 /toys/posix/du.c
parent669f332aafe1afdbbfbe4b7c1c8fdab6fa2cec1d (diff)
downloadtoybox-931425ca05b93348dd497598af077d16cdc1cd3c.tar.gz
roadmap: describe glibc commands.
Some glibc commands are irrelevant because they're for functionality that is excluded from musl (mtrace, rpc*, localedef, iconvconfig, nscd). getconf and catchsegv look like candidates for the development toolchain; locale and iconv were already triaged. getent is pretty lame, but it and the timezone stuff (tzselect zic zdump) are the only new possibly interesting commands.
Diffstat (limited to 'toys/posix/du.c')
-rw-r--r--toys/posix/du.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/toys/posix/du.c b/toys/posix/du.c
index 96922bca..64ba0517 100644
--- a/toys/posix/du.c
+++ b/toys/posix/du.c
@@ -54,18 +54,8 @@ static void print(long long size, struct dirtree *node)
if (TT.maxdepth && TT.depth > TT.maxdepth) return;
- if (toys.optflags & FLAG_h) {
- char buf[32];
- int index, sz;
-
- for (index = 0; 1024 < size>>(10*index); index++);
- sz = size>>(10*index);
- if (sz < 10) {
- sprintf(buf, "%llu", size>>(10*(index-1)));
- printf("%c.%c", buf[0], buf[1]);
- } else printf("%d", sz);
- if (index) printf("%c", " KMGTPE"[index]);
- } else {
+ if (toys.optflags & FLAG_h) printf("%s", human_readable(size));
+ else {
int bits = 10;
if (toys.optflags & FLAG_K) bits = 9;