find.h revision 72945
11553Srgrimes/*- 21553Srgrimes * Copyright (c) 1990, 1993 31553Srgrimes * The Regents of the University of California. All rights reserved. 41553Srgrimes * 51553Srgrimes * This code is derived from software contributed to Berkeley by 61553Srgrimes * Cimarron D. Taylor of the University of California, Berkeley. 71553Srgrimes * 81553Srgrimes * Redistribution and use in source and binary forms, with or without 91553Srgrimes * modification, are permitted provided that the following conditions 101553Srgrimes * are met: 111553Srgrimes * 1. Redistributions of source code must retain the above copyright 121553Srgrimes * notice, this list of conditions and the following disclaimer. 131553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141553Srgrimes * notice, this list of conditions and the following disclaimer in the 151553Srgrimes * documentation and/or other materials provided with the distribution. 161553Srgrimes * 3. All advertising materials mentioning features or use of this software 171553Srgrimes * must display the following acknowledgement: 181553Srgrimes * This product includes software developed by the University of 191553Srgrimes * California, Berkeley and its contributors. 201553Srgrimes * 4. Neither the name of the University nor the names of its contributors 211553Srgrimes * may be used to endorse or promote products derived from this software 221553Srgrimes * without specific prior written permission. 231553Srgrimes * 241553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271553Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341553Srgrimes * SUCH DAMAGE. 351553Srgrimes * 361553Srgrimes * @(#)find.h 8.1 (Berkeley) 6/6/93 371553Srgrimes * $FreeBSD: head/usr.bin/find/find.h 72945 2001-02-23 16:20:55Z knu $ 381553Srgrimes */ 391553Srgrimes 401553Srgrimes#include <regex.h> 411553Srgrimes 4215648Sjoerg/* node type */ 431553Srgrimesenum ntype { 441553Srgrimes N_AND = 1, /* must start > 0 */ 451553Srgrimes N_AMIN, N_ATIME, N_CLOSEPAREN, N_CMIN, N_CTIME, N_DEPTH, 461553Srgrimes N_EMPTY, N_EXEC, N_EXECDIR, N_EXPR, N_FLAGS, 471553Srgrimes N_FOLLOW, N_FSTYPE, N_GROUP, N_INUM, N_LINKS, N_LS, N_MMIN, 481553Srgrimes N_MTIME, N_NAME, N_INAME, N_PATH, N_IPATH, N_REGEX, N_IREGEX, 491553Srgrimes N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, 501553Srgrimes N_PERM, N_PRINT, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV, 511553Srgrimes N_PRINT0, N_DELETE, N_MAXDEPTH, N_MINDEPTH 5215648Sjoerg}; 531553Srgrimes 541553Srgrimes/* node definition */ 551553Srgrimestypedef struct _plandata { 561553Srgrimes struct _plandata *next; /* next node */ 571553Srgrimes int (*eval) /* node evaluation function */ 581553Srgrimes __P((struct _plandata *, FTSENT *)); 591553Srgrimes#define F_EQUAL 1 /* [acm]time inum links size */ 601553Srgrimes#define F_LESSTHAN 2 611553Srgrimes#define F_GREATER 3 621553Srgrimes#define F_NEEDOK 1 /* exec ok */ 631553Srgrimes#define F_MTFLAG 1 /* fstype */ 641553Srgrimes#define F_MTTYPE 2 651553Srgrimes#define F_ATLEAST 1 /* perm */ 661553Srgrimes#define F_ANY 2 /* perm */ 671553Srgrimes int flags; /* private flags */ 681553Srgrimes enum ntype type; /* plan node type */ 691553Srgrimes union { 701553Srgrimes gid_t _g_data; /* gid */ 711553Srgrimes ino_t _i_data; /* inode */ 721553Srgrimes mode_t _m_data; /* mode mask */ 731553Srgrimes struct { 741553Srgrimes u_long _f_flags; 751553Srgrimes u_long _f_mask; 761553Srgrimes } fl; 771553Srgrimes nlink_t _l_data; /* link count */ 781553Srgrimes off_t _o_data; /* file size */ 791553Srgrimes time_t _t_data; /* time value */ 801553Srgrimes uid_t _u_data; /* uid */ 811553Srgrimes short _mt_data; /* mount flags */ 821553Srgrimes struct _plandata *_p_data[2]; /* PLAN trees */ 831553Srgrimes struct _ex { 841553Srgrimes char **_e_argv; /* argv array */ 851553Srgrimes char **_e_orig; /* original strings */ 861553Srgrimes int *_e_len; /* allocated length */ 871553Srgrimes } ex; 881553Srgrimes char *_a_data[2]; /* array of char pointers */ 891553Srgrimes char *_c_data; /* char pointer */ 901553Srgrimes regex_t *_re_data; /* regex */ 911553Srgrimes } p_un; 921553Srgrimes} PLAN; 931553Srgrimes#define a_data p_un._a_data 941553Srgrimes#define c_data p_un._c_data 951553Srgrimes#define fl_flags p_un.fl._f_flags 961553Srgrimes#define fl_mask p_un.fl._f_mask 971553Srgrimes#define g_data p_un._g_data 981553Srgrimes#define i_data p_un._i_data 991553Srgrimes#define l_data p_un._l_data 1001553Srgrimes#define m_data p_un._m_data 1011553Srgrimes#define mt_data p_un._mt_data 1021553Srgrimes#define o_data p_un._o_data 1031553Srgrimes#define p_data p_un._p_data 1041553Srgrimes#define t_data p_un._t_data 1051553Srgrimes#define u_data p_un._u_data 1061553Srgrimes#define re_data p_un._re_data 1071553Srgrimes#define e_argv p_un.ex._e_argv 1081553Srgrimes#define e_orig p_un.ex._e_orig 1091553Srgrimes#define e_len p_un.ex._e_len 1101553Srgrimes 1111553Srgrimestypedef struct _option { 1121553Srgrimes char *name; /* option name */ 1131553Srgrimes enum ntype token; /* token type */ 1141553Srgrimes PLAN *(*create)(); /* create function: DON'T PROTOTYPE! */ 1151553Srgrimes#define O_NONE 0x01 /* no call required */ 1161553Srgrimes#define O_ZERO 0x02 /* pass: nothing */ 1171553Srgrimes#define O_ARGV 0x04 /* pass: argv, increment argv */ 1181553Srgrimes#define O_ARGVP 0x08 /* pass: *argv, N_OK || N_EXEC || N_EXECDIR */ 1191553Srgrimes int flags; 1201553Srgrimes} OPTION; 1211553Srgrimes 1221553Srgrimes#include "extern.h" 1231553Srgrimes