diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-04-06 23:16:44 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-04-06 23:16:44 +0000 |
commit | 265d229427dc35456dec37215142a3b0e06903df (patch) | |
tree | 0fd5ef5f1b9a86159d807993480e678dbed9e0f6 | |
parent | fcffa2cc1a0f11ea6a075dd37762ca5b543b55e1 (diff) | |
download | busybox-w32-265d229427dc35456dec37215142a3b0e06903df.tar.gz busybox-w32-265d229427dc35456dec37215142a3b0e06903df.tar.bz2 busybox-w32-265d229427dc35456dec37215142a3b0e06903df.zip |
Patch from Edward Betts <edward@debian.org> to add -x switch to du.c
-rw-r--r-- | coreutils/du.c | 14 | ||||
-rw-r--r-- | include/usage.h | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/coreutils/du.c b/coreutils/du.c index e34a7f46f..ed9f7156a 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 1999,2000,2001 by Lineo, inc. and John Beppu | 5 | * Copyright (C) 1999,2000,2001 by Lineo, inc. and John Beppu |
6 | * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org> | 6 | * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org> |
7 | * Copyright (C) 2002 Edward Betts <edward@debian.org> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
@@ -40,6 +41,8 @@ typedef void (Display) (long, char *); | |||
40 | 41 | ||
41 | static int du_depth = 0; | 42 | static int du_depth = 0; |
42 | static int count_hardlinks = 0; | 43 | static int count_hardlinks = 0; |
44 | static int one_file_system = 0; | ||
45 | static dev_t dir_dev = 0; | ||
43 | 46 | ||
44 | static Display *print; | 47 | static Display *print; |
45 | 48 | ||
@@ -69,6 +72,10 @@ static long du(char *filename) | |||
69 | perror_msg("%s", filename); | 72 | perror_msg("%s", filename); |
70 | return 0; | 73 | return 0; |
71 | } | 74 | } |
75 | if (du_depth == 0) | ||
76 | dir_dev = statbuf.st_dev; | ||
77 | else if (one_file_system && dir_dev != statbuf.st_dev) | ||
78 | return 0; | ||
72 | 79 | ||
73 | du_depth++; | 80 | du_depth++; |
74 | sum = (statbuf.st_blocks >> 1); | 81 | sum = (statbuf.st_blocks >> 1); |
@@ -133,7 +140,7 @@ int du_main(int argc, char **argv) | |||
133 | print = print_normal; | 140 | print = print_normal; |
134 | 141 | ||
135 | /* parse argv[] */ | 142 | /* parse argv[] */ |
136 | while ((c = getopt(argc, argv, "sl" | 143 | while ((c = getopt(argc, argv, "slx" |
137 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 144 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
138 | "hm" | 145 | "hm" |
139 | #endif | 146 | #endif |
@@ -145,6 +152,9 @@ int du_main(int argc, char **argv) | |||
145 | case 'l': | 152 | case 'l': |
146 | count_hardlinks = 1; | 153 | count_hardlinks = 1; |
147 | break; | 154 | break; |
155 | case 'x': | ||
156 | one_file_system = 1; | ||
157 | break; | ||
148 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 158 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
149 | case 'h': disp_hr = 0; break; | 159 | case 'h': disp_hr = 0; break; |
150 | case 'm': disp_hr = MEGABYTE; break; | 160 | case 'm': disp_hr = MEGABYTE; break; |
@@ -174,7 +184,7 @@ int du_main(int argc, char **argv) | |||
174 | return status; | 184 | return status; |
175 | } | 185 | } |
176 | 186 | ||
177 | /* $Id: du.c,v 1.52 2001/12/17 15:26:25 kraai Exp $ */ | 187 | /* $Id: du.c,v 1.53 2002/04/06 23:16:44 andersen Exp $ */ |
178 | /* | 188 | /* |
179 | Local Variables: | 189 | Local Variables: |
180 | c-file-style: "linux" | 190 | c-file-style: "linux" |
diff --git a/include/usage.h b/include/usage.h index e7de6f53f..98a9f32cd 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -343,7 +343,7 @@ | |||
343 | "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" | 343 | "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" |
344 | 344 | ||
345 | #define du_trivial_usage \ | 345 | #define du_trivial_usage \ |
346 | "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..." | 346 | "[-lsx" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..." |
347 | #define du_full_usage \ | 347 | #define du_full_usage \ |
348 | "Summarizes disk space used for each FILE and/or directory.\n" \ | 348 | "Summarizes disk space used for each FILE and/or directory.\n" \ |
349 | "Disk space is printed in units of 1024 bytes.\n\n" \ | 349 | "Disk space is printed in units of 1024 bytes.\n\n" \ |
@@ -353,6 +353,7 @@ | |||
353 | USAGE_HUMAN_READABLE( \ | 353 | USAGE_HUMAN_READABLE( \ |
354 | "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \ | 354 | "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \ |
355 | "\t-m\tprint sizes in megabytes\n" \ | 355 | "\t-m\tprint sizes in megabytes\n" \ |
356 | "\t-x\tskip directories on different filesystems\n" \ | ||
356 | "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ | 357 | "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \ |
357 | "\n\t-k\tprint sizes in kilobytes(compatibility)") | 358 | "\n\t-k\tprint sizes in kilobytes(compatibility)") |
358 | #define du_example_usage \ | 359 | #define du_example_usage \ |