home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / include / ftw.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-19  |  3.9 KB  |  149 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ifndef _FTW_H
  12. #define _FTW_H
  13. #ident    "@(#)sgs-head:common/head/ftw.h    1.3.1.26"
  14.  
  15. #include <sys/stat.h>
  16.  
  17. #define    FTW_F        0    /* file */
  18. #define    FTW_D        1    /* directory */
  19. #define    FTW_DNR        2    /* directory without read permission */
  20. #define    FTW_NS        3    /* unknown type, stat failed */
  21. #define FTW_SL        4    /* symbolic link */
  22. #define    FTW_DP        6    /* directory */
  23. #define FTW_SLN        7    /* symbolic link to nonexistent file */
  24. #define FTW_ERR        8    /* FTW_ERRORS only; internal nftw() failure */
  25.  
  26. #define FTW_PHYS    01    /* use lstat instead of stat */
  27. #define FTW_MOUNT    02    /* do not cross a mount point */
  28. #define FTW_CHDIR    04    /* chdir to each directory before reading */
  29. #define FTW_DEPTH    010    /* call descendents before calling the parent */
  30. #define _FTW_FINDDIR    020     /* continue even if getcwd() fails */
  31. #define FTW_TRYCHDIR    (FTW_CHDIR|_FTW_FINDDIR) /* for nftw() to try getcwd */
  32. #define FTW_ERRORS    040     /* call fcn for nftw() internal errors, too */
  33.  
  34. #define FTW_SKD        1
  35. #define FTW_FOLLOW    2
  36. #define FTW_PRUNE    4
  37.  
  38. #define _XFTW_R3_VER    1    /* SVID 2 stat */
  39. #define _XFTWVER    2    /* "native" EFT */
  40. #define _XFTWVER32    3    /* stat32 */
  41. #define _XFTWVER64    4    /* stat64 */
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if defined(_LARGEFILE64_SOURCE) || defined(_FILE_OFFSET_BITS) \
  48.     || !defined(_XOPEN_SOURCE) \
  49.     || defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1
  50.  
  51. struct FTW
  52. {
  53. #ifdef quit   
  54.     int    __quit;    
  55. #else
  56.     int    quit;
  57. #endif
  58.     int    base;
  59.     int    level;
  60. };
  61.  
  62. #ifdef _STYPES
  63.  
  64. #include <errno.h>
  65.  
  66. static int
  67. nftw(const char *__p,
  68.     int (*__f)(const char *, const stat_t *, int, struct FTW *),
  69.     int __d, int __i)
  70. {
  71.     errno = EINVAL;
  72.     return -1;
  73. }
  74.  
  75. #else /*!_STYPES*/
  76.  
  77. extern int nftw(const char *,
  78.     int (*)(const char *, const stat_t *, int, struct FTW *), int, int);
  79.  
  80. #endif /*_STYPES*/
  81.  
  82. #endif /*defined(_LARGEFILE64_SOURCE) || ...*/
  83.  
  84. extern int _xftw(int, const char *, int (*)(), int);
  85.  
  86. #if defined(_EFTSAFE) || defined(_FILE_OFFSET_BITS) || defined(_STYPES)
  87. extern int ftw(const char *, int (*)(const char *, const stat_t *, int), int);
  88. #else
  89. static int ftw(const char *__p,
  90.     int (*__f)(const char *, const stat_t *, int), int __d)
  91. {
  92.     return _xftw(_XFTWVER, __p, (int (*)())__f, __d);
  93. }
  94. #endif
  95.  
  96. #if !defined(_STYPES) && (!defined(_XOPEN_SOURCE) \
  97.     || defined(_LARGEFILE64_SOURCE) || defined(_FILE_OFFSET_BITS))
  98.  
  99. extern int ftw32(const char *,
  100.     int (*)(const char *, const stat32_t *, int), int);
  101. extern int ftw64(const char *,
  102.     int (*)(const char *, const stat64_t *, int), int);
  103. extern int nftw32(const char *,
  104.     int (*)(const char *, const stat32_t *, int, struct FTW *), int, int);
  105. extern int nftw64(const char *,
  106.     int (*)(const char *, const stat64_t *, int, struct FTW *), int, int);
  107.  
  108. #if _FILE_OFFSET_BITS - 0 == 32
  109.  
  110. #undef ftw
  111. #define ftw    ftw32
  112. #undef nftw
  113. #define nftw    nftw32
  114.  
  115. #elif _FILE_OFFSET_BITS - 0 == 64
  116.  
  117. #undef ftw
  118. #define ftw    ftw64
  119. #undef nftw
  120. #define nftw    nftw64
  121.  
  122. #elif defined(_FILE_OFFSET_BITS)
  123.  
  124. #error "_FILE_OFFSET_BITS, if defined, must be 32 or 64"
  125.  
  126. #endif /*_FILE_OFFSET_BITS*/
  127.  
  128. #endif /*!defined(_STYPES) && ...*/
  129.  
  130. #if defined(_EFTSAFE) && !defined(_STYPES)
  131.  
  132. #ifndef _FILE_OFFSET_BITS
  133. #undef ftw
  134. #define ftw(p,f,d)    _xftw(_XFTWVER,p,(int (*)())(f),d)
  135. #endif
  136.  
  137. #undef ftw32
  138. #define ftw32(p,f,d)    _xftw(_XFTWVER32,p,(int (*)())(f),d)
  139. #undef ftw64
  140. #define ftw64(p,f,d)    _xftw(_XFTWVER64,p,(int (*)())(f),d)
  141.  
  142. #endif /*defined(_EFTSAFE) && !defined(_STYPES)*/
  143.  
  144. #ifdef __cplusplus
  145. }
  146. #endif
  147.  
  148. #endif /*_FTW_H*/
  149.