From: Paul Eggert Date: Wed, 19 Feb 2025 04:09:10 +0000 (-0800) Subject: du: update debug option setup X-Git-Tag: v9.7~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c893593246dbc8c52a9c05afa16640da60ad646;p=thirdparty%2Fcoreutils.git du: update debug option setup Current Gnulib arranges for fts debugging if GNULIB_FTS_DEBUG is defined, so key off that rather than off DU_DEBUG. * src/du.c (fts_debug): Remove decl, as Gnulib does this now. (FTS_CROSS_CHECK): Remove; all uses removed. (FTS_DEBUG) [!GNULIB_FTS_DEBUG]: Remove. (long_options) [GNULIB_FTS_DEBUG]: Add a ---debug option. (du_files): Call fts_cross_check only if fts_debug and GNULIB_FTS_DEBUG. (main): Set fts_debug if GNULIB_FTS_DEBUG, not DU_DEBUG. --- diff --git a/src/du.c b/src/du.c index 0e5d860a92..bac372a042 100644 --- a/src/du.c +++ b/src/du.c @@ -43,8 +43,6 @@ #include "xstrtol.h" #include "xstrtol-error.h" -extern bool fts_debug; - /* The official name of this program (e.g., no 'g' prefix). */ #define PROGRAM_NAME "du" @@ -54,12 +52,6 @@ extern bool fts_debug; proper_name ("Paul Eggert"), \ proper_name ("Jim Meyering") -#if DU_DEBUG -# define FTS_CROSS_CHECK(Fts) fts_cross_check (Fts) -#else -# define FTS_CROSS_CHECK(Fts) -#endif - /* A set of dev/ino pairs to help identify files and directories whose sizes have already been counted. */ static struct di_set *di_files; @@ -206,7 +198,9 @@ enum EXCLUDE_OPTION, FILES0_FROM_OPTION, HUMAN_SI_OPTION, +#if GNULIB_FTS_DEBUG FTS_DEBUG, +#endif TIME_OPTION, TIME_STYLE_OPTION, INODES_OPTION @@ -219,7 +213,9 @@ static struct option const long_options[] = {"block-size", required_argument, nullptr, 'B'}, {"bytes", no_argument, nullptr, 'b'}, {"count-links", no_argument, nullptr, 'l'}, - /* {"-debug", no_argument, nullptr, FTS_DEBUG}, */ +#if GNULIB_FTS_DEBUG + {"-debug", no_argument, nullptr, FTS_DEBUG}, +#endif {"dereference", no_argument, nullptr, 'L'}, {"dereference-args", no_argument, nullptr, 'D'}, {"exclude", required_argument, nullptr, EXCLUDE_OPTION}, @@ -686,7 +682,11 @@ du_files (char **files, int bit_flags) prev_level = 0; break; } - FTS_CROSS_CHECK (fts); + +#if GNULIB_FTS_DEBUG + if (fts_debug) + fts_cross_check (fts); +#endif ok &= process_file (fts, ent); } @@ -745,7 +745,7 @@ main (int argc, char **argv) switch (c) { -#if DU_DEBUG +#if GNULIB_FTS_DEBUG case FTS_DEBUG: fts_debug = true; break;