Back to index

lightning-sunbird  0.9+nobinonly
winfile.h
Go to the documentation of this file.
00001 
00002 /* ---------------------------------------------------------------------------
00003     Stuff to fake unix file I/O on windows boxes
00004     ------------------------------------------------------------------------*/
00005 
00006 #ifndef WINFILE_H
00007 #define WINFILE_H
00008 
00009 #ifdef _WINDOWS
00010 /* hacked out of <dirent.h> on an SGI */
00011 #if defined(XP_WIN32) || defined(_WIN32)
00012 /* 32-bit stuff here */
00013 #include <windows.h>
00014 #include <stdlib.h>
00015 #ifdef __MINGW32__
00016 #include <sys/types.h>
00017 #include <sys/stat.h>
00018 #else
00019 #include <sys\types.h>
00020 #include <sys\stat.h>
00021 #endif
00022 
00023 typedef struct DIR_Struct {
00024     void            * directoryPtr;
00025     WIN32_FIND_DATA   data;
00026 } DIR;
00027 
00028 #define _ST_FSTYPSZ 16
00029 
00030 #if !defined(__BORLANDC__) && !defined(__GNUC__)
00031  typedef unsigned long mode_t;
00032  typedef          long uid_t;
00033  typedef          long gid_t;
00034 
00035 #ifdef WINCE
00036  typedef          long ino_t;
00037 #else
00038  typedef          long off_t;
00039 #endif
00040 
00041  typedef unsigned long nlink_t;
00042 #endif 
00043 
00044 typedef struct timestruc {
00045     time_t  tv_sec;         /* seconds */
00046     long    tv_nsec;        /* and nanoseconds */
00047 } timestruc_t;
00048 
00049 
00050 struct dirent {                                 /* data from readdir() */
00051         ino_t           d_ino;                  /* inode number of entry */
00052         off_t           d_off;                  /* offset of disk direntory entry */
00053         unsigned short  d_reclen;               /* length of this record */
00054         char            d_name[_MAX_FNAME];     /* name of file */
00055 };
00056 
00057 #if !defined(__BORLANDC__) && !defined (__GNUC__)
00058 #define S_ISDIR(s)  ((s) & _S_IFDIR)
00059 #endif
00060 
00061 #else /* _WIN32 */
00062 /* 16-bit windows stuff */
00063 
00064 #include <sys\types.h>
00065 #include <sys\stat.h>
00066 #include <dos.h>
00067 
00068 
00069 
00070 /*     Getting cocky to support multiple file systems */
00071 typedef struct       dirStruct_tag {
00072        struct _find_t       file_data;
00073        char                 c_checkdrive;
00074 } dirStruct;
00075 
00076 typedef struct DIR_Struct {
00077     void            * directoryPtr;
00078     dirStruct         data;
00079 } DIR;
00080 
00081 #define _ST_FSTYPSZ 16
00082 typedef unsigned long mode_t;
00083 typedef          long uid_t;
00084 typedef          long gid_t;
00085 typedef          long off_t;
00086 typedef unsigned long nlink_t;
00087 
00088 typedef struct timestruc {
00089     time_t  tv_sec;         /* seconds */
00090     long    tv_nsec;        /* and nanoseconds */
00091 } timestruc_t;
00092 
00093 struct dirent {                             /* data from readdir() */
00094         ino_t           d_ino;              /* inode number of entry */
00095         off_t           d_off;              /* offset of disk direntory entry */
00096         unsigned short  d_reclen;           /* length of this record */
00097 #ifdef XP_WIN32
00098         char            d_name[_MAX_FNAME]; /* name of file */
00099 #else
00100         char            d_name[20]; /* name of file */
00101 #endif
00102 };
00103 
00104 #define S_ISDIR(s)  ((s) & _S_IFDIR)
00105 
00106 #endif /* 16-bit windows */
00107 
00108 #define CONST const
00109 
00110 #endif /* _WINDOWS */
00111 
00112 #endif /* WINFILE_H */