~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to zip/unzip/win32/w32cfg.h

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
  Copyright (c) 1990-2002 Info-ZIP.  All rights reserved.
3
 
 
4
 
  See the accompanying file LICENSE, version 2000-Apr-09 or later
5
 
  (the contents of which are also included in unzip.h) for terms of use.
6
 
  If, for some reason, all these files are missing, the Info-ZIP license
7
 
  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
8
 
*/
9
 
/*---------------------------------------------------------------------------
10
 
    Win32 specific configuration section:
11
 
  ---------------------------------------------------------------------------*/
12
 
 
13
 
#ifndef __w32cfg_h
14
 
#define __w32cfg_h
15
 
 
16
 
#if (defined(__CYGWIN32__) && !defined(__CYGWIN__))
17
 
#  define __CYGWIN__            /* compatibility for CygWin B19 and older */
18
 
#endif
19
 
 
20
 
#ifdef __CYGWIN__
21
 
/* Those Idiots at Cygnus have started to set "Unix" identifiers
22
 
 * for a Win32 compiler ...
23
 
 */
24
 
#  ifdef UNIX
25
 
#    undef UNIX
26
 
#  endif
27
 
#endif
28
 
 
29
 
#if (defined(_MSC_VER) && !defined(MSC))
30
 
#  define MSC
31
 
#endif
32
 
 
33
 
/* enable multibyte character set support by default */
34
 
#ifndef _MBCS
35
 
#  define _MBCS
36
 
#endif
37
 
#if (defined(__CYGWIN__) && defined(_MBCS))
38
 
#  undef _MBCS                  /* CygWin RTL lacks support for __mb_cur_max */
39
 
#endif
40
 
#if (defined(__DJGPP__) && !defined(__EMX__) && defined(_MBCS))
41
 
#  undef _MBCS                  /* __mb_cur_max missing for RSXNTdj 1.6 beta */
42
 
#endif
43
 
 
44
 
#include <sys/types.h>          /* off_t, time_t, dev_t, ... */
45
 
#include <sys/stat.h>
46
 
#include <io.h>                 /* read(), open(), etc. */
47
 
#include <time.h>
48
 
#if ((defined(__RSXNT__) || defined(__EMX__)) && !defined(tzset))
49
 
#  define tzset _tzset
50
 
#endif
51
 
#if (defined(__LCC__) && !defined(tzset))
52
 
#  define tzset _tzset
53
 
#endif
54
 
#ifdef __MINGW32__
55
 
   extern void _tzset(void);    /* this is missing in <time.h> */
56
 
#  ifndef tzset
57
 
#    define tzset _tzset
58
 
#  endif
59
 
#endif
60
 
#ifdef W32_USE_IZ_TIMEZONE
61
 
#  ifdef __BORLANDC__
62
 
#    define tzname tzname
63
 
#    define IZTZ_DEFINESTDGLOBALS
64
 
#  endif
65
 
#  ifdef __WATCOMC__
66
 
#    define IZTZ_DEFINESTDGLOBALS
67
 
#  endif
68
 
#  ifndef tzset
69
 
#    define tzset _tzset
70
 
#  endif
71
 
#  ifndef timezone
72
 
#    define timezone _timezone
73
 
#  endif
74
 
#  ifndef daylight
75
 
#    define daylight _daylight
76
 
#  endif
77
 
#  ifndef tzname
78
 
#    define tzname _tzname
79
 
#  endif
80
 
#  if (!defined(NEED__ISINDST) && !defined(__BORLANDC__))
81
 
#    define NEED__ISINDST
82
 
#  endif
83
 
#  ifdef IZTZ_GETLOCALETZINFO
84
 
#    undef IZTZ_GETLOCALETZINFO
85
 
#  endif
86
 
#  define IZTZ_GETLOCALETZINFO GetPlatformLocalTimezone
87
 
#endif /* W32_USE_IZ_TIMEZONE */
88
 
#include <memory.h>
89
 
#if (!defined(__RSXNT__) && !defined(__CYGWIN__))
90
 
#  include <direct.h>           /* mkdir() */
91
 
#endif
92
 
#include <fcntl.h>
93
 
#ifdef __CYGWIN__
94
 
#  include <unistd.h>
95
 
   extern int setmode(int, int);        /* this is missing in <fcntl.h> */
96
 
#endif
97
 
#if (defined(MSC) || defined(__WATCOMC__) || defined(__MINGW32__))
98
 
#  include <sys/utime.h>
99
 
#else
100
 
#  include <utime.h>
101
 
#endif
102
 
#define GOT_UTIMBUF
103
 
 
104
 
#ifdef _MBCS
105
 
#  if (!defined(__EMX__) && !defined(__MINGW32__) && !defined(__CYGWIN__))
106
 
