home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / incsys.pak / STAT.H < prev    next >
Text File  |  1997-07-23  |  3KB  |  124 lines

  1. /*  stat.h
  2.  
  3.     Definitions used for file status functions
  4. */
  5.  
  6. /*
  7.  *      C/C++ Run Time Library - Version 6.5
  8.  *
  9.  *      Copyright (c) 1987, 1994 by Borland International
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13.  
  14. #if !defined(__STAT_H)
  15. #define __STAT_H
  16.  
  17. #if !defined(___DEFS_H)
  18. #include <_defs.h>
  19. #endif
  20.  
  21. #if !defined(__TYPES_H)
  22. #include <sys/types.h>
  23. #endif
  24.  
  25. /* Traditional names for bits in st_mode.
  26.  */
  27. #define S_IFMT  0xF000  /* file type mask */
  28. #define S_IFDIR 0x4000  /* directory */
  29. #define S_IFIFO 0x1000  /* FIFO special */
  30. #define S_IFCHR 0x2000  /* character special */
  31. #define S_IFBLK 0x3000  /* block special */
  32. #define S_IFREG 0x8000  /* or just 0x0000, regular */
  33. #define S_IREAD 0x0100  /* owner may read */
  34. #define S_IWRITE 0x0080 /* owner may write */
  35. #define S_IEXEC 0x0040  /* owner may execute <directory search> */
  36.  
  37. #if defined(__FLAT__)
  38. /* POSIX file type test macros.  The parameter is an st_mode value.
  39.  */
  40. #define S_ISDIR(m)  ((m) & S_IFDIR)
  41. #define S_ISCHR(m)  ((m) & S_IFCHR)
  42. #define S_ISBLK(m)  ((m) & S_IFBLK)
  43. #define S_ISREG(m)  ((m) & S_IFREG)
  44. #define S_ISFIFO(m) ((m) & S_IFIFO)
  45.  
  46. /* POSIX names for bits in st_mode.
  47.  */
  48. #define S_IRWXU  0x01c0 /* RWE permissions mask for owner */
  49. #define S_IRUSR  0x0100 /* owner may read */
  50. #define S_IWUSR  0x0080 /* owner may write */
  51. #define S_IXUSR  0x0040 /* owner may execute <directory search> */
  52.  
  53. #if !defined(_RC_INVOKED)
  54. #pragma pack(1)
  55. #endif
  56.  
  57. struct  stat
  58. {
  59.     dev_t   st_dev;
  60.     ino_t   st_ino;
  61.     mode_t  st_mode;
  62.     nlink_t st_nlink;
  63.     uid_t   st_uid;
  64.     gid_t   st_gid;
  65.     dev_t   st_rdev;
  66.     off_t   st_size;
  67.     time_t  st_atime;
  68.     time_t  st_mtime;
  69.     time_t  st_ctime;
  70. };
  71.  
  72. #if !defined(_RC_INVOKED)
  73. #pragma pack()
  74. #endif
  75.  
  76. #else
  77. struct  stat
  78. {
  79.     short st_dev;
  80.     short st_ino;
  81.     short st_mode;
  82.     short st_nlink;
  83.     int   st_uid;
  84.     int   st_gid;
  85.     short st_rdev;
  86.     long  st_size;
  87.     long  st_atime;
  88.     long  st_mtime;
  89.     long  st_ctime;
  90. };
  91. #endif  /* __FLAT__ */
  92.  
  93. #ifdef __cplusplus
  94. extern "C" {
  95. #endif
  96. int  _RTLENTRY _EXPFUNC fstat(int __handle, struct stat _FAR *__statbuf);
  97. int  _RTLENTRY _EXPFUNC stat(const char _FAR *__path, struct stat _FAR *__statbuf);
  98.  
  99. #ifdef __MSC
  100. #define _fstat(h,b) fstat(h,(struct stat *)b)
  101. #define _stat(p,b)   stat(p,(struct stat *)b)
  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. #endif
  117.  
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121.  
  122. #endif  /* __STAT_H */
  123.  
  124.