Make the test suite fail if it cannot find the binary (as opposed to testing the...
[findutils.git] / find / defs.h
blob09541d870b971736811ff8799cf3c5f3ea45b2cb
1 /* defs.h -- data types and declarations.
2 Copyright (C) 1990, 91, 92, 93, 94, 2000, 2004, 2005, 2006 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 USA.
19 #ifndef INC_DEFS_H
20 #define INC_DEFS_H 1
22 #include <config.h>
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <stdio.h>
27 #if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
28 #include <string.h>
29 #else
30 #include <strings.h>
31 #ifndef strchr
32 #define strchr index
33 #endif
34 #ifndef strrchr
35 #define strrchr rindex
36 #endif
37 #endif
39 #include <errno.h>
40 #ifndef errno
41 extern int errno;
42 #endif
44 #ifdef STDC_HEADERS
45 #include <stdlib.h>
46 #endif
48 /* The presence of unistd.h is assumed by gnulib these days, so we
49 * might as well assume it too.
51 #include <unistd.h>
53 #include <time.h>
55 #if HAVE_LIMITS_H
56 # include <limits.h>
57 #endif
58 #ifndef CHAR_BIT
59 # define CHAR_BIT 8
60 #endif
62 #if HAVE_INTTYPES_H
63 # include <inttypes.h>
64 #endif
66 #include "regex.h"
67 #include "timespec.h"
68 #include "buildcmd.h"
71 #ifndef S_IFLNK
72 #define lstat stat
73 #endif
75 # ifndef PARAMS
76 # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
77 # define PARAMS(Args) Args
78 # else
79 # define PARAMS(Args) ()
80 # endif
81 # endif
83 int lstat PARAMS((const char *__path, struct stat *__statbuf));
84 int stat PARAMS((const char *__path, struct stat *__statbuf));
86 int optionl_stat PARAMS((const char *name, struct stat *p));
87 int optionp_stat PARAMS((const char *name, struct stat *p));
88 int optionh_stat PARAMS((const char *name, struct stat *p));
89 int debug_stat PARAMS((const char *file, struct stat *bufp));
91 void set_stat_placeholders PARAMS((struct stat *p));
92 int get_statinfo PARAMS((const char *pathname, const char *name, struct stat *p));
94 #if ! defined HAVE_FCHDIR && ! defined fchdir
95 # define fchdir(fd) (-1)
96 #endif
100 #ifndef S_ISUID
101 # define S_ISUID 0004000
102 #endif
103 #ifndef S_ISGID
104 # define S_ISGID 0002000
105 #endif
106 #ifndef S_ISVTX
107 # define S_ISVTX 0001000
108 #endif
109 #ifndef S_IRUSR
110 # define S_IRUSR 0000400
111 #endif
112 #ifndef S_IWUSR
113 # define S_IWUSR 0000200
114 #endif
115 #ifndef S_IXUSR
116 # define S_IXUSR 0000100
117 #endif
118 #ifndef S_IRGRP
119 # define S_IRGRP 0000040
120 #endif
121 #ifndef S_IWGRP
122 # define S_IWGRP 0000020
123 #endif
124 #ifndef S_IXGRP
125 # define S_IXGRP 0000010
126 #endif
127 #ifndef S_IROTH
128 # define S_IROTH 0000004
129 #endif
130 #ifndef S_IWOTH
131 # define S_IWOTH 0000002
132 #endif
133 #ifndef S_IXOTH
134 # define S_IXOTH 0000001
135 #endif
137 #define MODE_WXUSR (S_IWUSR | S_IXUSR)
138 #define MODE_R (S_IRUSR | S_IRGRP | S_IROTH)
139 #define MODE_RW (S_IWUSR | S_IWGRP | S_IWOTH | MODE_R)
140 #define MODE_RWX (S_IXUSR | S_IXGRP | S_IXOTH | MODE_RW)
141 #define MODE_ALL (S_ISUID | S_ISGID | S_ISVTX | MODE_RWX)
143 #if 1
144 #include <stdbool.h>
145 typedef bool boolean;
146 #else
147 /* Not char because of type promotion; NeXT gcc can't handle it. */
148 typedef int boolean;
149 #define true 1
150 #define false 0
151 #endif
153 struct predicate;
154 struct options;
156 /* Pointer to a predicate function. */
157 typedef boolean (*PRED_FUNC)(char *pathname, struct stat *stat_buf, struct predicate *pred_ptr);
159 /* The number of seconds in a day. */
160 #define DAYSECS 86400
162 /* Argument structures for predicates. */
164 enum comparison_type
166 COMP_GT,
167 COMP_LT,
168 COMP_EQ
171 enum permissions_type
173 PERM_AT_LEAST,
174 PERM_ANY,
175 PERM_EXACT
178 enum predicate_type
180 NO_TYPE,
181 PRIMARY_TYPE,
182 UNI_OP,
183 BI_OP,
184 OPEN_PAREN,
185 CLOSE_PAREN
188 enum predicate_precedence
190 NO_PREC,
191 COMMA_PREC,
192 OR_PREC,
193 AND_PREC,
194 NEGATE_PREC,
195 MAX_PREC
198 struct long_val
200 enum comparison_type kind;
201 boolean negative; /* Defined only when representing time_t. */
202 uintmax_t l_val;
205 struct perm_val
207 enum permissions_type kind;
208 mode_t val[2];
211 /* dir_id is used to support loop detection in find.c and
212 * also to support the -samefile test.
214 struct dir_id
216 ino_t ino;
217 dev_t dev;
220 struct size_val
222 enum comparison_type kind;
223 int blocksize;
224 uintmax_t size;
228 enum xval
230 XVAL_ATIME, XVAL_BIRTHTIME, XVAL_CTIME, XVAL_MTIME, XVAL_TIME
233 struct time_val
235 enum xval xval;
236 enum comparison_type kind;
237 struct timespec ts;
241 struct exec_val
243 boolean multiple; /* -exec {} \+ denotes multiple argument. */
244 struct buildcmd_control ctl;
245 struct buildcmd_state state;
246 char **replace_vec; /* Command arguments (for ";" style) */
247 int num_args;
248 boolean use_current_dir; /* If nonzero, don't chdir to start dir */
249 boolean close_stdin; /* If true, close stdin in the child. */
250 int dirfd; /* The directory to do the exec in. */
253 /* The format string for a -printf or -fprintf is chopped into one or
254 more `struct segment', linked together into a list.
255 Each stretch of plain text is a segment, and
256 each \c and `%' conversion is a segment. */
258 /* Special values for the `kind' field of `struct segment'. */
259 enum SegmentKind
261 KIND_PLAIN=0, /* Segment containing just plain text. */
262 KIND_STOP=1, /* \c -- stop printing and flush output. */
263 KIND_FORMAT, /* Regular format */
266 struct segment
268 enum SegmentKind segkind; /* KIND_FORMAT, KIND_PLAIN, KIND_STOP */
269 char format_char[2]; /* Format chars if kind is KIND_FORMAT */
270 char *text; /* Plain text or `%' format string. */
271 int text_len; /* Length of `text'. */
272 struct segment *next; /* Next segment for this predicate. */
275 struct format_val
277 struct segment *segment; /* Linked list of segments. */
278 FILE *stream; /* Output stream to print on. */
279 boolean dest_is_tty; /* True if the destination is a terminal. */
280 struct quoting_options *quote_opts;
283 /* evaluation cost of a predicate */
284 enum EvaluationCost
286 NeedsNothing,
287 NeedsType,
288 NeedsStatInfo,
289 NeedsLinkName,
290 NeedsAccessInfo,
291 NeedsSyncDiskHit,
292 NeedsEventualExec,
293 NeedsImmediateExec,
294 NeedsUserInteraction,
295 NeedsUnknown,
296 NumEvaluationCosts
299 struct predicate
301 /* Pointer to the function that implements this predicate. */
302 PRED_FUNC pred_func;
304 /* Only used for debugging, but defined unconditionally so individual
305 modules can be compiled with -DDEBUG. */
306 char *p_name;
308 /* The type of this node. There are two kinds. The first is real
309 predicates ("primaries") such as -perm, -print, or -exec. The
310 other kind is operators for combining predicates. */
311 enum predicate_type p_type;
313 /* The precedence of this node. Only has meaning for operators. */
314 enum predicate_precedence p_prec;
316 /* True if this predicate node produces side effects.
317 If side_effects are produced
318 then optimization will not be performed */
319 boolean side_effects;
321 /* True if this predicate node requires default print be turned off. */
322 boolean no_default_print;
324 /* True if this predicate node requires a stat system call to execute. */
325 boolean need_stat;
327 /* True if this predicate node requires knowledge of the file type. */
328 boolean need_type;
330 enum EvaluationCost p_cost;
332 /* est_success_rate is a number between 0.0 and 1.0 */
333 float est_success_rate;
335 /* True if this predicate should display control characters literally */
336 boolean literal_control_chars;
338 /* True if this predicate didn't originate from the user. */
339 boolean artificial;
341 /* The raw text of the argument of this predicate. */
342 char *arg_text;
344 /* Information needed by the predicate processor.
345 Next to each member are listed the predicates that use it. */
346 union
348 char *str; /* fstype [i]lname [i]name [i]path */
349 struct re_pattern_buffer *regex; /* regex */
350 struct exec_val exec_vec; /* exec ok */
351 struct long_val numinfo; /* gid inum links uid */
352 struct size_val size; /* size */
353 uid_t uid; /* user */
354 gid_t gid; /* group */
355 struct time_val reftime; /* newer newerXY anewer cnewer mtime atime ctime mmin amin cmin */
356 struct perm_val perm; /* perm */
357 struct dir_id fileid; /* samefile */
358 mode_t type; /* type */
359 FILE *stream; /* ls fls fprint0 */
360 struct format_val printf_vec; /* printf fprintf fprint */
361 } args;
363 /* The next predicate in the user input sequence,
364 which represents the order in which the user supplied the
365 predicates on the command line. */
366 struct predicate *pred_next;
368 /* The right and left branches from this node in the expression
369 tree, which represents the order in which the nodes should be
370 processed. */
371 struct predicate *pred_left;
372 struct predicate *pred_right;
374 const struct parser_table* parser_entry;
377 /* find.c, ftsfind.c */
378 boolean is_fts_enabled(int *ftsoptions);
379 int get_start_dirfd(void);
380 int get_current_dirfd(void);
382 /* find library function declarations. */
384 /* dirname.c */
385 char *dirname PARAMS((char *path));
387 /* error.c */
388 void error PARAMS((int status, int errnum, char *message, ...));
390 /* stpcpy.c */
391 #if !HAVE_STPCPY
392 char *stpcpy PARAMS((char *dest, const char *src));
393 #endif
395 /* xgetcwd.c */
396 char *xgetcwd PARAMS((void));
398 /* xmalloc.c */
399 #if __STDC__
400 #define VOID void
401 #else
402 #define VOID char
403 #endif
405 /* find global function declarations. */
407 /* find.c */
408 /* SymlinkOption represents the choice of
409 * -P, -L or -P (default) on the command line.
411 enum SymlinkOption
413 SYMLINK_NEVER_DEREF, /* Option -P */
414 SYMLINK_ALWAYS_DEREF, /* Option -L */
415 SYMLINK_DEREF_ARGSONLY /* Option -H */
417 extern enum SymlinkOption symlink_handling; /* defined in find.c. */
419 void set_follow_state PARAMS((enum SymlinkOption opt));
420 void cleanup(void);
422 /* fstype.c */
423 char *filesystem_type PARAMS((const struct stat *statp, const char *path));
424 char * get_mounted_filesystems (void);
425 dev_t * get_mounted_devices PARAMS((size_t *));
429 enum arg_type
431 ARG_OPTION, /* regular options like -maxdepth */
432 ARG_NOOP, /* does nothing, returns true, internal use only */
433 ARG_POSITIONAL_OPTION, /* options whose position is important (-follow) */
434 ARG_TEST, /* a like -name */
435 ARG_SPECIAL_PARSE, /* complex to parse, don't eat the test name before calling parse_xx(). */
436 ARG_PUNCTUATION, /* like -o or ( */
437 ARG_ACTION /* like -print */
441 struct parser_table;
442 /* Pointer to a parser function. */
443 typedef boolean (*PARSE_FUNC)(const struct parser_table *p,
444 char *argv[], int *arg_ptr);
445 struct parser_table
447 enum arg_type type;
448 char *parser_name;
449 PARSE_FUNC parser_func;
450 PRED_FUNC pred_func;
453 /* parser.c */
454 const struct parser_table* find_parser PARAMS((char *search_name));
455 boolean parse_open PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr));
456 boolean parse_close PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr));
457 boolean parse_print PARAMS((const struct parser_table*, char *argv[], int *arg_ptr));
458 void pred_sanity_check PARAMS((const struct predicate *predicates));
459 void parse_begin_user_args PARAMS((char **args, int argno, const struct predicate *last, const struct predicate *predicates));
460 void parse_end_user_args PARAMS((char **args, int argno, const struct predicate *last, const struct predicate *predicates));
461 boolean parse_openparen PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr));
462 boolean parse_closeparen PARAMS((const struct parser_table* entry, char *argv[], int *arg_ptr));
464 /* pred.c */
465 boolean pred_amin PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
466 boolean pred_and PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
467 boolean pred_anewer PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
468 boolean pred_atime PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
469 boolean pred_close PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
470 boolean pred_cmin PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
471 boolean pred_cnewer PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
472 boolean pred_comma PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
473 boolean pred_ctime PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
474 boolean pred_delete PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
475 boolean pred_empty PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
476 boolean pred_exec PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
477 boolean pred_execdir PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
478 boolean pred_executable PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
479 boolean pred_false PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
480 boolean pred_fls PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
481 boolean pred_fprint PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
482 boolean pred_fprint0 PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
483 boolean pred_fprintf PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
484 boolean pred_fstype PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
485 boolean pred_gid PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
486 boolean pred_group PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
487 boolean pred_ilname PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
488 boolean pred_iname PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
489 boolean pred_inum PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
490 boolean pred_ipath PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
491 boolean pred_links PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
492 boolean pred_lname PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
493 boolean pred_ls PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
494 boolean pred_mmin PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
495 boolean pred_mtime PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
496 boolean pred_name PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
497 boolean pred_negate PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
498 boolean pred_newer PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
499 boolean pred_newerXY PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
500 boolean pred_nogroup PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
501 boolean pred_nouser PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
502 boolean pred_ok PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
503 boolean pred_okdir PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
504 boolean pred_open PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
505 boolean pred_or PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
506 boolean pred_path PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
507 boolean pred_perm PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
508 boolean pred_print PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
509 boolean pred_print0 PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
510 boolean pred_prune PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
511 boolean pred_quit PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
512 boolean pred_readable PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
513 boolean pred_regex PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
514 boolean pred_samefile PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
515 boolean pred_size PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
516 boolean pred_true PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
517 boolean pred_type PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
518 boolean pred_uid PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
519 boolean pred_used PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
520 boolean pred_user PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
521 boolean pred_writable PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
522 boolean pred_xtype PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
526 int launch PARAMS((const struct buildcmd_control *ctl,
527 struct buildcmd_state *buildstate));
530 char *find_pred_name PARAMS((PRED_FUNC pred_func));
534 void print_predicate PARAMS((FILE *fp, const struct predicate *p));
535 void print_tree PARAMS((FILE*, struct predicate *node, int indent));
536 void print_list PARAMS((FILE*, struct predicate *node));
537 void print_optlist PARAMS((FILE *fp, const struct predicate *node));
540 /* tree.c */
541 struct predicate * build_expression_tree PARAMS((int argc, char *argv[], int end_of_leading_options));
542 struct predicate * get_eval_tree PARAMS((void));
543 struct predicate *get_new_pred PARAMS((const struct parser_table *entry));
544 struct predicate *get_new_pred_chk_op PARAMS((const struct parser_table *entry));
545 float calculate_derived_rates PARAMS((struct predicate *p));
547 /* util.c */
548 struct predicate *insert_primary PARAMS((const struct parser_table *entry));
549 struct predicate *insert_primary_withpred PARAMS((const struct parser_table *entry, PRED_FUNC fptr));
550 void usage PARAMS((FILE *fp, int status, char *msg));
551 extern boolean check_nofollow(void);
552 void complete_pending_execs(struct predicate *p);
553 void complete_pending_execdirs(int dirfd); /* Passing dirfd is an unpleasant CodeSmell. */
555 int process_leading_options PARAMS((int argc, char *argv[]));
556 void set_option_defaults PARAMS((struct options *p));
559 /* find.c. */
560 int get_info PARAMS((const char *pathname, struct stat *p, struct predicate *pred_ptr));
561 int following_links PARAMS((void));
562 int digest_mode PARAMS((mode_t mode, const char *pathname, const char *name, struct stat *pstat, boolean leaf));
563 boolean default_prints PARAMS((struct predicate *pred));
564 boolean looks_like_expression PARAMS((const char *arg, boolean leading));
567 enum DebugOption
569 DebugNone = 0,
570 DebugExpressionTree = 1,
571 DebugStat = 2,
572 DebugSearch = 4,
573 DebugTreeOpt = 8,
574 DebugHelp = 16,
575 DebugExec = 32
578 struct options
580 /* If true, process directory before contents. True unless -depth given. */
581 boolean do_dir_first;
583 /* If >=0, don't descend more than this many levels of subdirectories. */
584 int maxdepth;
586 /* If >=0, don't process files above this level. */
587 int mindepth;
589 /* If true, do not assume that files in directories with nlink == 2
590 are non-directories. */
591 boolean no_leaf_check;
593 /* If true, don't cross filesystem boundaries. */
594 boolean stay_on_filesystem;
596 /* If true, we ignore the problem where we find that a directory entry
597 * no longer exists by the time we get around to processing it.
599 boolean ignore_readdir_race;
601 /* If true, pass control characters through. If false, escape them
602 * or turn them into harmless things.
604 boolean literal_control_chars;
606 /* If true, we issue warning messages
608 boolean warnings;
610 struct timespec start_time; /* Time at start of execution. */
612 /* Seconds between 00:00 1/1/70 and either one day before now
613 (the default), or the start of today (if -daystart is given). */
614 time_t cur_day_start;
616 /* If true, cur_day_start has been adjusted to the start of the day. */
617 boolean full_days;
619 int output_block_size; /* Output block size. */
621 /* bitmask for debug options */
622 unsigned long debug_options;
624 enum SymlinkOption symlink_handling;
627 /* Pointer to the function used to stat files. */
628 int (*xstat) (const char *name, struct stat *statbuf);
631 /* Indicate if we can implement safely_chdir() using the O_NOFOLLOW
632 * flag to open(2).
634 boolean open_nofollow_available;
636 /* The variety of regular expression that we support.
637 * The default is POSIX Basic Regular Expressions, but this
638 * can be changed with the positional option, -regextype.
640 int regex_options;
642 /* Optimisation level. One is the default.
644 unsigned short optimisation_level;
646 extern struct options options;
649 struct state
651 /* Current depth; 0 means current path is a command line arg. */
652 int curdepth;
654 /* If true, we have called stat on the current path. */
655 boolean have_stat;
657 /* If true, we know the type of the current path. */
658 boolean have_type;
659 mode_t type; /* this is the actual type */
661 /* The file being operated on, relative to the current directory.
662 Used for stat, readlink, remove, and opendir. */
663 char *rel_pathname;
664 /* The directory fd to which rel_pathname is relative. Thsi is relevant
665 * when we're navigating the hierarchy with fts() and using FTS_CWDFD.
667 int cwd_dir_fd;
669 /* Length of starting path. */
670 int starting_path_length;
672 /* If true, don't descend past current directory.
673 Can be set by -prune, -maxdepth, and -xdev/-mount. */
674 boolean stop_at_current_level;
676 /* Status value to return to system. */
677 int exit_status;
679 /* True if there are any execdirs. This saves us a pair of fchdir()
680 * calls for every directory we leave if it is false. This is just
681 * an optimisation. Set to true if you want to be conservative.
683 boolean execdirs_outstanding;
686 /* finddata.c */
687 extern struct state state;
688 extern char const *starting_dir;
689 extern int starting_desc;
690 extern char *program_name;
694 #endif