diff options
Diffstat (limited to 'coreutils')
| -rw-r--r-- | coreutils/du.c | 14 |
1 files changed, 12 insertions, 2 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" |
