home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / dbm / include / winfile.h < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.6 KB  |  102 lines

  1.  
  2. /* ---------------------------------------------------------------------------
  3.     Stuff to fake unix file I/O on windows boxes
  4.     ------------------------------------------------------------------------*/
  5.  
  6. #ifndef WINFILE_H
  7. #define WINFILE_H
  8.  
  9. #ifdef _WINDOWS
  10. /* hacked out of <dirent.h> on an SGI */
  11. #if defined(XP_WIN32) || defined(_WIN32)
  12. /* 32-bit stuff here */
  13. #include <windows.h>
  14. #include <stdlib.h>
  15. #include <sys\types.h>
  16. #include <sys\stat.h>
  17.  
  18. typedef struct DIR_Struct {
  19.     void            * directoryPtr;
  20.     WIN32_FIND_DATA   data;
  21. } DIR;
  22.  
  23. #define _ST_FSTYPSZ 16
  24.  
  25. #ifndef __BORLANDC__
  26.  typedef unsigned long mode_t;
  27.  typedef          long uid_t;
  28.  typedef          long gid_t;
  29.  typedef          long off_t;
  30.  typedef unsigned long nlink_t;
  31. #endif 
  32.  
  33. typedef struct timestruc {
  34.     time_t  tv_sec;         /* seconds */
  35.     long    tv_nsec;        /* and nanoseconds */
  36. } timestruc_t;
  37.  
  38.  
  39. struct dirent {                                 /* data from readdir() */
  40.         ino_t           d_ino;                  /* inode number of entry */
  41.         off_t           d_off;                  /* offset of disk direntory entry */
  42.         unsigned short  d_reclen;               /* length of this record */
  43.         char            d_name[_MAX_FNAME];     /* name of file */
  44. };
  45.  
  46. #ifndef __BORLANDC__
  47. #define S_ISDIR(s)  ((s) & _S_IFDIR)
  48. #endif
  49.  
  50. #else /* _WIN32 */
  51. /* 16-bit windows stuff */
  52.  
  53. #include <sys\types.h>
  54. #include <sys\stat.h>
  55. #include <dos.h>
  56.  
  57.  
  58.  
  59. /*    Getting cocky to support multiple file systems */
  60. typedef struct    dirStruct_tag    {
  61.     struct _find_t    file_data;
  62.     char            c_checkdrive;
  63. } dirStruct;
  64.  
  65. typedef struct DIR_Struct {
  66.     void            * directoryPtr;
  67.     dirStruct         data;
  68. } DIR;
  69.  
  70. #define _ST_FSTYPSZ 16
  71. typedef unsigned long mode_t;
  72. typedef          long uid_t;
  73. typedef          long gid_t;
  74. typedef          long off_t;
  75. typedef unsigned long nlink_t;
  76.  
  77. typedef struct timestruc {
  78.     time_t  tv_sec;         /* seconds */
  79.     long    tv_nsec;        /* and nanoseconds */
  80. } timestruc_t;
  81.  
  82. struct dirent {                             /* data from readdir() */
  83.         ino_t           d_ino;              /* inode number of entry */
  84.         off_t           d_off;              /* offset of disk direntory entry */
  85.         unsigned short  d_reclen;           /* length of this record */
  86. #ifdef XP_WIN32
  87.         char            d_name[_MAX_FNAME]; /* name of file */
  88. #else
  89.         char            d_name[20]; /* name of file */
  90. #endif
  91. };
  92.  
  93. #define S_ISDIR(s)  ((s) & _S_IFDIR)
  94.  
  95. #endif /* 16-bit windows */
  96.  
  97. #define CONST const
  98.  
  99. #endif /* _WINDOWS */
  100.  
  101. #endif /* WINFILE_H */
  102.