home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / STAT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-16  |  3.1 KB  |  141 lines

  1. /*  stat.h
  2.  
  3.     Definitions used for file status functions
  4. */
  5.  
  6. /* $Copyright: 1987$ */
  7. /* $Revision:   8.4  $ */
  8.  
  9. #if !defined(__STAT_H)
  10. #define __STAT_H
  11.  
  12. #if !defined(___DEFS_H)
  13. #include <_defs.h>
  14. #endif
  15.  
  16. #if !defined(__TYPES_H)
  17. #include <sys/types.h>
  18. #endif
  19.  
  20. #if defined  __FLAT__
  21. #ifndef _WCHAR_T_DEFINED
  22. typedef unsigned short wchar_t;
  23. #define _WCHAR_T_DEFINED
  24. #endif
  25. #endif /* __FLAT__ */
  26.  
  27. /* Traditional names for bits in st_mode.
  28.  */
  29. #define S_IFMT   0xF000  /* file type mask */
  30. #define S_IFDIR  0x4000  /* directory */
  31. #define S_IFIFO  0x1000  /* FIFO special */
  32. #define S_IFCHR  0x2000  /* character special */
  33. #define S_IFBLK  0x3000  /* block special */
  34. #define S_IFREG  0x8000  /* or just 0x0000, regular */
  35. #define S_IREAD  0x0100  /* owner may read */
  36. #define S_IWRITE 0x0080 /* owner may write */
  37. #define S_IEXEC  0x0040  /* owner may execute <directory search> */
  38.  
  39. #if defined(__FLAT__)
  40. /* POSIX file type test macros.  The parameter is an st_mode value.
  41.  */
  42. #define S_ISDIR(m)  ((m) & S_IFDIR)
  43. #define S_ISCHR(m)  ((m) & S_IFCHR)
  44. #define S_ISBLK(m)  ((m) & S_IFBLK)
  45. #define S_ISREG(m)  ((m) & S_IFREG)
  46. #define S_ISFIFO(m) ((m) & S_IFIFO)
  47.  
  48. /* POSIX names for bits in st_mode.
  49.  */
  50. #define S_IRWXU  0x01c0 /* RWE permissions mask for owner */
  51. #define S_IRUSR  0x0100 /* owner may read */
  52. #define S_IWUSR  0x0080 /* owner may write */
  53. #define S_IXUSR  0x0040 /* owner may execute <directory search> */
  54.  
  55. #if !defined(_RC_INVOKED)
  56. #pragma pack(1)
  57. #endif
  58.  
  59. struct  stat
  60. {
  61.     dev_t   st_dev;
  62.     ino_t   st_ino;
  63.     mode_t  st_mode;
  64.     nlink_t st_nlink;
  65.     uid_t   st_uid;
  66.     gid_t   st_gid;
  67.     dev_t   st_rdev;
  68.     off_t   st_size;
  69.     time_t  st_atime;
  70.     time_t  st_mtime;
  71.     time_t  st_ctime;
  72. };
  73.  
  74. #if !defined(_RC_INVOKED)
  75. #pragma pack()
  76. #endif
  77.  
  78. #else
  79. struct  stat
  80. {
  81.     short st_dev;
  82.     short st_ino;
  83.     short st_mode;
  84.     short st_nlink;
  85.     int   st_uid;
  86.     int   st_gid;
  87.     short st_rdev;
  88.     long  st_size;
  89.     long  st_atime;
  90.     long  st_mtime;
  91.     long  st_ctime;
  92. };
  93. #endif  /* __FLAT__ */
  94.  
  95. #ifdef __cplusplus
  96. extern "C" {
  97. #endif
  98. int  _RTLENTRY _EXPFUNC fstat(int __handle, struct stat _FAR *__statbuf);
  99. int  _RTLENTRY _EXPFUNC stat(const char _FAR *__path, struct stat _FAR *__statbuf);
  100. #if defined(__FLAT__)
  101. int  _RTLENTRY _EXPFUNC _wstat(const wchar_t *__path, struct stat *__statbuf);
  102. #endif
  103.  
  104. #ifdef __MSC
  105.  
  106. /* Define MS compatible names
  107. */
  108. #define _S_IFMT   S_IFMT
  109. #define _S_IFDIR  S_IFDIR
  110. #define _S_IFIFO  S_IFIFO
  111. #define _S_IFCHR  S_IFCHR
  112. #define _S_IFBLK  S_IFBLK
  113. #define _S_IFREG  S_IFREG
  114. #define _S_IREAD  S_IREAD
  115. #define _S_IWRITE S_IWRITE
  116. #define _S_IEXEC  S_IEXEC
  117.  
  118. #define _fstat(h,b) fstat(h,(struct stat *)b)
  119. #define _stat(p,b)   stat(p,(struct stat *)b)
  120. struct  _stat
  121. {
  122.     short st_dev;
  123.     short st_ino;
  124.     short st_mode;
  125.     short st_nlink;
  126.     int   st_uid;
  127.     int   st_gid;
  128.     short st_rdev;
  129.     long  st_size;
  130.     long  st_atime;
  131.     long  st_mtime;
  132.     long  st_ctime;
  133. };
  134. #endif
  135.  
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139.  
  140. #endif  /* __STAT_H */
  141.