From 059ab346cdd4b637cb40fe093032903b67458fe3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dariusz=20Knoci=C5=84ski?= <dknoto@gmail.com>
Date: Sat, 18 Feb 2017 01:41:12 +0100
Subject: [PATCH] df: adjusted width of columns due to introduction new name of
file system and new default mount points. Added correct unit names based
on norm IEC 60027-2.
---
src/bin/df.cpp | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/bin/df.cpp b/src/bin/df.cpp
index d7e66e9eb2..cb281a3759 100644
a
|
b
|
PrintMountPoint(dev_t device, bool verbose)
|
45 | 45 | if (verbose) |
46 | 46 | printf(" Mounted at: %s\n", mount); |
47 | 47 | else { |
48 | | printf("%-15s ", mount); |
49 | | if (strlen(mount) > 15) |
50 | | printf("\n%15s ", ""); |
| 48 | printf("%-17s ", mount); |
| 49 | if (strlen(mount) > 17) |
| 50 | printf("\n%17s ", ""); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
… |
… |
PrintMountPoint(dev_t device, bool verbose)
|
55 | 55 | void |
56 | 56 | PrintType(const char *fileSystem) |
57 | 57 | { |
58 | | char type[10]; |
| 58 | char type[16]; |
59 | 59 | strlcpy(type, fileSystem, sizeof(type)); |
60 | 60 | |
61 | | printf("%-8s", type); |
| 61 | printf("%-9s", type); |
62 | 62 | } |
63 | 63 | |
64 | 64 | |
… |
… |
ByteString(int64 numBlocks, int64 blockSize)
|
71 | 71 | if (blocks < 1024) |
72 | 72 | sprintf(string, "%" B_PRId64, numBlocks * blockSize); |
73 | 73 | else { |
74 | | const char *units[] = {"K", "M", "G", NULL}; |
| 74 | const char *units[] = {"KiB", "MiB", "GiB", "TiB", "PiB", "EiB", |
| 75 | "ZiB", "YiB", NULL}; |
75 | 76 | int32 i = -1; |
76 | 77 | |
77 | 78 | do { |
… |
… |
ByteString(int64 numBlocks, int64 blockSize)
|
79 | 80 | i++; |
80 | 81 | } while (blocks >= 1024 && units[i + 1]); |
81 | 82 | |
82 | | sprintf(string, "%.1f%s", blocks, units[i]); |
| 83 | sprintf(string, "%.1f %s", blocks, units[i]); |
83 | 84 | } |
84 | 85 | |
85 | 86 | return string; |
… |
… |
main(int argc, char **argv)
|
236 | 237 | |
237 | 238 | // If not, then just iterate over all devices and give a compact summary |
238 | 239 | |
239 | | printf("Mount Type Total Free Flags Device\n" |
240 | | "--------------- -------- --------- --------- ------- --------------------------\n"); |
| 240 | printf(" Mount Type Total Free Flags Device\n" |
| 241 | "----------------- --------- --------- --------- ------- ------------------------\n"); |
241 | 242 | |
242 | 243 | int32 cookie = 0; |
243 | 244 | while ((device = next_dev(&cookie)) >= B_OK) { |