summaryrefslogtreecommitdiff
path: root/src/du.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-12-19 12:52:33 +0000
committerJim Meyering <jim@meyering.net>2003-12-19 12:52:33 +0000
commit55186d55b05ee8941f445e0e7d815669bcf68ec3 (patch)
tree54db4a6056febc8a56ba6367fe9e9ff2d2c46c8d /src/du.c
parent16972646cffa7e08911e1b7781c5b9e119eaf5e8 (diff)
downloadcoreutils-55186d55b05ee8941f445e0e7d815669bcf68ec3.tar.xz
(FTS_CROSS_CHECK, DEBUG_OPT): Define.
(main): Make fts use FTS_TIGHT_CYCLE_CHECK. (main) [DU_DEBUG]: Accept -d option.
Diffstat (limited to 'src/du.c')
-rw-r--r--src/du.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/du.c b/src/du.c
index 6342a49aa..25ae4c5a1 100644
--- a/src/du.c
+++ b/src/du.c
@@ -42,12 +42,22 @@
#include "xfts.h"
#include "xstrtol.h"
+extern int fts_debug;
+
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "du"
#define AUTHORS \
"Torbjorn Granlund", "David MacKenzie, Paul Eggert", "Jim Meyering"
+#if DU_DEBUG
+# define FTS_CROSS_CHECK(Fts) fts_cross_check (Fts)
+# define DEBUG_OPT "d"
+#else
+# define FTS_CROSS_CHECK(Fts)
+# define DEBUG_OPT
+#endif
+
/* Initial size of the hash table. */
#define INITIAL_TABLE_SIZE 103
@@ -489,6 +499,7 @@ du_files (char **files, int bit_flags)
}
break;
}
+ FTS_CROSS_CHECK (fts);
/* This is a space optimization. If we aren't printing totals,
then it's ok to clear the duplicate-detection tables after
@@ -520,7 +531,7 @@ main (int argc, char **argv)
int fail;
/* Bit flags that control how fts works. */
- int bit_flags = FTS_PHYSICAL;
+ int bit_flags = FTS_PHYSICAL | FTS_TIGHT_CYCLE_CHECK;
/* If nonzero, display only a total for each argument. */
int opt_summarize_only = 0;
@@ -542,7 +553,7 @@ main (int argc, char **argv)
&output_block_size);
fail = 0;
- while ((c = getopt_long (argc, argv, "abchHklmsxB:DLPSX:",
+ while ((c = getopt_long (argc, argv, DEBUG_OPT "abchHklmsxB:DLPSX:",
long_options, NULL)) != -1)
{
long int tmp_long;
@@ -551,6 +562,12 @@ main (int argc, char **argv)
case 0: /* Long option. */
break;
+#if DU_DEBUG
+ case 'd':
+ fts_debug = 1;
+ break;
+#endif
+
case 'a':
opt_all = 1;
break;