xref: /titanic_44/usr/src/lib/libast/common/include/find.h (revision 160abee025ef30c34521b981edd40ffcaab560aa)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *           Copyright (c) 1985-2007 AT&T Knowledge Ventures            *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                      by AT&T Knowledge Ventures                      *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 /*
24  * Glenn Fowler
25  * AT&T Research
26  *
27  * fast find interface definitions
28  */
29 
30 #ifndef _FIND_H
31 #define _FIND_H
32 
33 #define FIND_VERSION	19980301L
34 
35 #ifndef FIND_CODES
36 #define FIND_CODES	"lib/find/codes"
37 #endif
38 
39 #define FIND_CODES_ENV	"FINDCODES"
40 
41 #define FIND_GENERATE	(1<<0)		/* generate new codes		*/
42 #define FIND_ICASE	(1<<1)		/* ignore case in match		*/
43 #define FIND_GNU	(1<<2)		/* generate gnu format codes	*/
44 #define FIND_OLD	(1<<3)		/* generate old format codes	*/
45 #define FIND_TYPE	(1<<4)		/* generate type with codes	*/
46 #define FIND_VERIFY	(1<<5)		/* verify the dir hierarchy	*/
47 
48 #define FIND_USER	(1L<<16)	/* first user flag bit		*/
49 
50 struct Find_s;
51 struct Finddisc_s;
52 
53 typedef int (*Findverify_f)(struct Find_s*, const char*, size_t, struct Finddisc_s*);
54 
55 typedef struct Finddisc_s
56 {
57 	unsigned long	version;	/* interface version		*/
58 	unsigned long	flags;		/* FIND_* flags			*/
59 	Error_f		errorf;		/* error function		*/
60 	Findverify_f	verifyf;	/* dir verify function		*/
61 	char**		dirs;		/* dir prefixes to search	*/
62 } Finddisc_t;
63 
64 typedef struct Find_s
65 {
66 	const char*	id;		/* library id string		*/
67 	unsigned long	stamp;		/* codes time stamp		*/
68 
69 #ifdef _FIND_PRIVATE_
70 	_FIND_PRIVATE_
71 #endif
72 
73 } Find_t;
74 
75 #if _BLD_ast && defined(__EXPORT__)
76 #define extern		__EXPORT__
77 #endif
78 
79 extern Find_t*		findopen(const char*, const char*, const char*, Finddisc_t*);
80 extern char*		findread(Find_t*);
81 extern int		findwrite(Find_t*, const char*, size_t, const char*);
82 extern int		findclose(Find_t*);
83 
84 #undef	extern
85 
86 #endif
87