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