home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / STAT.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  4KB  |  170 lines

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