On Tue, May 14, 2024 at 9:06 AM James Youngman <ja...@youngman.org> wrote:
> See attached patches. If no objections, I will submit these soon. > > >
From ab0137eff33dcb09b1d108d99e3549fb1e5d38a6 Mon Sep 17 00:00:00 2001 From: James Youngman <ja...@youngman.org> Date: Mon, 13 May 2024 21:37:05 +0100 Subject: [PATCH 2/3] Rename is_fts_enabled() to is_fts_cwdfd_enabled(). To: findutils-patc...@gnu.org This simplifies the caller. FTS is always enabled. Remove some now-unused variables. --- find/defs.h | 2 +- find/ftsfind.c | 6 ++---- find/parser.c | 35 ++++++++--------------------------- 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/find/defs.h b/find/defs.h index b00e5d23..ee309e0a 100644 --- a/find/defs.h +++ b/find/defs.h @@ -336,7 +336,7 @@ struct predicate }; /* ftsfind.c */ -bool is_fts_enabled(int *ftsoptions); +bool is_fts_cwdfd_enabled(void); /* find library function declarations. */ diff --git a/find/ftsfind.c b/find/ftsfind.c index 4a4d964f..b7f69a0f 100644 --- a/find/ftsfind.c +++ b/find/ftsfind.c @@ -825,9 +825,7 @@ main (int argc, char **argv) } bool -is_fts_enabled (int *fts_options) +is_fts_cwdfd_enabled (void) { - /* this version of find (i.e. this main()) uses fts. */ - *fts_options = ftsoptions; - return true; + return ftsoptions & FTS_CWDFD; } diff --git a/find/parser.c b/find/parser.c index 51bb5c5e..efa2f41f 100644 --- a/find/parser.c +++ b/find/parser.c @@ -33,7 +33,6 @@ /* gnulib headers. */ #include "fnmatch.h" -#include "fts_.h" #include "intprops.h" #include "modechange.h" #include "mountlist.h" @@ -52,7 +51,7 @@ /* At the moment, we include this after gnulib headers, since it uses some of the same names for function attribute macros as gnulib does, - since I plan to make gcc-sttrigbutes a gnulib module. However, for + since I plan to make gcc-attributes a gnulib module. However, for now, I haven't made the wholesale edits to gnulib that this would require. Including this file last simply minimises the number of compiler warnings about macro redefinition (in gnulib headers). @@ -2417,59 +2416,41 @@ parse_user (const struct parser_table* entry, char **argv, int *arg_ptr) static bool parse_version (const struct parser_table* entry, char **argv, int *arg_ptr) { - bool has_features = false; - int flags; - + (void) entry; (void) argv; (void) arg_ptr; - (void) entry; display_findutils_version ("find"); printf (_("Features enabled: ")); #if CACHE_IDS printf ("CACHE_IDS(ignored) "); - has_features = true; #endif #if defined HAVE_STRUCT_DIRENT_D_TYPE printf ("D_TYPE "); - has_features = true; #endif #if defined O_NOFOLLOW printf ("O_NOFOLLOW(%s) ", (options.open_nofollow_available ? "enabled" : "disabled")); - has_features = true; #endif #if defined LEAF_OPTIMISATION printf ("LEAF_OPTIMISATION "); - has_features = true; #endif if (0 < is_selinux_enabled ()) { printf ("SELINUX "); - has_features = true; } - flags = 0; - if (is_fts_enabled (&flags)) + if (is_fts_cwdfd_enabled ()) { - printf ("FTS("); - has_features = true; - - if (flags & FTS_CWDFD) - printf ("FTS_CWDFD"); - printf (") "); + printf ("FTS(FTS_CWDFD) "); } - - printf ("CBO(level=%d) ", (int)(options.optimisation_level)); - has_features = true; - - if (!has_features) + else { - /* For the moment, leave this as English in case someone wants - to parse these strings. */ - printf ("none"); + printf ("FTS() "); } + + printf ("CBO(level=%d) ", (int)(options.optimisation_level)); printf ("\n"); exit (EXIT_SUCCESS); -- 2.39.2