home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / Sys / STAT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  3.5 KB  |  148 lines

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