find.h revision 30395
11590Srgrimes/*- 21590Srgrimes * Copyright (c) 1990, 1993 31590Srgrimes * The Regents of the University of California. All rights reserved. 41590Srgrimes * 51590Srgrimes * This code is derived from software contributed to Berkeley by 61590Srgrimes * Cimarron D. Taylor of the University of California, Berkeley. 71590Srgrimes * 81590Srgrimes * Redistribution and use in source and binary forms, with or without 91590Srgrimes * modification, are permitted provided that the following conditions 101590Srgrimes * are met: 111590Srgrimes * 1. Redistributions of source code must retain the above copyright 121590Srgrimes * notice, this list of conditions and the following disclaimer. 131590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141590Srgrimes * notice, this list of conditions and the following disclaimer in the 151590Srgrimes * documentation and/or other materials provided with the distribution. 161590Srgrimes * 3. All advertising materials mentioning features or use of this software 171590Srgrimes * must display the following acknowledgement: 181590Srgrimes * This product includes software developed by the University of 191590Srgrimes * California, Berkeley and its contributors. 201590Srgrimes * 4. Neither the name of the University nor the names of its contributors 211590Srgrimes * may be used to endorse or promote products derived from this software 221590Srgrimes * without specific prior written permission. 231590Srgrimes * 241590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341590Srgrimes * SUCH DAMAGE. 351590Srgrimes * 361590Srgrimes * @(#)find.h 8.1 (Berkeley) 6/6/93 371590Srgrimes */ 381590Srgrimes 391590Srgrimes/* node type */ 401590Srgrimesenum ntype { 411590Srgrimes N_AND = 1, /* must start > 0 */ 4230395Swosch N_AMIN, N_ATIME, N_CLOSEPAREN, N_CMIN, N_CTIME, N_DEPTH, 4330395Swosch N_EXEC, N_EXECDIR, N_EXPR, 4430395Swosch N_FOLLOW, N_FSTYPE, N_GROUP, N_INUM, N_LINKS, N_LS, N_MMIN, 4530395Swosch N_MTIME, N_NAME, 4628914Simp N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK, N_OPENPAREN, N_OR, N_PATH, 471590Srgrimes N_PERM, N_PRINT, N_PRUNE, N_SIZE, N_TYPE, N_USER, N_XDEV, 4818681Speter N_PRINT0, N_DELETE 491590Srgrimes}; 501590Srgrimes 511590Srgrimes/* node definition */ 521590Srgrimestypedef struct _plandata { 531590Srgrimes struct _plandata *next; /* next node */ 541590Srgrimes int (*eval) /* node evaluation function */ 551590Srgrimes __P((struct _plandata *, FTSENT *)); 561590Srgrimes#define F_EQUAL 1 /* [acm]time inum links size */ 571590Srgrimes#define F_LESSTHAN 2 581590Srgrimes#define F_GREATER 3 591590Srgrimes#define F_NEEDOK 1 /* exec ok */ 601590Srgrimes#define F_MTFLAG 1 /* fstype */ 611590Srgrimes#define F_MTTYPE 2 621590Srgrimes#define F_ATLEAST 1 /* perm */ 631590Srgrimes int flags; /* private flags */ 641590Srgrimes enum ntype type; /* plan node type */ 651590Srgrimes union { 661590Srgrimes gid_t _g_data; /* gid */ 671590Srgrimes ino_t _i_data; /* inode */ 681590Srgrimes mode_t _m_data; /* mode mask */ 691590Srgrimes nlink_t _l_data; /* link count */ 701590Srgrimes off_t _o_data; /* file size */ 711590Srgrimes time_t _t_data; /* time value */ 721590Srgrimes uid_t _u_data; /* uid */ 731590Srgrimes short _mt_data; /* mount flags */ 741590Srgrimes struct _plandata *_p_data[2]; /* PLAN trees */ 751590Srgrimes struct _ex { 761590Srgrimes char **_e_argv; /* argv array */ 771590Srgrimes char **_e_orig; /* original strings */ 781590Srgrimes int *_e_len; /* allocated length */ 791590Srgrimes } ex; 801590Srgrimes char *_a_data[2]; /* array of char pointers */ 811590Srgrimes char *_c_data; /* char pointer */ 821590Srgrimes } p_un; 831590Srgrimes} PLAN; 841590Srgrimes#define a_data p_un._a_data 851590Srgrimes#define c_data p_un._c_data 861590Srgrimes#define i_data p_un._i_data 871590Srgrimes#define g_data p_un._g_data 881590Srgrimes#define l_data p_un._l_data 891590Srgrimes#define m_data p_un._m_data 901590Srgrimes#define mt_data p_un._mt_data 911590Srgrimes#define o_data p_un._o_data 921590Srgrimes#define p_data p_un._p_data 931590Srgrimes#define t_data p_un._t_data 941590Srgrimes#define u_data p_un._u_data 951590Srgrimes#define e_argv p_un.ex._e_argv 961590Srgrimes#define e_orig p_un.ex._e_orig 971590Srgrimes#define e_len p_un.ex._e_len 981590Srgrimes 991590Srgrimestypedef struct _option { 1001590Srgrimes char *name; /* option name */ 1011590Srgrimes enum ntype token; /* token type */ 1021590Srgrimes PLAN *(*create)(); /* create function: DON'T PROTOTYPE! */ 1031590Srgrimes#define O_NONE 0x01 /* no call required */ 1041590Srgrimes#define O_ZERO 0x02 /* pass: nothing */ 1051590Srgrimes#define O_ARGV 0x04 /* pass: argv, increment argv */ 10628914Simp#define O_ARGVP 0x08 /* pass: *argv, N_OK || N_EXEC || N_EXECDIR */ 1071590Srgrimes int flags; 1081590Srgrimes} OPTION; 1091590Srgrimes 1101590Srgrimes#include "extern.h" 111