xref: /illumos-gate/usr/src/contrib/ast/src/lib/libast/include/ftwalk.h (revision b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2011 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                 Eclipse Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *          http://www.eclipse.org/org/documents/epl-v10.html           *
11 *         (with md5 checksum b35adb5213ca9657e911e9befb180842)         *
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  * Phong Vo
25  * Glenn Fowler
26  * AT&T Research
27  *
28  * ast ftwalk interface definitions
29  * ftwalk was the initial improvement on ftw and nftw
30  * which formed the basis for the POSIX fts proposal
31  *
32  * NOTE: this file is in cahoots with the fts implementation
33  */
34 
35 #ifndef _FTWALK_H
36 #define _FTWALK_H
37 
38 #define fts_info	info
39 #define fts_level	level
40 #define fts_link	link
41 #define fts_name	name
42 #define fts_namelen	namelen
43 #define fts_parent	parent
44 #define fts_path	path
45 #define fts_pathlen	pathlen
46 #define _fts_status	status
47 #define _fts_statb	statb
48 
49 #define FTSENT		Ftw_t			/* <fts.h> internal	*/
50 #define Ftsent		FTW			/* <fts.h> internal	*/
51 
52 #define _FTSENT_LOCAL_PRIVATE_			/* <fts.h> internal	*/ \
53 	union								   \
54 	{								   \
55 	long		number;			/* local numeric value	*/ \
56 	void*		pointer;		/* local pointer value	*/ \
57 	}		local;
58 
59 #include <fts.h>
60 
61 /*
62  * ftwalk() argument flags
63  */
64 
65 #define FTW_CANON	FTS_CANON
66 #define FTW_CHILDREN	(FTS_USER<<0)
67 #define FTW_DELAY	FTS_NOSTAT
68 #define FTW_DOT		FTS_NOCHDIR
69 #define FTW_META	FTS_META
70 #define FTW_MOUNT	FTS_XDEV
71 #define FTW_MULTIPLE	FTS_ONEPATH
72 #define FTW_NOSEEDOTDIR	FTS_NOSEEDOTDIR
73 #define FTW_PHYSICAL	FTS_PHYSICAL
74 #define FTW_POST	(FTS_USER<<1)
75 #define FTW_SEEDOTDIR	FTS_SEEDOTDIR
76 #define FTW_TOP		FTS_TOP
77 #define FTW_TWICE	(FTS_USER<<2)
78 #define FTW_USER	(FTS_USER<<3)
79 
80 /*
81  * Ftw_t.info type bits
82  */
83 
84 #define FTW_C		FTS_C
85 #define FTW_D		FTS_D
86 #define FTW_DC		FTS_DC
87 #define FTW_DNR		FTS_DNR
88 #define FTW_DNX		FTS_DNX
89 #define FTW_DP		FTS_DP
90 #define FTW_F		FTS_F
91 #define FTW_NR		FTS_NR
92 #define FTW_NS		FTS_NS
93 #define FTW_NSOK	FTS_NSOK
94 #define FTW_NX		FTS_NX
95 #define FTW_P		FTS_P
96 #define FTW_SL		FTS_SL
97 
98 /*
99  * Ftw_t.status entry values
100  */
101 
102 #define FTW_NAME	FTS_DOT		/* access by Ftw_t.name		*/
103 #define FTW_PATH	FTS_NOCHDIR	/* access by Ftw_t.path		*/
104 
105 /*
106  * Ftw_t.status return values
107  */
108 
109 #define FTW_AGAIN	FTS_AGAIN
110 #define FTW_FOLLOW	FTS_FOLLOW
111 #define FTW_NOPOST	FTS_NOPOSTORDER
112 #define FTW_SKIP	FTS_SKIP
113 #define FTW_STAT	FTS_STAT
114 
115 #if _BLD_ast && defined(__EXPORT__)
116 #define extern		__EXPORT__
117 #endif
118 
119 extern int	ftwalk(const char*, int(*)(Ftw_t*), int, int(*)(Ftw_t*, Ftw_t*));
120 extern int	ftwflags(void);
121 
122 #undef	extern
123 
124 #endif
125