diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-08-23 03:25:22 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-08-23 03:25:22 +0000 |
commit | 14dad7028bcc90c02e92fa24fce9e5a39116fb24 (patch) | |
tree | c9cd62fb0835205cd410c1610966bb4a7e7d913a /coreutils/du.c | |
parent | 1ed9dd9d062e27807745c11736b0c6401677c12e (diff) | |
download | busybox-w32-14dad7028bcc90c02e92fa24fce9e5a39116fb24.tar.gz busybox-w32-14dad7028bcc90c02e92fa24fce9e5a39116fb24.tar.bz2 busybox-w32-14dad7028bcc90c02e92fa24fce9e5a39116fb24.zip |
Run through indent
Diffstat (limited to 'coreutils/du.c')
-rw-r--r-- | coreutils/du.c | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/coreutils/du.c b/coreutils/du.c index ed9f7156a..39241a283 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -37,19 +37,18 @@ | |||
37 | static unsigned long disp_hr = KILOBYTE; | 37 | static unsigned long disp_hr = KILOBYTE; |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | typedef void (Display) (long, char *); | ||
41 | |||
42 | static int du_depth = 0; | 40 | static int du_depth = 0; |
43 | static int count_hardlinks = 0; | 41 | static int count_hardlinks = 0; |
44 | static int one_file_system = 0; | 42 | static int one_file_system = 0; |
45 | static dev_t dir_dev = 0; | 43 | static dev_t dir_dev; |
46 | 44 | ||
47 | static Display *print; | 45 | static void (*print) (long, char *); |
48 | 46 | ||
49 | static void print_normal(long size, char *filename) | 47 | static void print_normal(long size, char *filename) |
50 | { | 48 | { |
51 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 49 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
52 | printf("%s\t%s\n", make_human_readable_str(size<<10, 1, disp_hr), filename); | 50 | printf("%s\t%s\n", make_human_readable_str(size << 10, 1, disp_hr), |
51 | filename); | ||
53 | #else | 52 | #else |
54 | printf("%ld\t%s\n", size, filename); | 53 | printf("%ld\t%s\n", size, filename); |
55 | #endif | 54 | #endif |
@@ -114,15 +113,13 @@ static long du(char *filename) | |||
114 | } | 113 | } |
115 | closedir(dir); | 114 | closedir(dir); |
116 | print(sum, filename); | 115 | print(sum, filename); |
117 | } | 116 | } else if (statbuf.st_nlink > 1 && !count_hardlinks) { |
118 | else if (statbuf.st_nlink > 1 && !count_hardlinks) { | ||
119 | /* Add files with hard links only once */ | 117 | /* Add files with hard links only once */ |
120 | if (is_in_ino_dev_hashtable(&statbuf, NULL)) { | 118 | if (is_in_ino_dev_hashtable(&statbuf, NULL)) { |
121 | sum = 0L; | 119 | sum = 0L; |
122 | if (du_depth == 1) | 120 | if (du_depth == 1) |
123 | print(sum, filename); | 121 | print(sum, filename); |
124 | } | 122 | } else { |
125 | else { | ||
126 | add_to_ino_dev_hashtable(&statbuf, NULL); | 123 | add_to_ino_dev_hashtable(&statbuf, NULL); |
127 | } | 124 | } |
128 | } | 125 | } |
@@ -142,27 +139,32 @@ int du_main(int argc, char **argv) | |||
142 | /* parse argv[] */ | 139 | /* parse argv[] */ |
143 | while ((c = getopt(argc, argv, "slx" | 140 | while ((c = getopt(argc, argv, "slx" |
144 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 141 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
145 | "hm" | 142 | "hm" |
146 | #endif | 143 | #endif |
147 | "k")) != EOF) { | 144 | "k")) != EOF) { |
148 | switch (c) { | 145 | switch (c) { |
149 | case 's': | 146 | case 's': |
150 | print = print_summary; | 147 | print = print_summary; |
151 | break; | 148 | break; |
152 | case 'l': | 149 | case 'l': |
153 | count_hardlinks = 1; | 150 | count_hardlinks = 1; |
154 | break; | 151 | break; |
155 | case 'x': | 152 | case 'x': |
156 | one_file_system = 1; | 153 | one_file_system = 1; |
157 | break; | 154 | break; |
158 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 155 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
159 | case 'h': disp_hr = 0; break; | 156 | case 'h': |
160 | case 'm': disp_hr = MEGABYTE; break; | 157 | disp_hr = 0; |
158 | break; | ||
159 | case 'm': | ||
160 | disp_hr = MEGABYTE; | ||
161 | break; | ||
161 | #endif | 162 | #endif |
162 | case 'k': break; | 163 | case 'k': |
163 | default: | 164 | break; |
164 | show_usage(); | 165 | default: |
165 | } | 166 | show_usage(); |
167 | } | ||
166 | } | 168 | } |
167 | 169 | ||
168 | /* go through remaining args (if any) */ | 170 | /* go through remaining args (if any) */ |
@@ -172,9 +174,9 @@ int du_main(int argc, char **argv) | |||
172 | } else { | 174 | } else { |
173 | long sum; | 175 | long sum; |
174 | 176 | ||
175 | for (i=optind; i < argc; i++) { | 177 | for (i = optind; i < argc; i++) { |
176 | sum = du(argv[i]); | 178 | sum = du(argv[i]); |
177 | if(is_directory(argv[i], FALSE, NULL)==FALSE) { | 179 | if (is_directory(argv[i], FALSE, NULL) == FALSE) { |
178 | print_normal(sum, argv[i]); | 180 | print_normal(sum, argv[i]); |
179 | } | 181 | } |
180 | reset_ino_dev_hashtable(); | 182 | reset_ino_dev_hashtable(); |
@@ -184,7 +186,7 @@ int du_main(int argc, char **argv) | |||
184 | return status; | 186 | return status; |
185 | } | 187 | } |
186 | 188 | ||
187 | /* $Id: du.c,v 1.53 2002/04/06 23:16:44 andersen Exp $ */ | 189 | /* $Id: du.c,v 1.54 2002/08/23 03:25:22 bug1 Exp $ */ |
188 | /* | 190 | /* |
189 | Local Variables: | 191 | Local Variables: |
190 | c-file-style: "linux" | 192 | c-file-style: "linux" |