home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / sys / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-16  |  4.1 KB  |  203 lines

  1. /***
  2. *sys/stat.h - defines structure used by stat() and fstat()
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file defines the structure used by the _stat() and _fstat()
  8. *       routines.
  9. *       [System V]
  10. *
  11. *       [Public]
  12. *
  13. ****/
  14.  
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18.  
  19. #ifndef _INC_STAT
  20. #define _INC_STAT
  21.  
  22. #if !defined(_WIN32) && !defined(_MAC)
  23. #error ERROR: Only Mac or Win32 targets supported!
  24. #endif
  25.  
  26.  
  27. #ifdef  _MSC_VER
  28. #pragma pack(push,8)
  29. #endif  /* _MSC_VER */
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35.  
  36.  
  37. /* Define _CRTIMP */
  38.  
  39. #ifndef _CRTIMP
  40. #ifdef  _DLL
  41. #define _CRTIMP __declspec(dllimport)
  42. #else   /* ndef _DLL */
  43. #define _CRTIMP
  44. #endif  /* _DLL */
  45. #endif  /* _CRTIMP */
  46.  
  47.  
  48. /* Define __cdecl for non-Microsoft compilers */
  49.  
  50. #if     ( !defined(_MSC_VER) && !defined(__cdecl) )
  51. #define __cdecl
  52. #endif
  53.  
  54. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  55.  
  56. #ifndef _CRTAPI1
  57. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  58. #define _CRTAPI1 __cdecl
  59. #else
  60. #define _CRTAPI1
  61. #endif
  62. #endif
  63.  
  64.  
  65. #include <sys/types.h>
  66.  
  67.  
  68. #ifndef _TIME_T_DEFINED
  69. typedef long time_t;
  70. #define _TIME_T_DEFINED
  71. #endif
  72.  
  73.  
  74. #ifdef _WIN32
  75. #ifndef _WCHAR_T_DEFINED
  76. typedef unsigned short wchar_t;
  77. #define _WCHAR_T_DEFINED
  78. #endif
  79. #endif /* _WIN32 */
  80.  
  81.  
  82. /* define structure for returning status information */
  83.  
  84. #ifndef _STAT_DEFINED
  85.  
  86. struct _stat {
  87.         _dev_t st_dev;
  88.         _ino_t st_ino;
  89.         unsigned short st_mode;
  90.         short st_nlink;
  91.         short st_uid;
  92.         short st_gid;
  93.         _dev_t st_rdev;
  94.         _off_t st_size;
  95.         time_t st_atime;
  96.         time_t st_mtime;
  97.         time_t st_ctime;
  98.         };
  99.  
  100. #if     !__STDC__
  101.  
  102. /* Non-ANSI names for compatibility */
  103.  
  104. struct stat {
  105.         _dev_t st_dev;
  106.         _ino_t st_ino;
  107.         unsigned short st_mode;
  108.         short st_nlink;
  109.         short st_uid;
  110.         short st_gid;
  111.         _dev_t st_rdev;
  112.         _off_t st_size;
  113.         time_t st_atime;
  114.         time_t st_mtime;
  115.         time_t st_ctime;
  116.         };
  117.  
  118. #endif  /* __STDC__ */
  119.  
  120. #if     _INTEGRAL_MAX_BITS >= 64
  121. struct _stati64 {
  122.         _dev_t st_dev;
  123.         _ino_t st_ino;
  124.         unsigned short st_mode;
  125.         short st_nlink;
  126.         short st_uid;
  127.         short st_gid;
  128.         _dev_t st_rdev;
  129.         __int64 st_size;
  130.         time_t st_atime;
  131.         time_t st_mtime;
  132.         time_t st_ctime;
  133.         };
  134. #endif
  135.  
  136. #define _STAT_DEFINED
  137. #endif
  138.  
  139.  
  140. #define _S_IFMT         0170000         /* file type mask */
  141. #define _S_IFDIR        0040000         /* directory */
  142. #define _S_IFCHR        0020000         /* character special */
  143. #define _S_IFIFO        0010000         /* pipe */
  144. #define _S_IFREG        0100000         /* regular */
  145. #define _S_IREAD        0000400         /* read permission, owner */
  146. #define _S_IWRITE       0000200         /* write permission, owner */
  147. #define _S_IEXEC        0000100         /* execute/search permission, owner */
  148.  
  149.  
  150. /* Function prototypes */
  151.  
  152. _CRTIMP int __cdecl _fstat(int, struct _stat *);
  153. _CRTIMP int __cdecl _stat(const char *, struct _stat *);
  154.  
  155. #if     _INTEGRAL_MAX_BITS >= 64
  156. _CRTIMP int __cdecl _fstati64(int, struct _stati64 *);
  157. _CRTIMP int __cdecl _stati64(const char *, struct _stati64 *);
  158. #endif
  159.  
  160. #ifdef _WIN32
  161. #ifndef _WSTAT_DEFINED
  162.  
  163. /* wide function prototypes, also declared in wchar.h  */
  164.  
  165. _CRTIMP int __cdecl _wstat(const wchar_t *, struct _stat *);
  166.  
  167. #if     _INTEGRAL_MAX_BITS >= 64
  168. _CRTIMP int __cdecl _wstati64(const wchar_t *, struct _stati64 *);
  169. #endif
  170.  
  171. #define _WSTAT_DEFINED
  172. #endif
  173. #endif /* _WIN32 */
  174.  
  175.  
  176. #if     !__STDC__
  177.  
  178. /* Non-ANSI names for compatibility */
  179.  
  180. #define S_IFMT   _S_IFMT
  181. #define S_IFDIR  _S_IFDIR
  182. #define S_IFCHR  _S_IFCHR
  183. #define S_IFREG  _S_IFREG
  184. #define S_IREAD  _S_IREAD
  185. #define S_IWRITE _S_IWRITE
  186. #define S_IEXEC  _S_IEXEC
  187.  
  188. _CRTIMP int __cdecl fstat(int, struct stat *);
  189. _CRTIMP int __cdecl stat(const char *, struct stat *);
  190.  
  191. #endif  /* __STDC__ */
  192.  
  193.  
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197.  
  198. #ifdef  _MSC_VER
  199. #pragma pack(pop)
  200. #endif  /* _MSC_VER */
  201.  
  202. #endif  /* _INC_STAT */
  203.