home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / sys / stat.h < prev    next >
C/C++ Source or Header  |  1998-06-17  |  5KB  |  217 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  /* _MSC_VER > 1000 */
  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  /* !defined (_WIN32) && !defined (_MAC) */
  25.  
  26. #ifndef _CRTBLD
  27. /* This version of the header files is NOT for user programs.
  28.  * It is intended for use when building the C runtimes ONLY.
  29.  * The version intended for public use will not have this message.
  30.  */
  31. #error ERROR: Use of C runtime library internal header file.
  32. #endif  /* _CRTBLD */
  33.  
  34. #ifdef _MSC_VER
  35. #pragma pack(push,8)
  36. #endif  /* _MSC_VER */
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif  /* __cplusplus */
  41.  
  42. #ifndef _INTERNAL_IFSTRIP_
  43. #include <cruntime.h>
  44. #endif  /* _INTERNAL_IFSTRIP_ */
  45.  
  46.  
  47. /* Define _CRTIMP */
  48.  
  49. #ifndef _CRTIMP
  50. #ifdef CRTDLL
  51. #define _CRTIMP __declspec(dllexport)
  52. #else  /* CRTDLL */
  53. #ifdef _DLL
  54. #define _CRTIMP __declspec(dllimport)
  55. #else  /* _DLL */
  56. #define _CRTIMP
  57. #endif  /* _DLL */
  58. #endif  /* CRTDLL */
  59. #endif  /* _CRTIMP */
  60.  
  61.  
  62. /* Define __cdecl for non-Microsoft compilers */
  63.  
  64. #if (!defined (_MSC_VER) && !defined (__cdecl))
  65. #define __cdecl
  66. #endif  /* (!defined (_MSC_VER) && !defined (__cdecl)) */
  67.  
  68. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  69.  
  70. #ifndef _CRTAPI1
  71. #if _MSC_VER >= 800 && _M_IX86 >= 300
  72. #define _CRTAPI1 __cdecl
  73. #else  /* _MSC_VER >= 800 && _M_IX86 >= 300 */
  74. #define _CRTAPI1
  75. #endif  /* _MSC_VER >= 800 && _M_IX86 >= 300 */
  76. #endif  /* _CRTAPI1 */
  77.  
  78.  
  79. #include <sys/types.h>
  80.  
  81.  
  82. #ifndef _TIME_T_DEFINED
  83. typedef long time_t;
  84. #define _TIME_T_DEFINED
  85. #endif  /* _TIME_T_DEFINED */
  86.  
  87.  
  88. #ifdef _WIN32
  89. #ifndef _WCHAR_T_DEFINED
  90. typedef unsigned short wchar_t;
  91. #define _WCHAR_T_DEFINED
  92. #endif  /* _WCHAR_T_DEFINED */
  93. #endif  /* _WIN32 */
  94.  
  95.  
  96. /* define structure for returning status information */
  97.  
  98. #ifndef _STAT_DEFINED
  99.  
  100. struct _stat {
  101.         _dev_t st_dev;
  102.         _ino_t st_ino;
  103.         unsigned short st_mode;
  104.         short st_nlink;
  105.         short st_uid;
  106.         short st_gid;
  107.         _dev_t st_rdev;
  108.         _off_t st_size;
  109.         time_t st_atime;
  110.         time_t st_mtime;
  111.         time_t st_ctime;
  112.         };
  113.  
  114. #if !__STDC__
  115.  
  116. /* Non-ANSI names for compatibility */
  117.  
  118. struct stat {
  119.         _dev_t st_dev;
  120.         _ino_t st_ino;
  121.         unsigned short st_mode;
  122.         short st_nlink;
  123.         short st_uid;
  124.         short st_gid;
  125.         _dev_t st_rdev;
  126.         _off_t st_size;
  127.         time_t st_atime;
  128.         time_t st_mtime;
  129.         time_t st_ctime;
  130.         };
  131.  
  132. #endif  /* !__STDC__ */
  133.  
  134. #if _INTEGRAL_MAX_BITS >= 64   
  135. struct _stati64 {
  136.         _dev_t st_dev;
  137.         _ino_t st_ino;
  138.         unsigned short st_mode;
  139.         short st_nlink;
  140.         short st_uid;
  141.         short st_gid;
  142.         _dev_t st_rdev;
  143.         __int64 st_size;
  144.         time_t st_atime;
  145.         time_t st_mtime;
  146.         time_t st_ctime;
  147.         };
  148. #endif  /* _INTEGRAL_MAX_BITS >= 64    */
  149.  
  150. #define _STAT_DEFINED
  151. #endif  /* _STAT_DEFINED */
  152.  
  153.  
  154. #define _S_IFMT         0170000         /* file type mask */
  155. #define _S_IFDIR        0040000         /* directory */
  156. #define _S_IFCHR        0020000         /* character special */
  157. #define _S_IFIFO        0010000         /* pipe */
  158. #define _S_IFREG        0100000         /* regular */
  159. #define _S_IREAD        0000400         /* read permission, owner */
  160. #define _S_IWRITE       0000200         /* write permission, owner */
  161. #define _S_IEXEC        0000100         /* execute/search permission, owner */
  162.  
  163.  
  164. /* Function prototypes */
  165.  
  166. _CRTIMP int __cdecl _fstat(int, struct _stat *);
  167. _CRTIMP int __cdecl _stat(const char *, struct _stat *);
  168.  
  169. #if _INTEGRAL_MAX_BITS >= 64   
  170. _CRTIMP int __cdecl _fstati64(int, struct _stati64 *);
  171. _CRTIMP int __cdecl _stati64(const char *, struct _stati64 *);
  172. #endif  /* _INTEGRAL_MAX_BITS >= 64    */
  173.  
  174. #ifdef _WIN32
  175. #ifndef _WSTAT_DEFINED
  176.  
  177. /* wide function prototypes, also declared in wchar.h  */
  178.  
  179. _CRTIMP int __cdecl _wstat(const wchar_t *, struct _stat *);
  180.  
  181. #if _INTEGRAL_MAX_BITS >= 64   
  182. _CRTIMP int __cdecl _wstati64(const wchar_t *, struct _stati64 *);
  183. #endif  /* _INTEGRAL_MAX_BITS >= 64    */
  184.  
  185. #define _WSTAT_DEFINED
  186. #endif  /* _WSTAT_DEFINED */
  187. #endif  /* _WIN32 */
  188.  
  189.  
  190. #if !__STDC__
  191.  
  192. /* Non-ANSI names for compatibility */
  193.  
  194. #define S_IFMT   _S_IFMT
  195. #define S_IFDIR  _S_IFDIR
  196. #define S_IFCHR  _S_IFCHR
  197. #define S_IFREG  _S_IFREG
  198. #define S_IREAD  _S_IREAD
  199. #define S_IWRITE _S_IWRITE
  200. #define S_IEXEC  _S_IEXEC
  201.  
  202. _CRTIMP int __cdecl fstat(int, struct stat *);
  203. _CRTIMP int __cdecl stat(const char *, struct stat *);
  204.  
  205. #endif  /* !__STDC__ */
  206.  
  207.  
  208. #ifdef __cplusplus
  209. }
  210. #endif  /* __cplusplus */
  211.  
  212. #ifdef _MSC_VER
  213. #pragma pack(pop)
  214. #endif  /* _MSC_VER */
  215.  
  216. #endif  /* _INC_STAT */
  217.