diff options
Diffstat (limited to 'toolbox/df.c')
-rw-r--r-- | toolbox/df.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/toolbox/df.c b/toolbox/df.c index 9cd0743..63940a1 100644 --- a/toolbox/df.c +++ b/toolbox/df.c @@ -9,22 +9,16 @@ static int ok = EXIT_SUCCESS; static void printsize(long long n) { char unit = 'K'; - long long t; - - n *= 10; - - if (n > 1024*1024*10) { + n /= 1024; + if (n > 1024) { n /= 1024; unit = 'M'; } - - if (n > 1024*1024*10) { + if (n > 1024) { n /= 1024; unit = 'G'; } - - t = (n + 512) / 1024; - printf("%4lld.%1lld%c", t/10, t%10, unit); + printf("%4lld%c", n, unit); } static void df(char *s, int always) { @@ -47,7 +41,7 @@ static void df(char *s, int always) { } int df_main(int argc, char *argv[]) { - printf("Filesystem Size Used Free Blksize\n"); + printf("Filesystem Size Used Free Blksize\n"); if (argc == 1) { char s[2000]; FILE *f = fopen("/proc/mounts", "r"); |