home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip531.zip / win32 / w32cfg.h < prev    next >
C/C++ Source or Header  |  1997-04-13  |  5KB  |  157 lines

  1. /*---------------------------------------------------------------------------
  2.     Win32 specific configuration section:
  3.   ---------------------------------------------------------------------------*/
  4.  
  5. #ifndef __w32cfg_h
  6. #define __w32cfg_h
  7.  
  8. #include <sys/types.h>        /* off_t, time_t, dev_t, ... */
  9. #include <sys/stat.h>
  10. #include <io.h>               /* read(), open(), etc. */
  11. #include <time.h>
  12. #include <memory.h>
  13. #ifndef __EMX__
  14. #  include <direct.h>         /* mkdir() */
  15. #endif
  16. #include <fcntl.h>
  17. #if (defined(MSC) || defined(__WATCOMC__))
  18. #  include <sys/utime.h>
  19. #else
  20. #  include <utime.h>
  21. #endif
  22. #if defined(FILEIO_C)
  23. #  include <conio.h>
  24. #  include <windows.h>
  25. #  ifdef __RSXNT__
  26. #    include "win32/rsxntwin.h"
  27. #  endif
  28. #endif
  29. #if (defined(ENVARGS_C) || defined(EXTRACT_C) || defined(UNZIP_C) || \
  30.      defined(ZCRYPT_INTERNAL))
  31. #  include <windows.h>
  32. #  ifdef __RSXNT__
  33. #    include "win32/rsxntwin.h"
  34. #  endif
  35. #endif
  36.  
  37. #if defined(MSC)
  38. #  define DIR_END     '\\'   /* ZipInfo with VC++ 4.0 requires this */
  39. #endif
  40. #define DATE_FORMAT   DF_MDY
  41. #define lenEOL        2
  42. #define PutNativeEOL  {*q++ = native(CR); *q++ = native(LF);}
  43.  
  44. #ifndef NT_TZBUG_WORKAROUND
  45. #  define NT_TZBUG_WORKAROUND
  46. #endif
  47. #define USE_EF_UT_TIME
  48. #ifdef __RSXNT__
  49. #  ifndef NO_NTSD_WITH_RSXNT
  50. #    define NO_NTSD_WITH_RSXNT  /* RSXNT windows.h does not yet support NTSD */
  51. #  endif
  52. #else /* !__RSXNT__ */
  53. #  if (!defined(NO_NTSD_EAS) && !defined(NTSD_EAS))
  54. #    define NTSD_EAS    /* enable NTSD support unless explicitly suppressed */
  55. #  endif
  56. #endif /* ?__RSXNT__ */
  57.  
  58. /* handlers for OEM <--> ANSI string conversions */
  59. #ifdef __RSXNT__
  60.    /* RSXNT uses OEM coded strings in functions supplied by C RTL */
  61. #  ifdef CRTL_CP_IS_ISO
  62. #    undef CRTL_CP_IS_ISO
  63. #  endif
  64. #  ifndef CRTL_CP_IS_OEM
  65. #    define CRTL_CP_IS_OEM
  66. #  endif
  67. #else
  68.    /* "real" native WIN32 compilers use ANSI coded strings in C RTL calls */
  69. #  ifndef CRTL_CP_IS_ISO
  70. #    define CRTL_CP_IS_ISO
  71. #  endif
  72. #  ifdef CRTL_CP_IS_OEM
  73. #    undef CRTL_CP_IS_OEM
  74. #  endif
  75. #endif
  76.  
  77. #ifdef CRTL_CP_IS_ISO
  78.    /* C RTL's file system support assumes ANSI coded strings */
  79. #  define ISO_TO_INTERN(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
  80. #  define OEM_TO_INTERN(src, dst)  OemToAnsi(src, dst)
  81. #  define INTERN_TO_ISO(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
  82. #  define INTERN_TO_OEM(src, dst)  AnsiToOem(src, dst)
  83. #endif /* CRTL_CP_IS_ISO */
  84. #ifdef CRTL_CP_IS_OEM
  85.    /* C RTL's file system support assumes OEM coded strings */
  86. #  define ISO_TO_INTERN(src, dst)  AnsiToOem(src, dst)
  87. #  define OEM_TO_INTERN(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
  88. #  define INTERN_TO_ISO(src, dst)  OemToAnsi(src, dst)
  89. #  define INTERN_TO_OEM(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
  90. #endif /* CRTL_CP_IS_OEM */
  91. #define _OEM_INTERN(str1) OEM_TO_INTERN(str1, str1)
  92. #define _ISO_INTERN(str1) ISO_TO_INTERN(str1, str1)
  93. #ifndef WINDLL
  94.    /* Despite best intentions, for the command-line version UzpPassword()
  95.     * could return either character set, depending on whether running under
  96.     * Win95 (DOS-session) or WinNT (native WinNT command interpreter)! */
  97. #  define STR_TO_CP2(dst, src)  (AnsiToOem(src, dst), dst)
  98. #  define STR_TO_CP3(dst, src)  (OemToAnsi(src, dst), dst)
  99. #else
  100.    /* The WINDLL front end is known to supply ISO/ANSI-coded passwords! */
  101. #  define STR_TO_CP2(dst, src)  (AnsiToOem(src, dst), dst)
  102. #endif
  103. /* dummy defines to disable these functions, they are not needed */
  104. #define STR_TO_OEM
  105. #define STR_TO_ISO
  106.  
  107. /* Static variables that we have to add to struct Globals: */
  108. #define SYSTEM_SPECIFIC_GLOBALS \
  109.     int created_dir, renamed_fullpath, fnlen;\
  110.     unsigned nLabelDrive;\
  111.     char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\
  112.     char *dirname, *wildname, matchname[FILNAMSIZ];\
  113.     int rootlen, have_dirname, dirnamelen, notfirstcall;\
  114.     zvoid *wild_dir;
  115.  
  116. /* created_dir, renamed_fullpath, fnlen, and nLabelDrive are used by   */
  117. /*    both mapname() and checkdir().                                   */
  118. /* rootlen, rootpath, buildpathHPFS, buildpathFAT, endHPFS, and endFAT */
  119. /*    are used by checkdir().                                          */
  120. /* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
  121. /*    and notfirstcall are used by do_wild().                          */
  122.  
  123. #if (defined(_MSC_VER) && !defined(MSC))
  124. #  define MSC
  125. #endif
  126.  
  127. #ifdef __WATCOMC__
  128. #  undef SSTAT
  129. #  define SSTAT stat_bandaid
  130.    int stat_bandaid(const char *path, struct stat *buf);
  131.  
  132. #  ifdef __386__
  133. #    ifndef WATCOMC_386
  134. #      define WATCOMC_386
  135. #    endif
  136. #    define __32BIT__
  137. #    undef far
  138. #    define far
  139. #    undef near
  140. #    define near
  141.  
  142. /* Get asm routines to link properly without using "__cdecl": */
  143. #    ifndef USE_ZLIB
  144. #      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
  145. #      pragma aux get_crc_table "_*" parm caller [] value [eax] \
  146.                                       modify [eax ecx edx]
  147. #    endif /* !USE_ZLIB */
  148. #  endif /* __386__ */
  149.  
  150. #  ifndef EPIPE
  151. #    define EPIPE -1
  152. #  endif
  153. #  define PIPE_ERROR (errno == EPIPE)
  154. #endif /* __WATCOMC__ */
  155.  
  156. #endif /* !__w32cfg_h */
  157.