xref: /titanic_50/usr/src/lib/libast/common/include/ftwalk.h (revision 3db3491215579980a91e230cf21b20608fbb8259)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2008 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
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  * 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 
47 #define FTSENT		Ftw_t			/* <fts.h> internal	*/
48 #define Ftsent		FTW			/* <fts.h> internal	*/
49 
50 #define _FTSENT_LOCAL_PRIVATE_			/* <fts.h> internal	*/ \
51 	union								   \
52 	{								   \
53 	long		number;			/* local numeric value	*/ \
54 	void*		pointer;		/* local pointer value	*/ \
55 	}		local;
56 
57 #define _FTSENT_PRIVATE_			/* fts internal		*/ \
58 	short		status;			/* internal status	*/ \
59 	struct stat	statb;			/* fts_statp data	*/
60 
61 #include <fts.h>
62 
63 /*
64  * ftwalk() argument flags
65  */
66 
67 #define FTW_CANON	FTS_CANON
68 #define FTW_CHILDREN	(FTS_USER<<0)
69 #define FTW_DELAY	FTS_NOSTAT
70 #define FTW_DOT		FTS_NOCHDIR
71 #define FTW_META	FTS_META
72 #define FTW_MOUNT	FTS_XDEV
73 #define FTW_MULTIPLE	FTS_ONEPATH
74 #define FTW_NOSEEDOTDIR	FTS_NOSEEDOTDIR
75 #define FTW_PHYSICAL	FTS_PHYSICAL
76 #define FTW_POST	(FTS_USER<<1)
77 #define FTW_SEEDOTDIR	FTS_SEEDOTDIR
78 #define FTW_TOP		FTS_TOP
79 #define FTW_TWICE	(FTS_USER<<2)
80 #define FTW_USER	(FTS_USER<<3)
81 
82 /*
83  * Ftw_t.info type bits
84  */
85 
86 #define FTW_C		FTS_C
87 #define FTW_D		FTS_D
88 #define FTW_DC		FTS_DC
89 #define FTW_DNR		FTS_DNR
90 #define FTW_DNX		FTS_DNX
91 #define FTW_DP		FTS_DP
92 #define FTW_F		FTS_F
93 #define FTW_NR		FTS_NR
94 #define FTW_NS		FTS_NS
95 #define FTW_NSOK	FTS_NSOK
96 #define FTW_NX		FTS_NX
97 #define FTW_P		FTS_P
98 #define FTW_SL		FTS_SL
99 
100 /*
101  * Ftw_t.status entry values
102  */
103 
104 #define FTW_NAME	FTS_DOT		/* access by Ftw_t.name		*/
105 #define FTW_PATH	FTS_NOCHDIR	/* access by Ftw_t.path		*/
106 
107 /*
108  * Ftw_t.status return values
109  */
110 
111 #define FTW_AGAIN	FTS_AGAIN
112 #define FTW_FOLLOW	FTS_FOLLOW
113 #define FTW_NOPOST	FTS_NOPOSTORDER
114 #define FTW_SKIP	FTS_SKIP
115 #define FTW_STAT	FTS_STAT
116 
117 #if _BLD_ast && defined(__EXPORT__)
118 #define extern		__EXPORT__
119 #endif
120 
121 extern int	ftwalk(const char*, int(*)(Ftw_t*), int, int(*)(Ftw_t*, Ftw_t*));
122 extern int	ftwflags(void);
123 
124 #undef	extern
125 
126 #endif
127