-/* $NetBSD: find.h,v 1.8 1998/02/21 22:47:20 christos Exp $ */
-
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)find.h 8.1 (Berkeley) 6/6/93
+ * @(#)find.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD: src/usr.bin/find/find.h,v 1.6.2.6 2001/09/19 09:44:24 ru Exp $
*/
-/* node type */
-enum ntype {
- N_AND = 1, /* must start > 0 */
- N_ATIME, N_CLOSEPAREN, N_CTIME, N_DEPTH, N_EXEC, N_EXPR, N_FOLLOW,
- N_FSTYPE, N_GROUP, N_INUM, N_LINKS, N_LS, N_MTIME, N_NAME, N_NEWER,
- N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PATH,
- N_PERM, N_PRINT, N_PRINT0, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV,
-};
+#include <regex.h>
+
+/* forward declarations */
+struct _plandata;
+struct _option;
+
+/* execute function */
+typedef int exec_f __P((struct _plandata *, FTSENT *));
+/* create function */
+typedef struct _plandata *creat_f(struct _option *, char ***);
+
+/* function modifiers */
+#define F_NEEDOK 0x00000001 /* -ok vs. -exec */
+#define F_EXECDIR 0x00000002 /* -execdir vs. -exec */
+#define F_TIME_A 0x00000004 /* one of -atime, -anewer, -newera* */
+#define F_TIME_C 0x00000008 /* one of -ctime, -cnewer, -newerc* */
+#define F_TIME2_A 0x00000010 /* one of -newer?a */
+#define F_TIME2_C 0x00000020 /* one of -newer?c */
+#define F_TIME2_T 0x00000040 /* one of -newer?t */
+#define F_MAXDEPTH F_TIME_A /* maxdepth vs. mindepth */
+/* command line function modifiers */
+#define F_EQUAL 0x00000000 /* [acm]min [acm]time inum links size */
+#define F_LESSTHAN 0x00000100
+#define F_GREATER 0x00000200
+#define F_ELG_MASK 0x00000300
+#define F_ATLEAST 0x00000400 /* flags perm */
+#define F_ANY 0x00000800 /* perm */
+#define F_MTMASK 0x00003000
+#define F_MTFLAG 0x00000000 /* fstype */
+#define F_MTTYPE 0x00001000
+#define F_IGNCASE 0x00010000 /* iname ipath iregex */
/* node definition */
typedef struct _plandata {
- struct _plandata *next; /* next node */
- int (*eval) /* node evaluation function */
- __P((struct _plandata *, FTSENT *));
-#define F_EQUAL 1 /* [acm]time inum links size */
-#define F_LESSTHAN 2
-#define F_GREATER 3
-#define F_NEEDOK 1 /* exec ok */
-#define F_MTFLAG 1 /* fstype */
-#define F_MTTYPE 2
-#define F_ATLEAST 1 /* perm */
- int flags; /* private flags */
- enum ntype type; /* plan node type */
+ struct _plandata *next; /* next node */
+ exec_f *execute; /* node evaluation function */
+ int flags; /* private flags */
union {
- gid_t _g_data; /* gid */
- ino_t _i_data; /* inode */
- mode_t _m_data; /* mode mask */
+ gid_t _g_data; /* gid */
+ ino_t _i_data; /* inode */
+ mode_t _m_data; /* mode mask */
+ struct {
+ u_long _f_flags;
+ u_long _f_notflags;
+ } fl;
nlink_t _l_data; /* link count */
off_t _o_data; /* file size */
time_t _t_data; /* time value */
} ex;
char *_a_data[2]; /* array of char pointers */
char *_c_data; /* char pointer */
+ regex_t *_re_data; /* regex */
} p_un;
} PLAN;
#define a_data p_un._a_data
#define c_data p_un._c_data
-#define i_data p_un._i_data
+#define fl_flags p_un.fl._f_flags
+#define fl_notflags p_un.fl._f_notflags
#define g_data p_un._g_data
+#define i_data p_un._i_data
#define l_data p_un._l_data
#define m_data p_un._m_data
#define mt_data p_un._mt_data
#define p_data p_un._p_data
#define t_data p_un._t_data
#define u_data p_un._u_data
+#define re_data p_un._re_data
#define e_argv p_un.ex._e_argv
#define e_orig p_un.ex._e_orig
#define e_len p_un.ex._e_len
typedef struct _option {
char *name; /* option name */
- enum ntype token; /* token type */
- PLAN *(*create) /* create function */
- __P((char ***, int));
- int arg; /* function needs arg */
+ creat_f *create; /* create function */
+ exec_f *execute; /* execute function */
+ int flags;
} OPTION;
#include "extern.h"