michael@0: michael@0: /* --------------------------------------------------------------------------- michael@0: Stuff to fake unix file I/O on windows boxes michael@0: ------------------------------------------------------------------------*/ michael@0: michael@0: #ifndef WINFILE_H michael@0: #define WINFILE_H michael@0: michael@0: #ifdef _WINDOWS michael@0: /* hacked out of on an SGI */ michael@0: #if defined(XP_WIN32) || defined(_WIN32) michael@0: /* 32-bit stuff here */ michael@0: #include michael@0: #include michael@0: #ifdef __MINGW32__ michael@0: #include michael@0: #include michael@0: #else michael@0: #include michael@0: #include michael@0: #endif michael@0: michael@0: typedef struct DIR_Struct { michael@0: void * directoryPtr; michael@0: WIN32_FIND_DATA data; michael@0: } DIR; michael@0: michael@0: #define _ST_FSTYPSZ 16 michael@0: michael@0: #if !defined(__BORLANDC__) && !defined(__GNUC__) michael@0: typedef unsigned long mode_t; michael@0: typedef long uid_t; michael@0: typedef long gid_t; michael@0: typedef long off_t; michael@0: typedef unsigned long nlink_t; michael@0: #endif michael@0: michael@0: typedef struct timestruc { michael@0: time_t tv_sec; /* seconds */ michael@0: long tv_nsec; /* and nanoseconds */ michael@0: } timestruc_t; michael@0: michael@0: michael@0: struct dirent { /* data from readdir() */ michael@0: ino_t d_ino; /* inode number of entry */ michael@0: off_t d_off; /* offset of disk direntory entry */ michael@0: unsigned short d_reclen; /* length of this record */ michael@0: char d_name[_MAX_FNAME]; /* name of file */ michael@0: }; michael@0: michael@0: #if !defined(__BORLANDC__) && !defined (__GNUC__) michael@0: #define S_ISDIR(s) ((s) & _S_IFDIR) michael@0: #endif michael@0: michael@0: #else /* _WIN32 */ michael@0: /* 16-bit windows stuff */ michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: michael@0: michael@0: /* Getting cocky to support multiple file systems */ michael@0: typedef struct dirStruct_tag { michael@0: struct _find_t file_data; michael@0: char c_checkdrive; michael@0: } dirStruct; michael@0: michael@0: typedef struct DIR_Struct { michael@0: void * directoryPtr; michael@0: dirStruct data; michael@0: } DIR; michael@0: michael@0: #define _ST_FSTYPSZ 16 michael@0: typedef unsigned long mode_t; michael@0: typedef long uid_t; michael@0: typedef long gid_t; michael@0: typedef long off_t; michael@0: typedef unsigned long nlink_t; michael@0: michael@0: typedef struct timestruc { michael@0: time_t tv_sec; /* seconds */ michael@0: long tv_nsec; /* and nanoseconds */ michael@0: } timestruc_t; michael@0: michael@0: struct dirent { /* data from readdir() */ michael@0: ino_t d_ino; /* inode number of entry */ michael@0: off_t d_off; /* offset of disk direntory entry */ michael@0: unsigned short d_reclen; /* length of this record */ michael@0: #ifdef XP_WIN32 michael@0: char d_name[_MAX_FNAME]; /* name of file */ michael@0: #else michael@0: char d_name[20]; /* name of file */ michael@0: #endif michael@0: }; michael@0: michael@0: #define S_ISDIR(s) ((s) & _S_IFDIR) michael@0: michael@0: #endif /* 16-bit windows */ michael@0: michael@0: #define CONST const michael@0: michael@0: #endif /* _WINDOWS */ michael@0: michael@0: #endif /* WINFILE_H */