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

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* ---------------------------------------------------------------------------
  20.     Stuff to fake unix file I/O on windows boxes
  21.     ------------------------------------------------------------------------*/
  22.  
  23. #ifndef WINFILE_H
  24. #define WINFILE_H
  25.  
  26. #ifdef _WINDOWS
  27. #if defined(XP_WIN32) || defined(_WIN32)
  28. /* 32-bit stuff here */
  29. #include <windows.h>
  30. #include <stdlib.h>
  31. #include <sys\types.h>
  32. #include <sys\stat.h>
  33.  
  34. typedef struct DIR_Struct {
  35.     void            * directoryPtr;
  36.     WIN32_FIND_DATA   data;
  37. } DIR;
  38.  
  39. #define _ST_FSTYPSZ 16
  40.  
  41. #ifndef __BORLANDC__
  42.  typedef unsigned long mode_t;
  43.  typedef          long uid_t;
  44.  typedef          long gid_t;
  45.  typedef          long off_t;
  46.  typedef unsigned long nlink_t;
  47. #endif 
  48.  
  49. typedef struct timestruc {
  50.     time_t  tv_sec;         /* seconds */
  51.     long    tv_nsec;        /* and nanoseconds */
  52. } timestruc_t;
  53.  
  54.  
  55. struct dirent {                                 /* data from readdir() */
  56.         ino_t           d_ino;                  /* inode number of entry */
  57.         off_t           d_off;                  /* offset of disk direntory entry */
  58.         unsigned short  d_reclen;               /* length of this record */
  59.         char            d_name[_MAX_FNAME];     /* name of file */
  60. };
  61.  
  62. #ifndef __BORLANDC__
  63. #define S_ISDIR(s)  ((s) & _S_IFDIR)
  64. #endif
  65.  
  66. #else /* _WIN32 */
  67. /* 16-bit windows stuff */
  68.  
  69. #include <sys\types.h>
  70. #include <sys\stat.h>
  71. #include <dos.h>
  72.  
  73.  
  74.  
  75. /*    Getting cocky to support multiple file systems */
  76. typedef struct    dirStruct_tag    {
  77.     struct _find_t    file_data;
  78.     char            c_checkdrive;
  79. } dirStruct;
  80.  
  81. typedef struct DIR_Struct {
  82.     void            * directoryPtr;
  83.     dirStruct         data;
  84. } DIR;
  85.  
  86. #define _ST_FSTYPSZ 16
  87. typedef unsigned long mode_t;
  88. typedef          long uid_t;
  89. typedef          long gid_t;
  90. typedef          long off_t;
  91. typedef unsigned long nlink_t;
  92.  
  93. typedef struct timestruc {
  94.     time_t  tv_sec;         /* seconds */
  95.     long    tv_nsec;        /* and nanoseconds */
  96. } timestruc_t;
  97.  
  98. struct dirent {                             /* data from readdir() */
  99.         ino_t           d_ino;              /* inode number of entry */
  100.         off_t           d_off;              /* offset of disk direntory entry */
  101.         unsigned short  d_reclen;           /* length of this record */
  102. #ifdef XP_WIN32
  103.         char            d_name[_MAX_FNAME]; /* name of file */
  104. #else
  105.         char            d_name[20]; /* name of file */
  106. #endif
  107. };
  108.  
  109. #define S_ISDIR(s)  ((s) & _S_IFDIR)
  110.  
  111. #endif /* 16-bit windows */
  112.  
  113. #define CONST const
  114.  
  115. #endif /* _WINDOWS */
  116.  
  117. #endif /* WINFILE_H */
  118.