diff options
Diffstat (limited to 'coreutils/du.c')
-rw-r--r-- | coreutils/du.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/coreutils/du.c b/coreutils/du.c index 34a549f02..19a0319f1 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -26,11 +26,7 @@ | |||
26 | //usage:#define du_trivial_usage | 26 | //usage:#define du_trivial_usage |
27 | //usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..." | 27 | //usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..." |
28 | //usage:#define du_full_usage "\n\n" | 28 | //usage:#define du_full_usage "\n\n" |
29 | //usage: "Summarize disk space used for each FILE and/or directory.\n" | 29 | //usage: "Summarize disk space used for each FILE and/or directory\n" |
30 | //usage: "Disk space is printed in units of " | ||
31 | //usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024") | ||
32 | //usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512") | ||
33 | //usage: " bytes.\n" | ||
34 | //usage: "\n -a Show file sizes too" | 30 | //usage: "\n -a Show file sizes too" |
35 | //usage: "\n -L Follow all symlinks" | 31 | //usage: "\n -L Follow all symlinks" |
36 | //usage: "\n -H Follow symlinks on command line" | 32 | //usage: "\n -H Follow symlinks on command line" |
@@ -40,11 +36,13 @@ | |||
40 | //usage: "\n -s Display only a total for each argument" | 36 | //usage: "\n -s Display only a total for each argument" |
41 | //usage: "\n -x Skip directories on different filesystems" | 37 | //usage: "\n -x Skip directories on different filesystems" |
42 | //usage: IF_FEATURE_HUMAN_READABLE( | 38 | //usage: IF_FEATURE_HUMAN_READABLE( |
43 | //usage: "\n -h Sizes in human readable format (e.g., 1K 243M 2G )" | 39 | //usage: "\n -h Sizes in human readable format (e.g., 1K 243M 2G)" |
44 | //usage: "\n -m Sizes in megabytes" | 40 | //usage: "\n -m Sizes in megabytes" |
45 | //usage: ) | 41 | //usage: ) |
46 | //usage: "\n -k Sizes in kilobytes" | 42 | //usage: "\n -k Sizes in kilobytes" IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(" (default)") |
47 | //usage: IF_FEATURE_DU_DEFAULT_BLOCKSIZE_1K(" (default)") | 43 | //usage: IF_NOT_FEATURE_DU_DEFAULT_BLOCKSIZE_1K( |
44 | //usage: "\n Default unit is 512 bytes" | ||
45 | //usage: ) | ||
48 | //usage: | 46 | //usage: |
49 | //usage:#define du_example_usage | 47 | //usage:#define du_example_usage |
50 | //usage: "$ du\n" | 48 | //usage: "$ du\n" |
@@ -91,7 +89,7 @@ struct globals { | |||
91 | #define INIT_G() do { } while (0) | 89 | #define INIT_G() do { } while (0) |
92 | 90 | ||
93 | 91 | ||
94 | static void print(unsigned long size, const char *filename) | 92 | static void print(unsigned long long size, const char *filename) |
95 | { | 93 | { |
96 | /* TODO - May not want to defer error checking here. */ | 94 | /* TODO - May not want to defer error checking here. */ |
97 | #if ENABLE_FEATURE_HUMAN_READABLE | 95 | #if ENABLE_FEATURE_HUMAN_READABLE |
@@ -105,15 +103,15 @@ static void print(unsigned long size, const char *filename) | |||
105 | size++; | 103 | size++; |
106 | size >>= 1; | 104 | size >>= 1; |
107 | } | 105 | } |
108 | printf("%lu\t%s\n", size, filename); | 106 | printf("%llu\t%s\n", size, filename); |
109 | #endif | 107 | #endif |
110 | } | 108 | } |
111 | 109 | ||
112 | /* tiny recursive du */ | 110 | /* tiny recursive du */ |
113 | static unsigned long du(const char *filename) | 111 | static unsigned long long du(const char *filename) |
114 | { | 112 | { |
115 | struct stat statbuf; | 113 | struct stat statbuf; |
116 | unsigned long sum; | 114 | unsigned long long sum; |
117 | 115 | ||
118 | if (lstat(filename, &statbuf) != 0) { | 116 | if (lstat(filename, &statbuf) != 0) { |
119 | bb_simple_perror_msg(filename); | 117 | bb_simple_perror_msg(filename); |
@@ -190,7 +188,7 @@ static unsigned long du(const char *filename) | |||
190 | int du_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 188 | int du_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
191 | int du_main(int argc UNUSED_PARAM, char **argv) | 189 | int du_main(int argc UNUSED_PARAM, char **argv) |
192 | { | 190 | { |
193 | unsigned long total; | 191 | unsigned long long total; |
194 | int slink_depth_save; | 192 | int slink_depth_save; |
195 | unsigned opt; | 193 | unsigned opt; |
196 | 194 | ||