From 6b935180075f90fa1ebe701169cdabab8a488fd3 Mon Sep 17 00:00:00 2001 From: James Youngman Date: Mon, 5 Apr 2010 20:52:45 +0100 Subject: [PATCH 2/2] Use bool instead of the previous typedef boolean. To: address@hidden * find/defs.h: Don't create typedef "boolean"; use the standard type bool. Update other declarations accordingly. * find/find.c: Update declarations and function definitions to use bool. * find/ftsfind.c: Likewise. * find/parser.c: Likewise. * find/pred.c: Likewise. * find/tree.c: Likewise. * find/util.c: Likewise. * locate/locate.c: Likewise. * xargs/xargs.c: Likewise. Signed-off-by: James Youngman --- ChangeLog | 15 +++ find/defs.h | 88 +++++++------- find/find.c | 32 +++--- find/ftsfind.c | 4 +- find/parser.c | 374 +++++++++++++++++++++++++++--------------------------- find/pred.c | 152 +++++++++++----------- find/tree.c | 29 +++-- find/util.c | 22 ++-- locate/locate.c | 4 +- xargs/xargs.c | 34 +++--- 10 files changed, 381 insertions(+), 373 deletions(-) diff --git a/ChangeLog b/ChangeLog index aac7221..d044174 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-04-05 James Youngman + + Use bool instead of the previous typedef boolean. + * find/defs.h: Don't create typedef "boolean"; use the standard + type bool. Update other declarations accordingly. + * find/find.c: Update declarations and function definitions to use + bool. + * find/ftsfind.c: Likewise. + * find/parser.c: Likewise. + * find/pred.c: Likewise. + * find/tree.c: Likewise. + * find/util.c: Likewise. + * locate/locate.c: Likewise. + * xargs/xargs.c: Likewise. + 2010-04-05 Jim Meyering frcode: avoid link failure due to multiple program_name definition diff --git a/find/defs.h b/find/defs.h index 2d1d825..f0750da 100644 --- a/find/defs.h +++ b/find/defs.h @@ -45,7 +45,7 @@ Please stop compiling the program now #include #include #include /* for CHAR_BIT */ -#include /* for bool/boolean */ +#include /* for bool */ #include /* for uintmax_t */ #include /* S_ISUID etc. */ #include @@ -58,8 +58,6 @@ Please stop compiling the program now # include -typedef bool boolean; - #include "regex.h" #include "timespec.h" #include "buildcmd.h" @@ -97,7 +95,7 @@ struct predicate; struct options; /* Pointer to a predicate function. */ -typedef boolean (*PRED_FUNC)(const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr); +typedef bool (*PRED_FUNC)(const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr); /* The number of seconds in a day. */ #define DAYSECS 86400 @@ -141,7 +139,7 @@ enum predicate_precedence struct long_val { enum comparison_type kind; - boolean negative; /* Defined only when representing time_t. */ + bool negative; /* Defined only when representing time_t. */ uintmax_t l_val; }; @@ -191,13 +189,13 @@ struct time_val struct exec_val { - boolean multiple; /* -exec {} \+ denotes multiple argument. */ + bool multiple; /* -exec {} \+ denotes multiple argument. */ struct buildcmd_control ctl; struct buildcmd_state state; char **replace_vec; /* Command arguments (for ";" style) */ int num_args; - boolean use_current_dir; /* If nonzero, don't chdir to start dir */ - boolean close_stdin; /* If true, close stdin in the child. */ + bool use_current_dir; /* If nonzero, don't chdir to start dir */ + bool close_stdin; /* If true, close stdin in the child. */ int dir_fd; /* The directory to do the exec in. */ int last_child_status; /* Status of the most recent child. */ }; @@ -229,7 +227,7 @@ struct format_val struct segment *segment; /* Linked list of segments. */ FILE *stream; /* Output stream to print on. */ const char *filename; /* We need the filename for error messages. */ - boolean dest_is_tty; /* True if the destination is a terminal. */ + bool dest_is_tty; /* True if the destination is a terminal. */ struct quoting_options *quote_opts; }; @@ -277,19 +275,19 @@ struct predicate /* True if this predicate node produces side effects. If side_effects are produced then optimization will not be performed */ - boolean side_effects; + bool side_effects; /* True if this predicate node requires default print be turned off. */ - boolean no_default_print; + bool no_default_print; /* True if this predicate node requires a stat system call to execute. */ - boolean need_stat; + bool need_stat; /* True if this predicate node requires knowledge of the file type. */ - boolean need_type; + bool need_type; /* True if this predicate node requires knowledge of the inode number. */ - boolean need_inum; + bool need_inum; enum EvaluationCost p_cost; @@ -297,10 +295,10 @@ struct predicate float est_success_rate; /* True if this predicate should display control characters literally */ - boolean literal_control_chars; + bool literal_control_chars; /* True if this predicate didn't originate from the user. */ - boolean artificial; + bool artificial; /* The raw text of the argument of this predicate. */ const char *arg_text; @@ -341,7 +339,7 @@ struct predicate }; /* find.c, ftsfind.c */ -boolean is_fts_enabled(int *ftsoptions); +bool is_fts_enabled(int *ftsoptions); int get_start_dirfd(void); int get_current_dirfd(void); @@ -385,8 +383,8 @@ enum arg_type struct parser_table; /* Pointer to a parser function. */ -typedef boolean (*PARSE_FUNC)(const struct parser_table *p, - char *argv[], int *arg_ptr); +typedef bool (*PARSE_FUNC)(const struct parser_table *p, + char *argv[], int *arg_ptr); struct parser_table { enum arg_type type; @@ -397,17 +395,17 @@ struct parser_table /* parser.c */ const struct parser_table* find_parser PARAMS((char *search_name)); -boolean parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +bool parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); void pred_sanity_check PARAMS((const struct predicate *predicates)); void check_option_combinations (const struct predicate *p); void parse_begin_user_args PARAMS((char **args, int argno, const struct predicate *last, const struct predicate *predicates)); void parse_end_user_args PARAMS((char **args, int argno, const struct predicate *last, const struct predicate *predicates)); -boolean parse_openparen PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr)); -boolean parse_closeparen PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr)); +bool parse_openparen PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr)); +bool parse_closeparen PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr)); /* pred.c */ -typedef boolean PREDICATEFUNCTION(const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr); +typedef bool PREDICATEFUNCTION(const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr); PREDICATEFUNCTION pred_amin; PREDICATEFUNCTION pred_and; PREDICATEFUNCTION pred_anewer; @@ -485,7 +483,7 @@ void show_success_rates(const struct predicate *node); /* tree.c */ -boolean matches_start_point(const char * glob, boolean foldcase); +bool matches_start_point(const char * glob, bool foldcase); struct predicate * build_expression_tree PARAMS((int argc, char *argv[], int end_of_leading_options)); struct predicate * get_eval_tree PARAMS((void)); struct predicate *get_new_pred_noarg (const struct parser_table *entry); @@ -495,12 +493,12 @@ struct predicate *get_new_pred_chk_op PARAMS((const struct parser_table *entry, float calculate_derived_rates PARAMS((struct predicate *p)); /* util.c */ -boolean fd_leak_check_is_enabled (void); +bool fd_leak_check_is_enabled (void); struct predicate *insert_primary PARAMS((const struct parser_table *entry, const char *arg)); struct predicate *insert_primary_noarg PARAMS((const struct parser_table *entry)); struct predicate *insert_primary_withpred PARAMS((const struct parser_table *entry, PRED_FUNC fptr, const char *arg)); void usage PARAMS((FILE *fp, int status, char *msg)); -extern boolean check_nofollow(void); +extern bool check_nofollow(void); void complete_pending_execs(struct predicate *p); void complete_pending_execdirs(int dir_fd); /* Passing dir_fd is an unpleasant CodeSmell. */ const char *safely_quote_err_filename (int n, char const *arg); @@ -514,7 +512,7 @@ void set_option_defaults PARAMS((struct options *p)); #define apply_predicate(pathname, stat_buf_ptr, node) \ (*(node)->pred_func)((pathname), (stat_buf_ptr), (node)) #else -boolean apply_predicate(const char *pathname, struct stat *stat_buf, struct predicate *p); +bool apply_predicate(const char *pathname, struct stat *stat_buf, struct predicate *p); #endif #define pred_is(node, fn) ( ((node)->pred_func) == (fn) ) @@ -522,10 +520,10 @@ boolean apply_predicate(const char *pathname, struct stat *stat_buf, struct pred /* find.c. */ int get_info PARAMS((const char *pathname, struct stat *p, struct predicate *pred_ptr)); -boolean following_links PARAMS((void)); -boolean digest_mode PARAMS((mode_t *mode, const char *pathname, const char *name, struct stat *pstat, boolean leaf)); -boolean default_prints PARAMS((struct predicate *pred)); -boolean looks_like_expression PARAMS((const char *arg, boolean leading)); +bool following_links PARAMS((void)); +bool digest_mode PARAMS((mode_t *mode, const char *pathname, const char *name, struct stat *pstat, bool leaf)); +bool default_prints PARAMS((struct predicate *pred)); +bool looks_like_expression PARAMS((const char *arg, bool leading)); enum DebugOption @@ -543,11 +541,11 @@ enum DebugOption struct options { /* If true, process directory before contents. True unless -depth given. */ - boolean do_dir_first; + bool do_dir_first; /* If true, -depth was EXPLICITLY set (as opposed to having been turned * on by -delete, for example). */ - boolean explicit_depth; + bool explicit_depth; /* If >=0, don't descend more than this many levels of subdirectories. */ int maxdepth; @@ -557,30 +555,30 @@ struct options /* If true, do not assume that files in directories with nlink == 2 are non-directories. */ - boolean no_leaf_check; + bool no_leaf_check; /* If true, don't cross filesystem boundaries. */ - boolean stay_on_filesystem; + bool stay_on_filesystem; /* If true, we ignore the problem where we find that a directory entry * no longer exists by the time we get around to processing it. */ - boolean ignore_readdir_race; + bool ignore_readdir_race; /* If true, pass control characters through. If false, escape them * or turn them into harmless things. */ - boolean literal_control_chars; + bool literal_control_chars; /* If true, we issue warning messages */ - boolean warnings; + bool warnings; /* If true, avoid POSIX-incompatible behaviours * (this functionality is currently incomplete * and at the moment affects mainly warning messages). */ - boolean posixly_correct; + bool posixly_correct; struct timespec start_time; /* Time at start of execution. */ @@ -588,7 +586,7 @@ struct options struct timespec cur_day_start; /* If true, cur_day_start has been adjusted to the start of the day. */ - boolean full_days; + bool full_days; int output_block_size; /* Output block size. */ @@ -605,7 +603,7 @@ struct options /* Indicate if we can implement safely_chdir() using the O_NOFOLLOW * flag to open(2). */ - boolean open_nofollow_available; + bool open_nofollow_available; /* The variety of regular expression that we support. * The default is POSIX Basic Regular Expressions, but this @@ -634,10 +632,10 @@ struct state int curdepth; /* If true, we have called stat on the current path. */ - boolean have_stat; + bool have_stat; /* If true, we know the type of the current path. */ - boolean have_type; + bool have_type; mode_t type; /* this is the actual type */ /* The file being operated on, relative to the current directory. @@ -653,7 +651,7 @@ struct state /* If true, don't descend past current directory. Can be set by -prune, -maxdepth, and -xdev/-mount. */ - boolean stop_at_current_level; + bool stop_at_current_level; /* Status value to return to system. */ int exit_status; @@ -662,7 +660,7 @@ struct state * calls for every directory we leave if it is false. This is just * an optimisation. Set to true if you want to be conservative. */ - boolean execdirs_outstanding; + bool execdirs_outstanding; /* Shared files, opened via the interface in sharefile.h. */ sharefile_handle shared_files; diff --git a/find/find.c b/find/find.c index cc67c96..f5be91d 100644 --- a/find/find.c +++ b/find/find.c @@ -76,7 +76,7 @@ static void init_mounted_dev_list (int mandatory); #endif static void process_top_path PARAMS((char *pathname, mode_t mode)); -static int process_path PARAMS((char *pathname, char *name, boolean leaf, char *parent, mode_t type)); +static int process_path PARAMS((char *pathname, char *name, bool leaf, char *parent, mode_t type)); static void process_dir PARAMS((char *pathname, char *name, int pathlen, const struct stat *statp, char *parent)); @@ -245,7 +245,7 @@ main (int argc, char **argv) return state.exit_status; } -boolean is_fts_enabled (int *ftsoptions) +bool is_fts_enabled (int *ftsoptions) { /* this version of find (i.e. this main ()) does not use fts. */ *ftsoptions = 0; @@ -451,7 +451,7 @@ dirchange_is_fatal (const char *specific_what, * Hence we print a warning message to indicate that the output of find * might be inconsistent due to the change in the file system. */ -static boolean +static bool wd_sanity_check (const char *thing_to_stat, const char *progname, const char *what, @@ -462,7 +462,7 @@ wd_sanity_check (const char *thing_to_stat, int line_no, enum TraversalDirection direction, enum WdSanityCheckFatality isfatal, - boolean *changed) /* output parameter */ + bool *changed) /* output parameter */ { const char *fstype; char *specific_what = NULL; @@ -579,13 +579,13 @@ safely_chdir_lstat (const char *dest, enum TraversalDirection direction, struct stat *statbuf_dest, enum ChdirSymlinkHandling symlink_follow_option, - boolean *did_stat) + bool *did_stat) { struct stat statbuf_arrived; int rv, dotfd=-1; int saved_errno; /* specific_dirname() changes errno. */ - boolean rv_set = false; - boolean statflag = false; + bool rv_set = false; + bool statflag = false; int tries = 0; enum WdSanityCheckFatality isfatal = RETRY_IF_SANITY_CHECK_FAILS; @@ -676,7 +676,7 @@ safely_chdir_lstat (const char *dest, if (0 == chdir (dest)) { /* check we ended up where we wanted to go */ - boolean changed = false; + bool changed = false; if (!wd_sanity_check (".", program_name, ".", statbuf_dest->st_dev, statbuf_dest->st_ino, @@ -804,7 +804,7 @@ safely_chdir_nofollow (const char *dest, enum TraversalDirection direction, struct stat *statbuf_dest, enum ChdirSymlinkHandling symlink_follow_option, - boolean *did_stat) + bool *did_stat) { int extraflags, fd; @@ -883,7 +883,7 @@ safely_chdir (const char *dest, enum TraversalDirection direction, struct stat *statbuf_dest, enum ChdirSymlinkHandling symlink_follow_option, - boolean *did_stat) + bool *did_stat) { enum SafeChdirStatus result; @@ -928,7 +928,7 @@ static void chdir_back (void) { struct stat stat_buf; - boolean dummy; + bool dummy; if (starting_desc < 0) { @@ -999,7 +999,7 @@ at_top (char *pathname, enum TraversalDirection direction; enum SafeChdirStatus chdir_status; struct stat st; - boolean did_stat = false; + bool did_stat = false; dirchange = 1; if (0 == strcmp (base, "..")) @@ -1169,7 +1169,7 @@ issue_loop_warning (const char *name, const char *pathname, int level) Return nonzero iff PATHNAME is a directory. */ static int -process_path (char *pathname, char *name, boolean leaf, char *parent, +process_path (char *pathname, char *name, bool leaf, char *parent, mode_t mode) { struct stat stat_buf; @@ -1288,7 +1288,7 @@ static void process_dir (char *pathname, char *name, int pathlen, const struct stat *statp, char *parent) { int subdirs_left; /* Number of unexamined subdirs in PATHNAME. */ - boolean subdirs_unreliable; /* if true, cannot use dir link count as subdir limif (if false, it may STILL be unreliable) */ + bool subdirs_unreliable; /* if true, cannot use dir link count as subdir limif (if false, it may STILL be unreliable) */ unsigned int idx; /* Which entry are we on? */ struct stat stat_buf; size_t dircount = 0u; @@ -1329,7 +1329,7 @@ process_dir (char *pathname, char *name, int pathlen, const struct stat *statp, unsigned cur_path_size; /* Bytes allocated for `cur_path'. */ register unsigned file_len; /* Length of each path to process. */ register unsigned pathname_len; /* PATHLEN plus trailing '/'. */ - boolean did_stat = false; + bool did_stat = false; if (pathname[pathlen - 1] == '/') pathname_len = pathlen + 1; /* For '\0'; already have '/'. */ @@ -1490,7 +1490,7 @@ process_dir (char *pathname, char *name, int pathlen, const struct stat *statp, /* We could go back and do the next command-line arg instead, maybe using longjmp. */ char const *dir; - boolean deref = following_links () ? true : false; + bool deref = following_links () ? true : false; if ( (state.curdepth>0) && !deref) dir = ".."; diff --git a/find/ftsfind.c b/find/ftsfind.c index c3681f6..d909579 100644 --- a/find/ftsfind.c +++ b/find/ftsfind.c @@ -303,7 +303,7 @@ issue_loop_warning (FTSENT * ent) * rm -f a b; ln -s a b; ln -s b a * produces such a loop. */ -static boolean +static bool symlink_loop (const char *name) { struct stat stbuf; @@ -784,7 +784,7 @@ main (int argc, char **argv) return state.exit_status; } -boolean +bool is_fts_enabled (int *fts_options) { /* this version of find (i.e. this main()) uses fts. */ diff --git a/find/parser.c b/find/parser.c index 2ea3126..bb09ed0 100644 --- a/find/parser.c +++ b/find/parser.c @@ -85,91 +85,91 @@ #define endpwent () #endif -static boolean parse_accesscheck PARAMS((const struct parser_table* entry, char **argv, int *arg_ptr)); -static boolean parse_amin PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_and PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_anewer PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_cmin PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_cnewer PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_comma PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_daystart PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_delete PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_d PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_depth PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_empty PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_exec PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_execdir PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_false PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_fls PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_fprintf PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_follow PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_fprint PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_fprint0 PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_fstype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_gid PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_group PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_help PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_ilname PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_iname PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_inum PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_ipath PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_iregex PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_iwholename PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_links PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_lname PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_ls PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_maxdepth PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_mindepth PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_mmin PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_name PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_negate PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_newer PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_newerXY PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_noleaf PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_nogroup PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_nouser PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_nowarn PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_ok PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_okdir PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_or PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_path PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_perm PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_print0 PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_printf PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_prune PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_regex PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_regextype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_samefile PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_accesscheck PARAMS((const struct parser_table* entry, char **argv, int *arg_ptr)); +static bool parse_amin PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_and PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_anewer PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_cmin PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_cnewer PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_comma PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_daystart PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_delete PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_d PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_depth PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_empty PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_exec PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_execdir PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_false PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_fls PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_fprintf PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_follow PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_fprint PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_fprint0 PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_fstype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_gid PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_group PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_help PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_ilname PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_iname PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_inum PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_ipath PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_iregex PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_iwholename PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_links PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_lname PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_ls PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_maxdepth PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_mindepth PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_mmin PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_name PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_negate PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_newer PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_newerXY PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_noleaf PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_nogroup PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_nouser PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_nowarn PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_ok PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_okdir PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_or PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_path PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_perm PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_print0 PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_printf PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_prune PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_regex PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_regextype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_samefile PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); #if 0 -static boolean parse_show_control_chars PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_show_control_chars PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); #endif -static boolean parse_size PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_time PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_true PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_type PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_uid PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_used PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_user PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_version PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_wholename PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_xdev PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_ignore_race PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_noignore_race PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_warn PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_xtype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_quit PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); -static boolean parse_context PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); - -boolean parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); - - -static boolean insert_type PARAMS((char **argv, int *arg_ptr, +static bool parse_size PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_time PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_true PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_type PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_uid PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_used PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_user PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_version PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_wholename PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_xdev PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_ignore_race PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_noignore_race PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_warn PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_xtype PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_quit PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); +static bool parse_context PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); + +bool parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr)); + + +static bool insert_type PARAMS((char **argv, int *arg_ptr, const struct parser_table *entry, PRED_FUNC which_pred)); -static boolean insert_regex PARAMS((char *argv[], int *arg_ptr, +static bool insert_regex PARAMS((char *argv[], int *arg_ptr, const struct parser_table *entry, int regex_options)); -static boolean insert_fprintf (struct format_val *vec, +static bool insert_fprintf (struct format_val *vec, const struct parser_table *entry, PRED_FUNC func, const char *format); @@ -179,27 +179,27 @@ static struct segment **make_segment PARAMS((struct segment **segment, int kind, char format_char, char aux_format_char, struct predicate *pred)); -static boolean insert_exec_ok PARAMS((const char *action, +static bool insert_exec_ok PARAMS((const char *action, const struct parser_table *entry, int dir_fd, char *argv[], int *arg_ptr)); -static boolean get_comp_type PARAMS((const char **str, +static bool get_comp_type PARAMS((const char **str, enum comparison_type *comp_type)); -static boolean get_relative_timestamp PARAMS((const char *str, +static bool get_relative_timestamp PARAMS((const char *str, struct time_val *tval, struct timespec origin, double sec_per_unit, const char *overflowmessage)); -static boolean get_num PARAMS((const char *str, +static bool get_num PARAMS((const char *str, uintmax_t *num, enum comparison_type *comp_type)); static struct predicate* insert_num PARAMS((char *argv[], int *arg_ptr, const struct parser_table *entry)); static void open_output_file (const char *path, struct format_val *p); static void open_stdout (struct format_val *p); -static boolean stream_is_tty(FILE *fp); -static boolean parse_noop PARAMS((const struct parser_table* entry, +static bool stream_is_tty(FILE *fp); +static bool parse_noop PARAMS((const struct parser_table* entry, char **argv, int *arg_ptr)); #define PASTE(x,y) x##y @@ -712,7 +712,7 @@ estimate_timestamp_success_rate (time_t when) /* Collect an argument from the argument list, or * return false. */ -static boolean +static bool collect_arg (char **argv, int *arg_ptr, const char **collected_arg) { if ((argv == NULL) || (argv[*arg_ptr] == NULL)) @@ -728,7 +728,7 @@ collect_arg (char **argv, int *arg_ptr, const char **collected_arg) } } -static boolean +static bool collect_arg_stat_info (char **argv, int *arg_ptr, struct stat *p, const char **argument) { @@ -763,7 +763,7 @@ collect_arg_stat_info (char **argv, int *arg_ptr, struct stat *p, The predicate structure is updated with the new information. */ -static boolean +static bool parse_and (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -779,7 +779,7 @@ parse_and (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_anewer (const struct parser_table* entry, char **argv, int *arg_ptr) { struct stat stat_newer; @@ -798,7 +798,7 @@ parse_anewer (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -boolean +bool parse_closeparen (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -814,7 +814,7 @@ parse_closeparen (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_cnewer (const struct parser_table* entry, char **argv, int *arg_ptr) { struct stat stat_newer; @@ -833,7 +833,7 @@ parse_cnewer (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_comma (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -850,7 +850,7 @@ parse_comma (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_daystart (const struct parser_table* entry, char **argv, int *arg_ptr) { struct tm *local; @@ -873,7 +873,7 @@ parse_daystart (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_delete (const struct parser_table* entry, char *argv[], int *arg_ptr) { struct predicate *our_pred; @@ -894,7 +894,7 @@ parse_delete (const struct parser_table* entry, char *argv[], int *arg_ptr) return true; } -static boolean +static bool parse_depth (const struct parser_table* entry, char **argv, int *arg_ptr) { (void) entry; @@ -905,7 +905,7 @@ parse_depth (const struct parser_table* entry, char **argv, int *arg_ptr) return parse_noop (entry, argv, arg_ptr); } -static boolean +static bool parse_d (const struct parser_table* entry, char **argv, int *arg_ptr) { if (options.warnings) @@ -918,7 +918,7 @@ parse_d (const struct parser_table* entry, char **argv, int *arg_ptr) return parse_depth (entry, argv, arg_ptr); } -static boolean +static bool parse_empty (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -930,19 +930,19 @@ parse_empty (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_exec (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_exec_ok ("-exec", entry, get_start_dirfd (), argv, arg_ptr); } -static boolean +static bool parse_execdir (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_exec_ok ("-execdir", entry, -1, argv, arg_ptr); } -static boolean +static bool insert_false(void) { struct predicate *our_pred; @@ -957,13 +957,13 @@ insert_false(void) } -static boolean +static bool parse_false (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_false (); } -static boolean +static bool insert_fls (const struct parser_table* entry, const char *filename) { struct predicate *our_pred = insert_primary_noarg (entry); @@ -977,7 +977,7 @@ insert_fls (const struct parser_table* entry, const char *filename) } -static boolean +static bool parse_fls (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *filename; @@ -991,14 +991,14 @@ parse_fls (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_follow (const struct parser_table* entry, char **argv, int *arg_ptr) { set_follow_state (SYMLINK_ALWAYS_DEREF); return parse_noop (entry, argv, arg_ptr); } -static boolean +static bool parse_fprint (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -1018,7 +1018,7 @@ parse_fprint (const struct parser_table* entry, char **argv, int *arg_ptr) } } -static boolean +static bool insert_fprint (const struct parser_table* entry, const char *filename) { struct predicate *our_pred = insert_primary (entry, filename); @@ -1033,7 +1033,7 @@ insert_fprint (const struct parser_table* entry, const char *filename) } -static boolean +static bool parse_fprint0 (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *filename; @@ -1065,7 +1065,7 @@ static float estimate_fstype_success_rate (const char *fsname) -static boolean +static bool is_used_fs_type(const char *name) { if (0 == strcmp("afs", name)) @@ -1095,7 +1095,7 @@ is_used_fs_type(const char *name) } -static boolean +static bool parse_fstype (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *typename; @@ -1135,7 +1135,7 @@ parse_fstype (const struct parser_table* entry, char **argv, int *arg_ptr) } } -static boolean +static bool parse_gid (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *p = insert_num (argv, arg_ptr, entry); @@ -1152,7 +1152,7 @@ parse_gid (const struct parser_table* entry, char **argv, int *arg_ptr) } -static boolean +static bool parse_group (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *groupname; @@ -1216,7 +1216,7 @@ parse_group (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_help (const struct parser_table* entry, char **argv, int *arg_ptr) { (void) entry; @@ -1274,7 +1274,7 @@ estimate_pattern_match_rate (const char *pattern, int is_regex) } } -static boolean +static bool parse_ilname (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *name; @@ -1298,10 +1298,10 @@ parse_ilname (const struct parser_table* entry, char **argv, int *arg_ptr) /* sanity check the fnmatch() function to make sure that case folding * is supported (as opposed to just having the flag ignored). */ -static boolean +static bool fnmatch_sanitycheck (void) { - static boolean checked = false; + static bool checked = false; if (!checked) { if (0 != fnmatch ("foo", "foo", 0) @@ -1318,7 +1318,7 @@ fnmatch_sanitycheck (void) } -static boolean +static bool check_name_arg (const char *pred, const char *arg) { if (options.warnings && strchr (arg, '/')) @@ -1339,7 +1339,7 @@ check_name_arg (const char *pred, const char *arg) -static boolean +static bool parse_iname (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *name; @@ -1358,7 +1358,7 @@ parse_iname (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_inum (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *p = insert_num (argv, arg_ptr, entry); @@ -1380,13 +1380,13 @@ parse_inum (const struct parser_table* entry, char **argv, int *arg_ptr) } } -static boolean +static bool parse_iregex (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_regex (argv, arg_ptr, entry, RE_ICASE|options.regex_options); } -static boolean +static bool parse_links (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *p = insert_num (argv, arg_ptr, entry); @@ -1407,7 +1407,7 @@ parse_links (const struct parser_table* entry, char **argv, int *arg_ptr) } } -static boolean +static bool parse_lname (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *name; @@ -1422,7 +1422,7 @@ parse_lname (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_ls (const struct parser_table* entry, char **argv, int *arg_ptr) { (void) &argv; @@ -1430,7 +1430,7 @@ parse_ls (const struct parser_table* entry, char **argv, int *arg_ptr) return insert_fls (entry, NULL); } -static boolean +static bool insert_depthspec (const struct parser_table* entry, char **argv, int *arg_ptr, int *limitptr) { @@ -1460,20 +1460,20 @@ insert_depthspec (const struct parser_table* entry, char **argv, int *arg_ptr, } -static boolean +static bool parse_maxdepth (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_depthspec (entry, argv, arg_ptr, &options.maxdepth); } -static boolean +static bool parse_mindepth (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_depthspec (entry, argv, arg_ptr, &options.mindepth); } -static boolean +static bool do_parse_xmin (const struct parser_table* entry, char **argv, int *arg_ptr, @@ -1505,26 +1505,26 @@ do_parse_xmin (const struct parser_table* entry, } return false; } -static boolean +static bool parse_amin (const struct parser_table* entry, char **argv, int *arg_ptr) { return do_parse_xmin (entry, argv, arg_ptr, XVAL_ATIME); } -static boolean +static bool parse_cmin (const struct parser_table* entry, char **argv, int *arg_ptr) { return do_parse_xmin (entry, argv, arg_ptr, XVAL_CTIME); } -static boolean +static bool parse_mmin (const struct parser_table* entry, char **argv, int *arg_ptr) { return do_parse_xmin (entry, argv, arg_ptr, XVAL_MTIME); } -static boolean +static bool parse_name (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *name; @@ -1549,7 +1549,7 @@ parse_name (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_negate (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -1565,7 +1565,7 @@ parse_negate (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_newer (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -1586,7 +1586,7 @@ parse_newer (const struct parser_table* entry, char **argv, int *arg_ptr) } -static boolean +static bool parse_newerXY (const struct parser_table* entry, char **argv, int *arg_ptr) { (void) argv; @@ -1706,7 +1706,7 @@ parse_newerXY (const struct parser_table* entry, char **argv, int *arg_ptr) } -static boolean +static bool parse_noleaf (const struct parser_table* entry, char **argv, int *arg_ptr) { options.no_leaf_check = true; @@ -1729,7 +1729,7 @@ char *gid_unused = NULL; unsigned gid_allocated; #endif -static boolean +static bool parse_nogroup (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -1766,7 +1766,7 @@ parse_nogroup (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_nouser (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -1803,26 +1803,26 @@ parse_nouser (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_nowarn (const struct parser_table* entry, char **argv, int *arg_ptr) { options.warnings = false; return parse_noop (entry, argv, arg_ptr); } -static boolean +static bool parse_ok (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_exec_ok ("-ok", entry, get_start_dirfd (), argv, arg_ptr); } -static boolean +static bool parse_okdir (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_exec_ok ("-okdir", entry, -1, argv, arg_ptr); } -boolean +bool parse_openparen (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -1838,7 +1838,7 @@ parse_openparen (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_or (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -1854,8 +1854,8 @@ parse_or (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean -is_feasible_path_argument (const char *arg, boolean foldcase) +static bool +is_feasible_path_argument (const char *arg, bool foldcase) { const char *last = strrchr (arg, '/'); if (last && !last[1]) @@ -1875,12 +1875,12 @@ is_feasible_path_argument (const char *arg, boolean foldcase) } -static boolean +static bool insert_path_check (const struct parser_table* entry, char **argv, int *arg_ptr, const char *pred_name, PREDICATEFUNCTION pred) { const char *name; - boolean foldcase = false; + bool foldcase = false; if (pred == pred_ipath) foldcase = true; @@ -1917,13 +1917,13 @@ insert_path_check (const struct parser_table* entry, char **argv, int *arg_ptr, * (a) HPUX find supports this predicate also and * (b) it will soon be in POSIX anyway. */ -static boolean +static bool parse_path (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_path_check (entry, argv, arg_ptr, "path", pred_path); } -static boolean +static bool parse_wholename (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_path_check (entry, argv, arg_ptr, "wholename", pred_path); @@ -1935,13 +1935,13 @@ parse_wholename (const struct parser_table* entry, char **argv, int *arg_ptr) * of the phrase "file name" to "path name". * However, -path is now standardised so I un-deprecated -ipath. */ -static boolean +static bool parse_ipath (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_path_check (entry, argv, arg_ptr, "ipath", pred_ipath); } -static boolean +static bool parse_iwholename (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_path_check (entry, argv, arg_ptr, "iwholename", pred_ipath); @@ -1959,13 +1959,13 @@ non_posix_mode (const char *mode) } -static boolean +static bool parse_perm (const struct parser_table* entry, char **argv, int *arg_ptr) { mode_t perm_val[2]; float rate; int mode_start = 0; - boolean havekind = false; + bool havekind = false; enum permissions_type kind = PERM_EXACT; struct mode_change *change = NULL; struct predicate *our_pred; @@ -2097,7 +2097,7 @@ parse_perm (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -boolean +bool parse_print (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -2115,13 +2115,13 @@ parse_print (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_print0 (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_fprint (entry, NULL); } -static boolean +static bool parse_printf (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *format; @@ -2144,7 +2144,7 @@ parse_printf (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_fprintf (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *format, *filename; @@ -2166,7 +2166,7 @@ parse_fprintf (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_prune (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -2184,7 +2184,7 @@ parse_prune (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_quit (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred = insert_primary_noarg (entry); @@ -2198,7 +2198,7 @@ parse_quit (const struct parser_table* entry, char **argv, int *arg_ptr) } -static boolean +static bool parse_regextype (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *type_name; @@ -2212,13 +2212,13 @@ parse_regextype (const struct parser_table* entry, char **argv, int *arg_ptr) } -static boolean +static bool parse_regex (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_regex (argv, arg_ptr, entry, options.regex_options); } -static boolean +static bool insert_regex (char **argv, int *arg_ptr, const struct parser_table *entry, @@ -2250,7 +2250,7 @@ insert_regex (char **argv, return false; } -static boolean +static bool parse_size (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -2349,7 +2349,7 @@ our_pred = insert_primary (entry, arg); } -static boolean +static bool parse_samefile (const struct parser_table* entry, char **argv, int *arg_ptr) { /* General idea: stat the file, remember device and inode numbers. @@ -2502,7 +2502,7 @@ parse_samefile (const struct parser_table* entry, char **argv, int *arg_ptr) /* This function is commented out partly because support for it is * uneven. */ -static boolean +static bool parse_show_control_chars (const struct parser_table* entry, char **argv, int *arg_ptr) @@ -2541,7 +2541,7 @@ parse_show_control_chars (const struct parser_table* entry, #endif -static boolean +static bool parse_true (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -2555,14 +2555,14 @@ parse_true (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_noop (const struct parser_table* entry, char **argv, int *arg_ptr) { (void) entry; return parse_true (get_noop (), argv, arg_ptr); } -static boolean +static bool parse_accesscheck (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -2578,13 +2578,13 @@ parse_accesscheck (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_type (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_type (argv, arg_ptr, entry, pred_type); } -static boolean +static bool parse_uid (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *p = insert_num (argv, arg_ptr, entry); @@ -2600,7 +2600,7 @@ parse_uid (const struct parser_table* entry, char **argv, int *arg_ptr) } } -static boolean +static bool parse_used (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -2633,7 +2633,7 @@ parse_used (const struct parser_table* entry, char **argv, int *arg_ptr) } } -static boolean +static bool parse_user (const struct parser_table* entry, char **argv, int *arg_ptr) { const char *username; @@ -2684,7 +2684,7 @@ parse_user (const struct parser_table* entry, char **argv, int *arg_ptr) return false; } -static boolean +static bool parse_version (const struct parser_table* entry, char **argv, int *arg_ptr) { int features = 0; @@ -2761,7 +2761,7 @@ parse_version (const struct parser_table* entry, char **argv, int *arg_ptr) exit (EXIT_SUCCESS); } -static boolean +static bool parse_context (const struct parser_table* entry, char **argv, int *arg_ptr) { struct predicate *our_pred; @@ -2787,41 +2787,41 @@ parse_context (const struct parser_table* entry, char **argv, int *arg_ptr) return true; } -static boolean +static bool parse_xdev (const struct parser_table* entry, char **argv, int *arg_ptr) { options.stay_on_filesystem = true; return parse_noop (entry, argv, arg_ptr); } -static boolean +static bool parse_ignore_race (const struct parser_table* entry, char **argv, int *arg_ptr) { options.ignore_readdir_race = true; return parse_noop (entry, argv, arg_ptr); } -static boolean +static bool parse_noignore_race (const struct parser_table* entry, char **argv, int *arg_ptr) { options.ignore_readdir_race = false; return parse_noop (entry, argv, arg_ptr); } -static boolean +static bool parse_warn (const struct parser_table* entry, char **argv, int *arg_ptr) { options.warnings = true; return parse_noop (entry, argv, arg_ptr); } -static boolean +static bool parse_xtype (const struct parser_table* entry, char **argv, int *arg_ptr) { return insert_type (argv, arg_ptr, entry, pred_xtype); } -static boolean +static bool insert_type (char **argv, int *arg_ptr, const struct parser_table *entry, PRED_FUNC which_pred) @@ -2915,7 +2915,7 @@ insert_type (char **argv, int *arg_ptr, /* Return true if the file accessed via FP is a terminal. */ -static boolean +static bool stream_is_tty (FILE *fp) { int fd = fileno (fp); @@ -2934,7 +2934,7 @@ stream_is_tty (FILE *fp) /* XXX: do we need to pass FUNC to this function? */ -static boolean +static bool insert_fprintf (struct format_val *vec, const struct parser_table *entry, PRED_FUNC func, const char *format_const) @@ -3276,7 +3276,7 @@ check_path_safety (const char *action, char **argv) /* handles both exec and ok predicate */ -static boolean +static bool new_insert_exec_ok (const char *action, const struct parser_table *entry, int dir_fd, @@ -3286,7 +3286,7 @@ new_insert_exec_ok (const char *action, int start, end; /* Indexes in ARGV of start & end of cmd. */ int i; /* Index into cmd args */ int saw_braces; /* True if previous arg was '{}'. */ - boolean allow_plus; /* True if + is a valid terminator */ + bool allow_plus; /* True if + is a valid terminator */ int brace_count; /* Number of instances of {}. */ PRED_FUNC func = entry->pred_func; enum BC_INIT_STATUS bcstatus; @@ -3481,7 +3481,7 @@ new_insert_exec_ok (const char *action, -static boolean +static bool insert_exec_ok (const char *action, const struct parser_table *entry, int dir_fd, @@ -3506,7 +3506,7 @@ insert_exec_ok (const char *action, Used by -atime, -ctime and -mtime (parsers) to get the appropriate information for a time predicate processor. */ -static boolean +static bool get_relative_timestamp (const char *str, struct time_val *result, struct timespec origin, @@ -3583,7 +3583,7 @@ get_relative_timestamp (const char *str, Used by -atime, -ctime, and -mtime parsers. */ -static boolean +static bool parse_time (const struct parser_table* entry, char *argv[], int *arg_ptr) { struct predicate *our_pred; @@ -3666,7 +3666,7 @@ parse_time (const struct parser_table* entry, char *argv[], int *arg_ptr) Advance *STR beyond any initial comparison prefix. Return true if all okay, false if input error. */ -static boolean +static bool get_comp_type (const char **str, enum comparison_type *comp_type) { switch (**str) @@ -3700,7 +3700,7 @@ get_comp_type (const char **str, enum comparison_type *comp_type) Return true if all okay, false if input error. */ -static boolean +static bool get_num (const char *str, uintmax_t *num, enum comparison_type *comp_type) diff --git a/find/pred.c b/find/pred.c index 7df37b1..6850372 100644 --- a/find/pred.c +++ b/find/pred.c @@ -162,7 +162,7 @@ #undef MAX #define MAX(a, b) ((a) > (b) ? (a) : (b)) -static boolean match_lname PARAMS((const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr, boolean ignore_case)); +static bool match_lname PARAMS((const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr, bool ignore_case)); static char *format_date PARAMS((struct timespec ts, int kind)); static char *ctime_format PARAMS((struct timespec ts)); @@ -280,7 +280,7 @@ compare_ts (struct timespec ts1, * COMP_LT: before the specified time * COMP_EQ: after the specified time but by not more than WINDOW seconds. */ -static boolean +static bool pred_timewindow (struct timespec ts, struct predicate const *pred_ptr, int window) { switch (pred_ptr->args.reftime.kind) @@ -315,14 +315,14 @@ pred_timewindow (struct timespec ts, struct predicate const *pred_ptr, int windo } -boolean +bool pred_amin (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; return pred_timewindow (get_stat_atime(stat_buf), pred_ptr, 60); } -boolean +bool pred_and (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { if (pred_ptr->pred_left == NULL @@ -334,7 +334,7 @@ pred_and (const char *pathname, struct stat *stat_buf, struct predicate *pred_pt return false; } -boolean +bool pred_anewer (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; @@ -342,14 +342,14 @@ pred_anewer (const char *pathname, struct stat *stat_buf, struct predicate *pred return compare_ts (get_stat_atime(stat_buf), pred_ptr->args.reftime.ts) > 0; } -boolean +bool pred_atime (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; return pred_timewindow (get_stat_atime(stat_buf), pred_ptr, DAYSECS); } -boolean +bool pred_closeparen (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; @@ -359,14 +359,14 @@ pred_closeparen (const char *pathname, struct stat *stat_buf, struct predicate * return true; } -boolean +bool pred_cmin (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; return pred_timewindow (get_stat_ctime(stat_buf), pred_ptr, 60); } -boolean +bool pred_cnewer (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -375,7 +375,7 @@ pred_cnewer (const char *pathname, struct stat *stat_buf, struct predicate *pred return compare_ts (get_stat_ctime(stat_buf), pred_ptr->args.reftime.ts) > 0; } -boolean +bool pred_comma (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { if (pred_ptr->pred_left != NULL) @@ -385,21 +385,21 @@ pred_comma (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return apply_predicate (pathname, stat_buf, pred_ptr->pred_right); } -boolean +bool pred_ctime (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; return pred_timewindow (get_stat_ctime(stat_buf), pred_ptr, DAYSECS); } -static boolean +static bool perform_delete (int flags) { return 0 == unlinkat (state.cwd_dir_fd, state.rel_pathname, flags); } -boolean +bool pred_delete (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pred_ptr; @@ -448,7 +448,7 @@ pred_delete (const char *pathname, struct stat *stat_buf, struct predicate *pred } } -boolean +bool pred_empty (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -459,7 +459,7 @@ pred_empty (const char *pathname, struct stat *stat_buf, struct predicate *pred_ int fd; DIR *d; struct dirent *dp; - boolean empty = true; + bool empty = true; errno = 0; if ((fd = openat (state.cwd_dir_fd, state.rel_pathname, O_RDONLY @@ -503,7 +503,7 @@ pred_empty (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return (false); } -static boolean +static bool new_impl_pred_exec (int dir_fd, const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr, @@ -566,14 +566,14 @@ new_impl_pred_exec (int dir_fd, const char *pathname, } -boolean +bool pred_exec (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { return new_impl_pred_exec (get_start_dirfd(), pathname, stat_buf, pred_ptr, NULL, 0); } -boolean +bool pred_execdir (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./"; @@ -583,7 +583,7 @@ pred_execdir (const char *pathname, struct stat *stat_buf, struct predicate *pre prefix, (prefix ? 2 : 0)); } -boolean +bool pred_false (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; @@ -594,7 +594,7 @@ pred_false (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return (false); } -boolean +bool pred_fls (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { FILE * stream = pred_ptr->args.printf_vec.stream; @@ -605,7 +605,7 @@ pred_fls (const char *pathname, struct stat *stat_buf, struct predicate *pred_pt return true; } -boolean +bool pred_fprint (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; @@ -619,7 +619,7 @@ pred_fprint (const char *pathname, struct stat *stat_buf, struct predicate *pred return true; } -boolean +bool pred_fprint0 (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { FILE * fp = pred_ptr->args.printf_vec.stream; @@ -912,7 +912,7 @@ do_fprintf (struct format_val *dest, scheme. But help the compiler in the common case where the host uses the traditional numbering scheme. */ mode_t m = stat_buf->st_mode; - boolean traditional_numbering_scheme = + bool traditional_numbering_scheme = (S_ISUID == 04000 && S_ISGID == 02000 && S_ISVTX == 01000 && S_IRUSR == 00400 && S_IWUSR == 00200 && S_IXUSR == 00100 && S_IRGRP == 00040 && S_IWGRP == 00020 && S_IXGRP == 00010 @@ -1098,7 +1098,7 @@ do_fprintf (struct format_val *dest, } } -boolean +bool pred_fprintf (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { struct format_val *dest = &pred_ptr->args.printf_vec; @@ -1166,7 +1166,7 @@ pred_fprintf (const char *pathname, struct stat *stat_buf, struct predicate *pre return true; } -boolean +bool pred_fstype (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1177,7 +1177,7 @@ pred_fstype (const char *pathname, struct stat *stat_buf, struct predicate *pred return false; } -boolean +bool pred_gid (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1200,7 +1200,7 @@ pred_gid (const char *pathname, struct stat *stat_buf, struct predicate *pred_pt return (false); } -boolean +bool pred_group (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1211,7 +1211,7 @@ pred_group (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return (false); } -boolean +bool pred_ilname (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { return match_lname (pathname, stat_buf, pred_ptr, true); @@ -1221,10 +1221,10 @@ pred_ilname (const char *pathname, struct stat *stat_buf, struct predicate *pred is name to compare basename against, and FLAGS are passed to fnmatch. Recall that 'find / -name /' is one of the few times where a '/' in the -name must actually find something. */ -static boolean +static bool pred_name_common (const char *pathname, const char *str, int flags) { - boolean b; + bool b; /* We used to use last_component() here, but that would not allow us to modify the * input string, which is const. We could optimise by duplicating the string only * if we need to modify it, and I'll do that if there is a measurable @@ -1242,14 +1242,14 @@ pred_name_common (const char *pathname, const char *str, int flags) return b; } -boolean +bool pred_iname (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) stat_buf; return pred_name_common (pathname, pred_ptr->args.str, FNM_CASEFOLD); } -boolean +bool pred_inum (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1274,7 +1274,7 @@ pred_inum (const char *pathname, struct stat *stat_buf, struct predicate *pred_p return (false); } -boolean +bool pred_ipath (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) stat_buf; @@ -1284,7 +1284,7 @@ pred_ipath (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return (false); } -boolean +bool pred_links (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1307,16 +1307,16 @@ pred_links (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return (false); } -boolean +bool pred_lname (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { return match_lname (pathname, stat_buf, pred_ptr, false); } -static boolean -match_lname (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr, boolean ignore_case) +static bool +match_lname (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr, bool ignore_case) { - boolean ret = false; + bool ret = false; #ifdef S_ISLNK if (S_ISLNK (stat_buf->st_mode)) { @@ -1333,40 +1333,40 @@ match_lname (const char *pathname, struct stat *stat_buf, struct predicate *pred return ret; } -boolean +bool pred_ls (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { return pred_fls (pathname, stat_buf, pred_ptr); } -boolean +bool pred_mmin (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) &pathname; return pred_timewindow (get_stat_mtime(stat_buf), pred_ptr, 60); } -boolean +bool pred_mtime (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; return pred_timewindow (get_stat_mtime(stat_buf), pred_ptr, DAYSECS); } -boolean +bool pred_name (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) stat_buf; return pred_name_common (pathname, pred_ptr->args.str, 0); } -boolean +bool pred_negate (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { return !apply_predicate (pathname, stat_buf, pred_ptr->pred_right); } -boolean +bool pred_newer (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1375,11 +1375,11 @@ pred_newer (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return compare_ts (get_stat_mtime(stat_buf), pred_ptr->args.reftime.ts) > 0; } -boolean +bool pred_newerXY (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { struct timespec ts; - boolean collected = false; + bool collected = false; assert (COMP_GT == pred_ptr->args.reftime.kind); @@ -1421,7 +1421,7 @@ pred_newerXY (const char *pathname, struct stat *stat_buf, struct predicate *pre return compare_ts (ts, pred_ptr->args.reftime.ts) > 0; } -boolean +bool pred_nogroup (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1436,7 +1436,7 @@ pred_nogroup (const char *pathname, struct stat *stat_buf, struct predicate *pre #endif } -boolean +bool pred_nouser (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { #ifdef CACHE_IDS @@ -1454,7 +1454,7 @@ pred_nouser (const char *pathname, struct stat *stat_buf, struct predicate *pred } -static boolean +static bool is_ok (const char *program, const char *arg) { fflush (stdout); @@ -1469,7 +1469,7 @@ is_ok (const char *program, const char *arg) return yesno (); } -boolean +bool pred_ok (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { if (is_ok (pred_ptr->args.exec_vec.replace_vec[0], pathname)) @@ -1479,7 +1479,7 @@ pred_ok (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr return false; } -boolean +bool pred_okdir (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { const char *prefix = (state.rel_pathname[0] == '/') ? NULL : "./"; @@ -1491,7 +1491,7 @@ pred_okdir (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return false; } -boolean +bool pred_openparen (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1500,7 +1500,7 @@ pred_openparen (const char *pathname, struct stat *stat_buf, struct predicate *p return true; } -boolean +bool pred_or (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { if (pred_ptr->pred_left == NULL @@ -1512,7 +1512,7 @@ pred_or (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr return true; } -boolean +bool pred_path (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) stat_buf; @@ -1521,7 +1521,7 @@ pred_path (const char *pathname, struct stat *stat_buf, struct predicate *pred_p return (false); } -boolean +bool pred_perm (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { mode_t mode = stat_buf->st_mode; @@ -1590,7 +1590,7 @@ can_access (int access_type) } -boolean +bool pred_executable (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1600,7 +1600,7 @@ pred_executable (const char *pathname, struct stat *stat_buf, struct predicate * return can_access (X_OK); } -boolean +bool pred_readable (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1610,7 +1610,7 @@ pred_readable (const char *pathname, struct stat *stat_buf, struct predicate *pr return can_access (R_OK); } -boolean +bool pred_writable (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1620,7 +1620,7 @@ pred_writable (const char *pathname, struct stat *stat_buf, struct predicate *pr return can_access (W_OK); } -boolean +bool pred_print (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) stat_buf; @@ -1633,13 +1633,13 @@ pred_print (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return true; } -boolean +bool pred_print0 (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { return pred_fprint0(pathname, stat_buf, pred_ptr); } -boolean +bool pred_prune (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1659,7 +1659,7 @@ pred_prune (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return true; } -boolean +bool pred_quit (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1677,7 +1677,7 @@ pred_quit (const char *pathname, struct stat *stat_buf, struct predicate *pred_p exit (state.exit_status); /* 0 for success, etc. */ } -boolean +bool pred_regex (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { int len = strlen (pathname); @@ -1688,7 +1688,7 @@ pred_regex (const char *pathname, struct stat *stat_buf, struct predicate *pred_ return (false); } -boolean +bool pred_size (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { uintmax_t f_val; @@ -1714,7 +1714,7 @@ pred_size (const char *pathname, struct stat *stat_buf, struct predicate *pred_p return (false); } -boolean +bool pred_samefile (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { /* Potential optimisation: because of the loop protection, we always @@ -1755,7 +1755,7 @@ pred_samefile (const char *pathname, struct stat *stat_buf, struct predicate *pr } } -boolean +bool pred_true (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1764,7 +1764,7 @@ pred_true (const char *pathname, struct stat *stat_buf, struct predicate *pred_p return true; } -boolean +bool pred_type (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { mode_t mode; @@ -1815,7 +1815,7 @@ pred_type (const char *pathname, struct stat *stat_buf, struct predicate *pred_p return (false); } -boolean +bool pred_uid (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1837,7 +1837,7 @@ pred_uid (const char *pathname, struct stat *stat_buf, struct predicate *pred_pt return (false); } -boolean +bool pred_used (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { struct timespec delta, at, ct; @@ -1857,7 +1857,7 @@ pred_used (const char *pathname, struct stat *stat_buf, struct predicate *pred_p return pred_timewindow (delta, pred_ptr, DAYSECS); } -boolean +bool pred_user (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void) pathname; @@ -1867,7 +1867,7 @@ pred_user (const char *pathname, struct stat *stat_buf, struct predicate *pred_p return (false); } -boolean +bool pred_xtype (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { struct stat sbuf; /* local copy, not stat_buf because we're using a different stat method */ @@ -1906,7 +1906,7 @@ pred_xtype (const char *pathname, struct stat *stat_buf, struct predicate *pred_ } -boolean +bool pred_context (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { @@ -1945,10 +1945,10 @@ pred_context (const char *pathname, struct stat *stat_buf, Otherwise return false, possibly printing an error message. */ -static boolean -prep_child_for_exec (boolean close_stdin, int dir_fd) +static bool +prep_child_for_exec (bool close_stdin, int dir_fd) { - boolean ok = true; + bool ok = true; if (close_stdin) { const char inputfile[] = "/dev/null"; @@ -2107,7 +2107,7 @@ launch (struct buildcmd_control *ctl, void *usercontext, int argc, char **argv) } -static boolean +static bool scan_for_digit_differences (const char *p, const char *q, size_t *first, size_t *n) { diff --git a/find/tree.c b/find/tree.c index 08f2f0a..15e3129 100644 --- a/find/tree.c +++ b/find/tree.c @@ -69,7 +69,7 @@ static const char *cost_name PARAMS((enum EvaluationCost cost)); point or not. If no start points were given on the command line, we return true for ".". */ -boolean +bool matches_start_point (const char *glob, bool foldcase) { int fnmatch_flags = 0; @@ -282,7 +282,7 @@ scan_rest (struct predicate **input, } /* Returns true if the specified predicate is reorderable. */ -static boolean +static bool predicate_is_cost_free (const struct predicate *p) { if (pred_is(p, pred_name) || @@ -363,7 +363,7 @@ predlist_insert (struct predlist *list, } static int -pred_cost_compare (const struct predicate *p1, const struct predicate *p2, boolean wantfailure) +pred_cost_compare (const struct predicate *p1, const struct predicate *p2, bool wantfailure) { if (p1->p_cost == p2->p_cost) { @@ -418,7 +418,7 @@ predlist_merge_sort (struct predlist *list, * rate comparison, not the operation cost comparison. Hence we * pass a flag into pred_cost_compare(). */ - boolean wantfailure = (OR_PREC != p->p_prec); + const bool wantfailure = (OR_PREC != p->p_prec); if (pred_cost_compare (p->pred_right, q->pred_right, wantfailure) >= 0) break; } @@ -469,7 +469,7 @@ merge_lists (struct predlist lists[], int nlists, -static boolean +static bool subtree_has_side_effects (const struct predicate *p) { if (p) @@ -530,7 +530,7 @@ perform_arm_swap (struct predicate *p) * Here, the ! -type f should be evaluated first, * as we assume that 95% of inodes are vanilla files. */ -static boolean +static bool consider_arm_swap (struct predicate *p) { int left_cost, right_cost; @@ -578,7 +578,7 @@ consider_arm_swap (struct predicate *p) } if (!reason) { - boolean want_swap; + bool want_swap; if (left_cost == right_cost) { @@ -635,12 +635,12 @@ consider_arm_swap (struct predicate *p) return false; } -static boolean +static bool do_arm_swaps (struct predicate *p) { if (p) { - boolean swapped; + bool swapped; do { swapped = false; @@ -692,7 +692,7 @@ do_arm_swaps (struct predicate *p) to be rearranged. opt_expr may return a new root pointer there. Return true if the tree contains side effects, false if not. */ -static boolean +static bool opt_expr (struct predicate **eval_treep) { struct predlist regex_list={NULL,NULL}, name_list={NULL,NULL}; @@ -703,7 +703,7 @@ opt_expr (struct predicate **eval_treep) struct predicate **last_sidep; /* Last predicate with side effects. */ PRED_FUNC pred_func; enum predicate_type p_type; - boolean has_side_effects = false; /* Return value. */ + bool has_side_effects = false; /* Return value. */ enum predicate_precedence prev_prec, /* precedence of last BI_OP in branch */ biop_prec; /* topmost BI_OP precedence in branch */ @@ -773,7 +773,7 @@ opt_expr (struct predicate **eval_treep) /* If this predicate has no side effects, consider reordering it. */ if (!curr->pred_right->side_effects) { - boolean reorder; + bool reorder; /* If it's one of our special primaries, move it to the front of the list for that primary. */ @@ -1010,7 +1010,7 @@ static struct pred_cost_lookup costlookup[] = }; static int pred_table_sorted = 0; -static boolean +static bool check_sorted (void *base, size_t members, size_t membersize, int (*cmpfn)(const void*, const void*)) { @@ -1226,7 +1226,8 @@ calculate_derived_rates (struct predicate *p) * asserts that this property still holds. * */ -static void check_normalization (struct predicate *p, boolean at_root) +static void +check_normalization (struct predicate *p, bool at_root) { if (at_root) { diff --git a/find/util.c b/find/util.c index 771ac42..e19df6f 100644 --- a/find/util.c +++ b/find/util.c @@ -238,7 +238,7 @@ get_info (const char *pathname, struct stat *p, struct predicate *pred_ptr) { - boolean todo = false; + bool todo = false; /* If we need the full stat info, or we need the type info but don't * already have it, stat the file now. @@ -299,7 +299,7 @@ get_info (const char *pathname, /* Determine if we can use O_NOFOLLOW. */ #if defined O_NOFOLLOW -boolean +bool check_nofollow (void) { struct utsname uts; @@ -451,7 +451,7 @@ undangle_file_pointers (struct predicate *p) /* Return nonzero if file descriptor leak-checking is enabled. */ -boolean +bool fd_leak_check_is_enabled (void) { if (getenv ("GNU_FINDUTILS_FD_LEAK_CHECK")) @@ -656,7 +656,7 @@ debug_stat (const char *file, struct stat *bufp) } -boolean +bool following_links(void) { switch (options.symlink_handling) @@ -674,12 +674,12 @@ following_links(void) /* Take a "mode" indicator and fill in the files of 'state'. */ -boolean +bool digest_mode (mode_t *mode, const char *pathname, const char *name, struct stat *pstat, - boolean leaf) + bool leaf) { /* If we know the type of the directory entry, and it is not a * symbolic link, we may be able to avoid a stat() or lstat() call. @@ -736,7 +736,7 @@ digest_mode (mode_t *mode, predicate list PRED, false if there are any. Returns true if default print should be performed */ -boolean +bool default_prints (struct predicate *pred) { while (pred != NULL) @@ -748,8 +748,8 @@ default_prints (struct predicate *pred) return (true); } -boolean -looks_like_expression (const char *arg, boolean leading) +bool +looks_like_expression (const char *arg, bool leading) { switch (arg[0]) { @@ -788,7 +788,7 @@ process_debug_options (char *arg) const char *p; char *token_context = NULL; const char delimiters[] = ","; - boolean empty = true; + bool empty = true; size_t i; p = strtok_r (arg, delimiters, &token_context); @@ -1042,7 +1042,7 @@ get_start_dirfd (void) /* apply_predicate * */ -boolean +bool apply_predicate(const char *pathname, struct stat *stat_buf, struct predicate *p) { ++p->perf.visits; diff --git a/locate/locate.c b/locate/locate.c index 48daa98..6ac018d 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -70,7 +70,7 @@ #include #include -#include /* for bool/boolean */ +#include /* The presence of unistd.h is assumed by gnulib these days, so we * might as well assume it too. @@ -138,8 +138,6 @@ # define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) #endif -/* typedef enum {false, true} boolean; */ - /* Warn if a database is older than this. 8 days allows for a weekly update that takes up to a day to perform. */ static unsigned int warn_number_units = 8; diff --git a/xargs/xargs.c b/xargs/xargs.c index 4954256..f6b72c4 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -64,6 +64,7 @@ #include #include #include +#include #if !defined(SIGCHLD) && defined(SIGCLD) #define SIGCHLD SIGCLD @@ -97,11 +98,6 @@ /* Return nonzero if S is the EOF string. */ #define EOF_STR(s) (eof_str && *eof_str == *s && !strcmp (eof_str, s)) -/* Not char because of type promotion; NeXT gcc can't handle it. */ -typedef int boolean; -#define true 1 -#define false 0 - #if __STDC__ #define VOID void #else @@ -144,14 +140,14 @@ static char *eof_str = NULL; /* static int initial_argv_chars = 0; */ /* true when building up initial arguments in `cmd_argv'. */ -static boolean initial_args = true; +static bool initial_args = true; /* If nonzero, the maximum number of child processes that can be running at once. */ static unsigned long int proc_max = 1uL; /* Did we fork a child yet? */ -static boolean procs_executed = false; +static bool procs_executed = false; /* The number of elements in `pids'. */ static unsigned long int procs_executing = 0uL; @@ -172,11 +168,11 @@ static volatile int child_error = EXIT_SUCCESS; static volatile int original_exit_value; /* If true, print each command on stderr before executing it. */ -static boolean print_command = false; /* Option -t */ +static bool print_command = false; /* Option -t */ /* If true, query the user before executing each command, and only execute the command if the user responds affirmatively. */ -static boolean query_before_executing = false; +static bool query_before_executing = false; /* The delimiter for input arguments. This is only consulted if the * -0 or -d option had been given. @@ -224,12 +220,12 @@ enum ClientStatusValues { static int read_line PARAMS ((void)); static int read_string PARAMS ((void)); -static boolean print_args PARAMS ((boolean ask)); +static bool print_args PARAMS ((bool ask)); /* static void do_exec PARAMS ((void)); */ static int xargs_do_exec (struct buildcmd_control *ctl, void *usercontext, int argc, char **argv); static void exec_if_possible PARAMS ((void)); static void add_proc PARAMS ((pid_t pid)); -static void wait_for_proc PARAMS ((boolean all, unsigned int minreap)); +static void wait_for_proc PARAMS ((bool all, unsigned int minreap)); static void wait_for_proc_all PARAMS ((void)); static long parse_num PARAMS ((char *str, int option, long min, long max, int fatal)); static void usage PARAMS ((FILE * stream)); @@ -774,14 +770,14 @@ read_line (void) QUOTE = 2, BACKSLASH = 3 }; - static boolean eof = false; + static bool eof = false; /* Start out in mode SPACE to always strip leading spaces (even with -i). */ enum read_line_state state = SPACE; /* The type of character we last read. */ int prevc; /* The previous value of c. */ int quotc = 0; /* The last quote character read. */ int c = EOF; - boolean first = true; /* true if reading first arg on line. */ - boolean seen_arg = false; /* true if we have seen any arg (or part of one) yet */ + bool first = true; /* true if reading first arg on line. */ + bool seen_arg = false; /* true if we have seen any arg (or part of one) yet */ int len; char *p = linebuf; /* Including the NUL, the args must not grow past this point. */ @@ -946,7 +942,7 @@ read_line (void) static int read_string (void) { - static boolean eof = false; + static bool eof = false; int len; char *p = linebuf; /* Including the NUL, the args must not grow past this point. */ @@ -997,8 +993,8 @@ read_string (void) if the user responds affirmatively, return true; otherwise, return false. */ -static boolean -print_args (boolean ask) +static bool +print_args (bool ask) { int i; @@ -1275,7 +1271,7 @@ add_proc (pid_t pid) Remove the processes that finish from the list of executing processes. */ static void -wait_for_proc (boolean all, unsigned int minreap) +wait_for_proc (bool all, unsigned int minreap) { unsigned int reaped = 0; @@ -1367,7 +1363,7 @@ wait_for_proc (boolean all, unsigned int minreap) static void wait_for_proc_all (void) { - static boolean waiting = false; + static bool waiting = false; /* This function was registered by the original, parent, process. * The child processes must not call exit () to terminate, since this -- 1.7.0