home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved.
- *
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE
- * SANTA CRUZ OPERATION INC.
- *
- * The copyright notice above does not evidence any actual or intended
- * publication of such source code.
- */
-
- #ifndef _FTW_H
- #define _FTW_H
- #ident "@(#)sgs-head:common/head/ftw.h 1.3.1.26"
-
- #include <sys/stat.h>
-
- #define FTW_F 0 /* file */
- #define FTW_D 1 /* directory */
- #define FTW_DNR 2 /* directory without read permission */
- #define FTW_NS 3 /* unknown type, stat failed */
- #define FTW_SL 4 /* symbolic link */
- #define FTW_DP 6 /* directory */
- #define FTW_SLN 7 /* symbolic link to nonexistent file */
- #define FTW_ERR 8 /* FTW_ERRORS only; internal nftw() failure */
-
- #define FTW_PHYS 01 /* use lstat instead of stat */
- #define FTW_MOUNT 02 /* do not cross a mount point */
- #define FTW_CHDIR 04 /* chdir to each directory before reading */
- #define FTW_DEPTH 010 /* call descendents before calling the parent */
- #define _FTW_FINDDIR 020 /* continue even if getcwd() fails */
- #define FTW_TRYCHDIR (FTW_CHDIR|_FTW_FINDDIR) /* for nftw() to try getcwd */
- #define FTW_ERRORS 040 /* call fcn for nftw() internal errors, too */
-
- #define FTW_SKD 1
- #define FTW_FOLLOW 2
- #define FTW_PRUNE 4
-
- #define _XFTW_R3_VER 1 /* SVID 2 stat */
- #define _XFTWVER 2 /* "native" EFT */
- #define _XFTWVER32 3 /* stat32 */
- #define _XFTWVER64 4 /* stat64 */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if defined(_LARGEFILE64_SOURCE) || defined(_FILE_OFFSET_BITS) \
- || !defined(_XOPEN_SOURCE) \
- || defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1
-
- struct FTW
- {
- #ifdef quit
- int __quit;
- #else
- int quit;
- #endif
- int base;
- int level;
- };
-
- #ifdef _STYPES
-
- #include <errno.h>
-
- static int
- nftw(const char *__p,
- int (*__f)(const char *, const stat_t *, int, struct FTW *),
- int __d, int __i)
- {
- errno = EINVAL;
- return -1;
- }
-
- #else /*!_STYPES*/
-
- extern int nftw(const char *,
- int (*)(const char *, const stat_t *, int, struct FTW *), int, int);
-
- #endif /*_STYPES*/
-
- #endif /*defined(_LARGEFILE64_SOURCE) || ...*/
-
- extern int _xftw(int, const char *, int (*)(), int);
-
- #if defined(_EFTSAFE) || defined(_FILE_OFFSET_BITS) || defined(_STYPES)
- extern int ftw(const char *, int (*)(const char *, const stat_t *, int), int);
- #else
- static int ftw(const char *__p,
- int (*__f)(const char *, const stat_t *, int), int __d)
- {
- return _xftw(_XFTWVER, __p, (int (*)())__f, __d);
- }
- #endif
-
- #if !defined(_STYPES) && (!defined(_XOPEN_SOURCE) \
- || defined(_LARGEFILE64_SOURCE) || defined(_FILE_OFFSET_BITS))
-
- extern int ftw32(const char *,
- int (*)(const char *, const stat32_t *, int), int);
- extern int ftw64(const char *,
- int (*)(const char *, const stat64_t *, int), int);
- extern int nftw32(const char *,
- int (*)(const char *, const stat32_t *, int, struct FTW *), int, int);
- extern int nftw64(const char *,
- int (*)(const char *, const stat64_t *, int, struct FTW *), int, int);
-
- #if _FILE_OFFSET_BITS - 0 == 32
-
- #undef ftw
- #define ftw ftw32
- #undef nftw
- #define nftw nftw32
-
- #elif _FILE_OFFSET_BITS - 0 == 64
-
- #undef ftw
- #define ftw ftw64
- #undef nftw
- #define nftw nftw64
-
- #elif defined(_FILE_OFFSET_BITS)
-
- #error "_FILE_OFFSET_BITS, if defined, must be 32 or 64"
-
- #endif /*_FILE_OFFSET_BITS*/
-
- #endif /*!defined(_STYPES) && ...*/
-
- #if defined(_EFTSAFE) && !defined(_STYPES)
-
- #ifndef _FILE_OFFSET_BITS
- #undef ftw
- #define ftw(p,f,d) _xftw(_XFTWVER,p,(int (*)())(f),d)
- #endif
-
- #undef ftw32
- #define ftw32(p,f,d) _xftw(_XFTWVER32,p,(int (*)())(f),d)
- #undef ftw64
- #define ftw64(p,f,d) _xftw(_XFTWVER64,p,(int (*)())(f),d)
-
- #endif /*defined(_EFTSAFE) && !defined(_STYPES)*/
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /*_FTW_H*/
-