#  if (!defined(__DJGPP__))
107
 
#    include <stdlib.h>
108
 
#    include <mbstring.h>
109
 
     /* for MSC (and compatible compilers), use routines supplied by RTL */
110
 
#    define PREINCSTR(ptr) (ptr = (char *)_mbsinc((const uch *)(ptr)))
111
 
#    define MBSCHR(str, c) (char *)_mbschr((const uch *)(str), (c))
112
 
#    define MBSRCHR(str, c) (char *)_mbsrchr((const uch *)(str), (c))
113
 
#  endif
114
 
#  endif
115
 
#  if (defined(__MINGW32__) && !defined(MB_CUR_MAX))
116
 
#    ifdef __MSVCRT__
117
 
       extern int *__p___mb_cur_max(void);
118
 
#      define MB_CUR_MAX (*__p___mb_cur_max())
119
 
#    else
120
 
       extern int *_imp____mb_cur_max_dll;
121
 
#      define MB_CUR_MAX (*_imp____mb_cur_max_dll)
122
 
#    endif
123
 
#  endif
124
 
#  if (defined(__LCC__) && !defined(MB_CUR_MAX))
125
 
     extern int *_imp____mb_cur_max;
126
 
#    define MB_CUR_MAX (*_imp____mb_cur_max)
127
 
#  endif
128
 
#  if (defined(__DJGPP__) && !defined(__EMX__) && !defined(MB_CUR_MAX))
129
 
     extern int *_imp____mb_cur_max;
130
 
#    define MB_CUR_MAX (*_imp____mb_cur_max)
131
 
#  endif
132
 
#endif
133
 
 
134
 
/* for UnZip, the "basic" part of the win32 api is sufficient */
135
 
#ifndef WIN32_LEAN_AND_MEAN
136
 
#  define WIN32_LEAN_AND_MEAN
137
 
#endif
138
 
 
139
 
#if defined(__FILEIO_C)
140
 
#  ifndef __CYGWIN__
141
 
#    include <conio.h>
142
 
#  endif
143
 
#  include <windows.h>
144
 
#  ifdef __RSXNT__
145
 
#    include "../win32/rsxntwin.h"
146
 
#  endif
147
 
#  ifndef TIME_ZONE_ID_INVALID
148
 
#    define TIME_ZONE_ID_INVALID  (DWORD)0xFFFFFFFFL
149
 
#  endif
150
 
#endif
151
 
#if (defined(__ENVARGS_C) || defined(__EXTRACT_C) || defined(__UNZIP_C) || \
152
 
     defined(ZCRYPT_INTERNAL))
153
 
#  include <windows.h>
154
 
#  ifdef __RSXNT__
155
 
#    include "../win32/rsxntwin.h"
156
 
#  endif
157
 
#  ifndef TIME_ZONE_ID_INVALID
158
 
#    define TIME_ZONE_ID_INVALID  (DWORD)0xFFFFFFFFL
159
 
#  endif
160
 
#endif
161
 
 
162
 
/* the following definitions are considered as "obsolete" by Microsoft and
163
 
 * might be missing in some versions of <windows.h>
164
 
 */
165
 
#ifndef AnsiToOem
166
 
#  define AnsiToOem CharToOemA
167
 
#endif
168
 
#ifndef OemToAnsi
169
 
#  define OemToAnsi OemToCharA
170
 
#endif
171
 
 
172
 
#define DIR_END       '\\'      /* OS uses '\\' as directory separator */
173
 
#define DIR_END2      '/'       /* also check for '/' (RTL may convert) */
174
 
#ifdef DATE_FORMAT
175
 
#  undef DATE_FORMAT
176
 
#endif
177
 
#define DATE_FORMAT   dateformat()
178
 
#define lenEOL        2
179
 
#define PutNativeEOL  {*q++ = native(CR); *q++ = native(LF);}
180
 
 
181
 
#if (defined(__RSXNT__) && !defined(HAVE_MKTIME))
182
 
#  define HAVE_MKTIME           /* use mktime() in time conversion routines */
183
 
#endif
184
 
#if (defined(MSC) && !defined(HAVE_MKTIME))
185
 
#  define HAVE_MKTIME           /* use mktime() in time conversion routines */
186
 
#endif
187
 
#if (defined(__CYGWIN__) && defined(HAVE_MKTIME))
188
 
#  undef HAVE_MKTIME            /* Cygnus' mktime() implementation is buggy */
189
 
#endif
190
 
#if (defined(W32_USE_IZ_TIMEZONE) && !defined(HAVE_MKTIME))
191
 
#  define HAVE_MKTIME           /* use mktime() in time conversion routines */
192
 
#endif
193
 
