home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / Sys / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  3.4 KB  |  147 lines

  1. /*  stat.h
  2.  
  3.     Definitions used for file status functions
  4. */
  5.  
  6. /*
  7.  *      C/C++ Run Time Library - Version 10.0
  8.  *
  9.  *      Copyright (c) 1987, 2000 by Inprise Corporation
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13.  
  14. /* $Revision:   9.6  $ */
  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.  
  103. /* Define MS compatible names
  104. */
  105. #define _S_IFMT   S_IFMT
  106. #define _S_IFDIR  S_IFDIR
  107. #define _S_IFIFO  S_IFIFO
  108. #define _S_IFCHR  S_IFCHR
  109. #define _S_IFBLK  S_IFBLK
  110. #define _S_IFREG  S_IFREG
  111. #define _S_IREAD  S_IREAD
  112. #define _S_IWRITE S_IWRITE
  113. #define _S_IEXEC  S_IEXEC
  114.  
  115. struct  _stat
  116. {
  117.     short st_dev;
  118.     short st_ino;
  119.     short st_mode;
  120.     short st_nlink;
  121.     int   st_uid;
  122.     int   st_gid;
  123.     short st_rdev;
  124.     long  st_size;
  125.     long  st_atime;
  126.     long  st_mtime;
  127.     long  st_ctime;
  128. };
  129.  
  130.  
  131. int  _RTLENTRY _EXPFUNC _fstat(int __handle, struct _stat  *__statbuf);
  132. int  _RTLENTRY _EXPFUNC fstat(int __handle, struct stat  *__statbuf);
  133. int  _RTLENTRY _EXPFUNC _wstat(const wchar_t *__path, struct _stat *__statbuf);
  134. int  _RTLENTRY _EXPFUNC _stati64(const char *__path, struct stati64 *__statbuf);
  135. int  _RTLENTRY _EXPFUNC _wstati64(const wchar_t *__path, struct stati64 *__statbuf);
  136. int  _RTLENTRY _EXPFUNC _stat(const char  *__path, struct _stat  *__statbuf);
  137. #if !defined(__STDC__) && (__BORLANDC__  >= 0x0520)
  138. int  _RTLENTRY _EXPFUNC stat(const char *__path, struct stat  *__statbuf);
  139. #endif  /* __STDC__ && __BORLANDC__ */
  140.  
  141.  
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145.  
  146. #endif  /* __STAT_H */
  147.