]>
Commit | Line | Data |
---|---|---|
f6bcfd97 BP |
1 | /*--------------------------------------------------------------------------- |
2 | Win32 specific configuration section: | |
3 | ---------------------------------------------------------------------------*/ | |
4 | ||
5 | #ifndef __w32cfg_h | |
6 | #define __w32cfg_h | |
7 | ||
8 | #if (defined(__CYGWIN__) && !defined(__CYGWIN32__)) | |
9 | # define __CYGWIN32__ /* new versions of CygWin may not define this */ | |
10 | #endif | |
11 | ||
12 | #include <sys/types.h> /* off_t, time_t, dev_t, ... */ | |
13 | #include <sys/stat.h> | |
14 | #include <io.h> /* read(), open(), etc. */ | |
15 | #include <time.h> | |
16 | #if (defined(__RSXNT__) || defined(__EMX__)) && !defined(tzset) | |
17 | # define tzset _tzset | |
18 | #endif | |
19 | #ifdef __MINGW32__ | |
20 | extern void _tzset(void); /* this is missing in <time.h> */ | |
21 | # ifndef tzset | |
22 | # define tzset _tzset | |
23 | # endif | |
24 | #endif | |
25 | #include <memory.h> | |
26 | #if (!defined(__RSXNT__) && !defined(__CYGWIN32__)) | |
27 | # include <direct.h> /* mkdir() */ | |
28 | #endif | |
29 | #include <fcntl.h> | |
30 | #ifdef __CYGWIN32__ | |
31 | # include <unistd.h> | |
32 | extern int setmode(int, int); /* this is missing in <fcntl.h> */ | |
33 | #endif | |
34 | #if (defined(MSC) || defined(__WATCOMC__) || defined(__MINGW32__)) | |
35 | # include <sys/utime.h> | |
36 | #else | |
37 | # include <utime.h> | |
38 | #endif | |
39 | ||
40 | #if defined(FILEIO_C) | |
41 | # ifndef __CYGWIN32__ | |
42 | # include <conio.h> | |
43 | # endif | |
44 | # include <windows.h> | |
45 | # ifdef __RSXNT__ | |
46 | # include "win32/rsxntwin.h" | |
47 | # endif | |
48 | #endif | |
49 | #if (defined(ENVARGS_C) || defined(EXTRACT_C) || defined(UNZIP_C) || \ | |
50 | defined(ZCRYPT_INTERNAL)) | |
51 | # include <windows.h> | |
52 | # ifdef __RSXNT__ | |
53 | # include "win32/rsxntwin.h" | |
54 | # endif | |
55 | #endif | |
56 | #if (defined(__CYGWIN32__) || defined(__MINGW32__)) | |
57 | /* the following definitions are missing in their <windows.h> */ | |
58 | # ifndef AnsiToOem | |
59 | # define AnsiToOem CharToOemA | |
60 | # endif | |
61 | # ifndef OemToAnsi | |
62 | # define OemToAnsi OemToCharA | |
63 | # endif | |
64 | #endif | |
65 | ||
66 | #define DIR_END '\\' /* OS uses '\\' as directory separator */ | |
67 | #define DIR_END2 '/' /* also check for '/' (RTL may convert) */ | |
68 | #ifndef DATE_FORMAT | |
69 | # define DATE_FORMAT DF_MDY | |
70 | #endif | |
71 | #define lenEOL 2 | |
72 | #define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);} | |
73 | ||
74 | #if (defined(__RSXNT__) && !defined(HAVE_MKTIME)) | |
75 | # define HAVE_MKTIME /* use mktime() in time conversion routines */ | |
76 | #endif | |
77 | #if (defined(__CYGWIN32__) && defined(HAVE_MKTIME)) | |
78 | # undef HAVE_MKTIME /* Cygnus' mktime() implementation is buggy */ | |
79 | #endif | |
80 | #if (!defined(NT_TZBUG_WORKAROUND) && !defined(NO_NT_TZBUG_WORKAROUND)) | |
81 | # define NT_TZBUG_WORKAROUND | |
82 | #endif | |
83 | #if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME)) | |
84 | # define USE_EF_UT_TIME | |
85 | #endif | |
86 | #if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP)) | |
87 | # define TIMESTAMP | |
88 | #endif | |
89 | #if (!defined(NO_NTSD_EAS) && !defined(NTSD_EAS)) | |
90 | # define NTSD_EAS /* enable NTSD support unless explicitly suppressed */ | |
91 | #endif | |
92 | ||
93 | /* handlers for OEM <--> ANSI string conversions */ | |
94 | #ifdef __RSXNT__ | |
95 | /* RSXNT uses OEM coded strings in functions supplied by C RTL */ | |
96 | # ifdef CRTL_CP_IS_ISO | |
97 | # undef CRTL_CP_IS_ISO | |
98 | # endif | |
99 | # ifndef CRTL_CP_IS_OEM | |
100 | # define CRTL_CP_IS_OEM | |
101 | # endif | |
102 | #else | |
103 | /* "real" native WIN32 compilers use ANSI coded strings in C RTL calls */ | |
104 | # ifndef CRTL_CP_IS_ISO | |
105 | # define CRTL_CP_IS_ISO | |
106 | # endif | |
107 | # ifdef CRTL_CP_IS_OEM | |
108 | # undef CRTL_CP_IS_OEM | |
109 | # endif | |
110 | #endif | |
111 | ||
112 | #ifdef CRTL_CP_IS_ISO | |
113 | /* C RTL's file system support assumes ANSI coded strings */ | |
114 | # define ISO_TO_INTERN(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} | |
115 | # define OEM_TO_INTERN(src, dst) OemToAnsi(src, dst) | |
116 | # define INTERN_TO_ISO(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} | |
117 | # define INTERN_TO_OEM(src, dst) AnsiToOem(src, dst) | |
118 | #endif /* CRTL_CP_IS_ISO */ | |
119 | #ifdef CRTL_CP_IS_OEM | |
120 | /* C RTL's file system support assumes OEM coded strings */ | |
121 | # define ISO_TO_INTERN(src, dst) AnsiToOem(src, dst) | |
122 | # define OEM_TO_INTERN(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} | |
123 | # define INTERN_TO_ISO(src, dst) OemToAnsi(src, dst) | |
124 | # define INTERN_TO_OEM(src, dst) {if ((src) != (dst)) strcpy((dst), (src));} | |
125 | #endif /* CRTL_CP_IS_OEM */ | |
126 | #define _OEM_INTERN(str1) OEM_TO_INTERN(str1, str1) | |
127 | #define _ISO_INTERN(str1) ISO_TO_INTERN(str1, str1) | |
128 | #ifndef WINDLL | |
129 | /* Despite best intentions, for the command-line version UzpPassword() | |
130 | * could return either character set, depending on whether running under | |
131 | * Win95 (DOS-session) or WinNT (native WinNT command interpreter)! */ | |
132 | # define STR_TO_CP2(dst, src) (AnsiToOem(src, dst), dst) | |
133 | # define STR_TO_CP3(dst, src) (OemToAnsi(src, dst), dst) | |
134 | #else | |
135 | /* The WINDLL front end is known to supply ISO/ANSI-coded passwords! */ | |
136 | # define STR_TO_CP2(dst, src) (AnsiToOem(src, dst), dst) | |
137 | #endif | |
138 | /* dummy defines to disable these functions, they are not needed */ | |
139 | #define STR_TO_OEM | |
140 | #define STR_TO_ISO | |
141 | ||
142 | /* Static variables that we have to add to Uz_Globs: */ | |
143 | #define SYSTEM_SPECIFIC_GLOBALS \ | |
144 | int created_dir, renamed_fullpath, fnlen;\ | |
145 | unsigned nLabelDrive;\ | |
146 | char lastRootPath[4];\ | |
147 | int lastVolOldFAT, lastVolLocTim;\ | |
148 | char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\ | |
149 | char *dirname, *wildname, matchname[FILNAMSIZ];\ | |
150 | int rootlen, have_dirname, dirnamelen, notfirstcall;\ | |
151 | zvoid *wild_dir; | |
152 | ||
153 | /* created_dir, renamed_fullpath, fnlen, and nLabelDrive are used by */ | |
154 | /* both mapname() and checkdir(). */ | |
155 | /* lastRootPath and lastVolOldFAT are used by IsVolumeOldFAT(). */ | |
156 | /* rootlen, rootpath, buildpathHPFS, buildpathFAT, endHPFS, and endFAT */ | |
157 | /* are used by checkdir(). */ | |
158 | /* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */ | |
159 | /* and notfirstcall are used by do_wild(). */ | |
160 | ||
161 | #if (defined(_MSC_VER) && !defined(MSC)) | |
162 | # define MSC | |
163 | #endif | |
164 | ||
165 | /* This replacement for C-RTL-supplied getch() (or similar) functionality | |
166 | * avoids leaving unabsorbed LFs in the keyboard buffer under Windows95, | |
167 | * and supports the <ALT>+[0]<digit><digit><digit> feature. | |
168 | */ | |
169 | int getch_win32 OF((void)); | |
170 | ||
171 | /* This patch of stat() is useful for at least two compilers. It is */ | |
172 | /* difficult to take a stat() of a root directory under Windows95, so */ | |
173 | /* zstat_win32() detects that case and fills in suitable values. */ | |
174 | #ifndef __RSXNT__ | |
175 | # ifndef W32_STATROOT_FIX | |
176 | # define W32_STATROOT_FIX | |
177 | # endif | |
178 | #endif /* !__RSXNT__ */ | |
179 | ||
180 | #if (defined(NT_TZBUG_WORKAROUND) || defined(W32_STATROOT_FIX)) | |
181 | # define W32_STAT_BANDAID | |
182 | # if (defined(NT_TZBUG_WORKAROUND) && defined(REENTRANT)) | |
183 | # define __W32STAT_GLOBALS__ Uz_Globs *pG, | |
184 | # define __W32STAT_G__ pG, | |
185 | # else | |
186 | # define __W32STAT_GLOBALS__ | |
187 | # define __W32STAT_G__ | |
188 | # endif | |
189 | # undef SSTAT | |
190 | # ifdef WILD_STAT_BUG | |
191 | # define SSTAT(path, pbuf) (iswild(path) || zstat_win32(__W32STAT_G__ path, pbuf)) | |
192 | # else | |
193 | # define SSTAT(path, pbuf) zstat_win32(__W32STAT_G__ path, pbuf) | |
194 | # endif | |
195 | #endif | |
196 | ||
197 | #ifdef __WATCOMC__ | |
198 | # ifdef __386__ | |
199 | # ifndef WATCOMC_386 | |
200 | # define WATCOMC_386 | |
201 | # endif | |
202 | # define __32BIT__ | |
203 | # undef far | |
204 | # define far | |
205 | # undef near | |
206 | # define near | |
207 | ||
208 | /* Get asm routines to link properly without using "__cdecl": */ | |
209 | # ifndef USE_ZLIB | |
210 | # pragma aux crc32 "_*" parm caller [] value [eax] modify [eax] | |
211 | # pragma aux get_crc_table "_*" parm caller [] value [eax] \ | |
212 | modify [eax ecx edx] | |
213 | # endif /* !USE_ZLIB */ | |
214 | # endif /* __386__ */ | |
215 | ||
216 | # ifndef EPIPE | |
217 | # define EPIPE -1 | |
218 | # endif | |
219 | # define PIPE_ERROR (errno == EPIPE) | |
220 | #endif /* __WATCOMC__ */ | |
221 | ||
222 | #endif /* !__w32cfg_h */ |