#if (!defined(NT_TZBUG_WORKAROUND) && !defined(NO_NT_TZBUG_WORKAROUND))
194
 
#  define NT_TZBUG_WORKAROUND
195
 
#endif
196
 
#if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
197
 
#  define USE_EF_UT_TIME
198
 
#endif
199
 
#if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
200
 
#  define TIMESTAMP
201
 
#endif
202
 
#if (!defined(NO_NTSD_EAS) && !defined(NTSD_EAS))
203
 
#  define NTSD_EAS      /* enable NTSD support unless explicitly suppressed */
204
 
#endif
205
 
#if (defined(NTSD_EAS) && !defined(RESTORE_ACL))
206
 
#  define RESTORE_ACL   /* "restore ACLs" only needed when NTSD_EAS active */
207
 
#endif
208
 
 
209
 
/* handlers for OEM <--> ANSI string conversions */
210
 
#ifdef __RSXNT__
211
 
   /* RSXNT uses OEM coded strings in functions supplied by C RTL */
212
 
#  ifdef CRTL_CP_IS_ISO
213
 
#    undef CRTL_CP_IS_ISO
214
 
#  endif
215
 
#  ifndef CRTL_CP_IS_OEM
216
 
#    define CRTL_CP_IS_OEM
217
 
#  endif
218
 
#else
219
 
   /* "real" native WIN32 compilers use ANSI coded strings in C RTL calls */
220
 
#  ifndef CRTL_CP_IS_ISO
221
 
#    define CRTL_CP_IS_ISO
222
 
#  endif
223
 
#  ifdef CRTL_CP_IS_OEM
224
 
#    undef CRTL_CP_IS_OEM
225
 
#  endif
226
 
#endif
227
 
 
228
 
#ifdef CRTL_CP_IS_ISO
229
 
   /* C RTL's file system support assumes ANSI coded strings */
230
 
#  define ISO_TO_INTERN(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
231
 
#  define OEM_TO_INTERN(src, dst)  OemToAnsi(src, dst)
232
 
#  define INTERN_TO_ISO(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
233
 
#  define INTERN_TO_OEM(src, dst)  AnsiToOem(src, dst)
234
 
#endif /* CRTL_CP_IS_ISO */
235
 
#ifdef CRTL_CP_IS_OEM
236
 
   /* C RTL's file system support assumes OEM coded strings */
237
 
#  define ISO_TO_INTERN(src, dst)  AnsiToOem(src, dst)
238
 
#  define OEM_TO_INTERN(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
239
 
#  define INTERN_TO_ISO(src, dst)  OemToAnsi(src, dst)
240
 
#  define INTERN_TO_OEM(src, dst)  {if ((src) != (dst)) strcpy((dst), (src));}
241
 
#endif /* CRTL_CP_IS_OEM */
242
 
#define _OEM_INTERN(str1) OEM_TO_INTERN(str1, str1)
243
 
#define _ISO_INTERN(str1) ISO_TO_INTERN(str1, str1)
244
 
#ifndef WINDLL
245
 
   /* Despite best intentions, for the command-line version UzpPassword()
246
 
    * could return either character set, depending on whether running under
247
 
    * Win95 (DOS-session) or WinNT (native WinNT command interpreter)! */
248
 
#  define STR_TO_CP2(dst, src)  (AnsiToOem(src, dst), dst)
249
 
#  define STR_TO_CP3(dst, src)  (OemToAnsi(src, dst), dst)
250
 
#else
251
 
   /* The WINDLL front end is known to supply ISO/ANSI-coded passwords! */
252
 
#  define STR_TO_CP2(dst, src)  (AnsiToOem(src, dst), dst)
253
 
#endif
254
 
/* dummy defines to disable these functions, they are not needed */
255
 
#define STR_TO_OEM
256
 
#define STR_TO_ISO
257
 
 
258
 
/* Static variables that we have to add to Uz_Globs: */
259
 
#define SYSTEM_SPECIFIC_GLOBALS \
260
 
    int created_dir, renamed_fullpath, fnlen;\
261
 
    unsigned nLabelDrive;\
262
 
    char lastRootPath[4];\
263
 
    int lastVolOldFAT, lastVolLocTim;\
264
 
    char *rootpath, *buildpathHPFS, *buildpathFAT, *endHPFS, *endFAT;\
265
 
    ZCONST char *wildname;\
266
 
    char *dirname, matchname[FILNAMSIZ];\
267
 
    int rootlen, have_dirname, dirnamelen, notfirstcall;\
268
 
    zvoid *wild_dir;
269
 
 
270
 
/* created_dir, renamed_fullpath, fnlen, and nLabelDrive are used by   */
271
 
/*    both mapname() and checkdir().                                   */
272
 
/* lastRootPath, lastVolOldFAT and lastVolLocTim are used by           */
273
 
/*    IsVolumeOldFAT() and NTQueryVolInfo().                           */
274
 
/* rootlen, rootpath, buildpathHPFS, buildpathFAT, endHPFS, and endFAT */
275
 
/*    are used by checkdir().                                          */
276
 
/* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
277
 
/*    and notfirstcall are used by do_wild().                          */
278
 
 
279
 
/* This replacement for C-RTL-supplied getch() (or similar) functionality
280
 
 * avoids leaving unabsorbed LFs in the keyboard buffer under Windows95,
281
 
 * and supports the <ALT>+[0]<digit><digit><digit> feature.
282
 
 */
283
 
int getch_win32  OF((void));
284
 
 
285
 
/* Up to now, all versions of Microsoft C runtime libraries lack the support
286
 
 * for customized (non-US) switching rules between daylight saving time and
287
 
 * standard time in the TZ environment variable string.
288
 
 * But non-US timezone rules are correctly supported when timezone information
289
 
 * is read from the OS system settings in the Win32 registry.
290
 
 * The following work-around deletes any TZ environment setting from
291
 
 * the process environment.  This results in a fallback of the RTL time
292
 
 * handling code to the (correctly interpretable) OS system settings, read
293
 
 * from the registry.
294
 
 */
295
 
#ifdef USE_EF_UT_TIME
296
 
# if (defined(__WATCOMC__) || defined(W32_USE_IZ_TIMEZONE))
297
 
#   define iz_w32_prepareTZenv()
298
 
# else
299
 
#   define iz_w32_prepareTZenv()        putenv("TZ=")
300
 
# endif
301
 
#endif
302
 
 
303
 
/* This patch of stat() is useful for at least two compilers.  It is   */
304
 
/* difficult to take a stat() of a root directory under Windows95, so  */
305
 
/* zstat_win32() detects that case and fills in suitable values.       */
306
 
#ifndef __RSXNT__
307
 
#  ifndef W32_STATROOT_FIX
308
 
#    define W32_STATROOT_FIX
309
 
#  endif
310
 
#endif /* !__RSXNT__ */
311
 
 
312
 
#if (defined(NT_TZBUG_WORKAROUND) || defined(W32_STATROOT_FIX))
313
 
#  define W32_STAT_BANDAID
314
 
#  if (defined(NT_TZBUG_WORKAROUND) && defined(REENTRANT))
315
 
#    define __W32STAT_GLOBALS__     Uz_Globs *pG,
316
 
#    define __W32STAT_G__           pG,
317
 
#  else
318
 
#    define __W32STAT_GLOBALS__
319
 
#    define __W32STAT_G__
320
 
#  endif
321
 
#  ifdef SSTAT
322
 
#    undef SSTAT
323
 
#  endif
324
 
#  ifdef WILD_STAT_BUG
325
 
#    define SSTAT(path, pbuf) (iswild(path) || zstat_win32(__W32STAT_G__ path, pbuf))
326
 
#  else
327
 
#    define SSTAT(path, pbuf) zstat_win32(__W32STAT_G__ path, pbuf)
328
 
#  endif
329
 
#endif
330
 
 
331
 
#ifdef __WATCOMC__
332
 
#  ifdef __386__
333
 
#    ifndef WATCOMC_386
334
 
#      define WATCOMC_386
335
 
#    endif
336
 
#    define __32BIT__
337
 
#    undef far
338
 
#    define far
339
 
#    undef near
340
 
#    define near
341
 
 
342
 
/* gaah -- Watcom's docs claim that _get_osfhandle exists, but it doesn't.  */
343
 
#    define _get_osfhandle _os_handle
344
 
 
345
 
/* Get asm routines to link properly without using "__cdecl": */
346
 
#    ifndef USE_ZLIB
347
 
#      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
348
 
#      pragma aux get_crc_table "_*" parm caller [] value [eax] \
349
 
                                      modify [eax ecx edx]
350
 
#    endif /* !USE_ZLIB */
351
 
#  endif /* __386__ */
352
 
 
353
 
#  ifndef EPIPE
354
 
#    define EPIPE -1
355
 
#  endif
356
 
#  define PIPE_ERROR (errno == EPIPE)
357
 
#endif /* __WATCOMC__ */
358
 
 
359
 
#define SCREENWIDTH 80
360
 
#define SCREENSIZE(scrrows, scrcols)  screensize(scrrows, scrcols)
361
 
int screensize(int *tt_rows, int *tt_cols);
362
 
 
363
 
/* on the DOS or NT console screen, line-wraps are always enabled */
364
 
#define SCREENLWRAP 1
365
 
#define TABSIZE 8
366
 
 
367
 
#endif /* !__w32cfg_h */