1 /*
2   Copyright (c) 1990-2008 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     OS/2 specific configuration section:
11   ---------------------------------------------------------------------------*/
12 
13 #ifndef __os2cfg_h
14 #define __os2cfg_h
15 
16 #ifdef MSDOS
17 #  include <dos.h>           /* for REGS macro (TC) or _dos_setftime (MSC) */
18 #  ifdef __TURBOC__          /* includes Power C */
19 #    include <sys/timeb.h>   /* for structure ftime */
20 #    ifndef __BORLANDC__     /* there appears to be a bug (?) in Borland's */
21 #      include <mem.h>       /*  MEM.H related to __STDC__ and far poin-   */
22 #    endif                   /*  ters. (dpk)  [mem.h included for memcpy]  */
23 #  endif
24 #endif /* MSDOS */
25 
26 #ifdef __IBMC__
27 #  define S_IFMT 0xF000
28 #  define timezone _timezone            /* (underscore names work with    */
29 #  define tzset _tzset                  /*  all versions of C Set)        */
30 #  define PIPE_ERROR (errno == EERRSET || errno == EOS2ERR)
31 #endif /* __IBMC__ */
32 
33 #ifdef __WATCOMC__
34 #  ifdef __386__
35 #    ifndef WATCOMC_386
36 #      define WATCOMC_386
37 #    endif
38 #    define __32BIT__
39 #    undef far
40 #    define far
41 #    undef near
42 #    define near
43 
44 /* Get asm routines to link properly without using "__cdecl": */
45 #    ifndef USE_ZLIB
46 #      pragma aux crc32         "_*" parm caller [] value [eax] modify [eax]
47 #      pragma aux get_crc_table "_*" parm caller [] value [eax] \
48                                       modify [eax ecx edx]
49 #    endif /* !USE_ZLIB */
50 #  else /* !__386__ */
51 #    ifndef USE_ZLIB
52 #      pragma aux crc32         "_*" parm caller [] value [ax dx] \
53                                       modify [ax cx dx bx]
54 #      pragma aux get_crc_table "_*" parm caller [] value [ax] \
55                                       modify [ax cx dx bx]
56 #    endif /* !USE_ZLIB */
57 #  endif /* ?__386__ */
58 #endif /* __WATCOMC__ */
59 
60 #ifdef __EMX__
61 #  ifndef __32BIT__
62 #    define __32BIT__
63 #  endif
64 #  define far
65 #endif
66 
67 #ifndef __32BIT__
68 #  define __16BIT__
69 #endif
70 
71 #ifdef MSDOS
72 #  undef MSDOS
73 #endif
74 
75 #if defined(M_I86CM) || defined(M_I86LM)
76 #  define MED_MEM
77 #endif
78 #if (defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__))
79 #  define MED_MEM
80 #endif
81 #ifdef __16BIT__
82 #  ifndef MED_MEM
83 #    define SMALL_MEM
84 #  endif
85 #endif
86 
87 #ifdef __16BIT__
88 # if defined(MSC) || defined(__WATCOMC__)
89 #   include <malloc.h>
90 #   define nearmalloc _nmalloc
91 #   define nearfree _nfree
92 # endif
93 # if defined(__TURBOC__) && defined(DYNALLOC_CRCTAB)
94 #   if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
95 #     undef DYNALLOC_CRCTAB
96 #   endif
97 # endif
98 # ifndef nearmalloc
99 #   define nearmalloc malloc
100 #   define nearfree free
101 # endif
102 # ifdef USE_DEFLATE64
103 #   if (defined(M_I86TM) || defined(M_I86SM) || defined(M_I86MM))
104 #     error Deflate64(tm) requires compact or large memory model
105 #   endif
106 #   if (defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__))
107 #     error Deflate64(tm) requires compact or large memory model
108 #   endif
109     /* the 64k history buffer for Deflate64 must be allocated specially */
110 #   define MALLOC_WORK
111 #   define MY_ZCALLOC
112 # endif
113 #endif
114 
115 /* TIMESTAMP is now supported on OS/2, so enable it by default */
116 #if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
117 #  define TIMESTAMP
118 #endif
119 
120 /* check that TZ environment variable is defined before using UTC times */
121 #if (!defined(NO_IZ_CHECK_TZ) && !defined(IZ_CHECK_TZ))
122 #  define IZ_CHECK_TZ
123 #endif
124 
125 #ifndef RESTORE_ACL
126 #  define RESTORE_ACL
127 #endif
128 
129 #ifndef OS2_EAS
130 #  define OS2_EAS    /* for -l and -v listings (list.c) */
131 #endif
132 
133 #ifdef isupper
134 #  undef isupper
135 #endif
136 #ifdef tolower
137 #  undef tolower
138 #endif
139 #define isupper(x)   IsUpperNLS((unsigned char)(x))
140 #define tolower(x)   ToLowerNLS((unsigned char)(x))
141 #ifndef NO_STRNICMP     /* use UnZip's zstrnicmp(), because some compilers  */
142 #  define NO_STRNICMP   /*  don't provide a NLS-aware strnicmp() function  */
143 #endif
144 
145 #define USETHREADID
146 
147 /* handlers for OEM <--> ANSI string conversions */
148 #ifndef _OS2_ISO_ANSI
149    /* use home-brewed conversion functions; internal charset is OEM */
150 #  ifdef CRTL_CP_IS_ISO
151 #    undef CRTL_CP_IS_ISO
152 #  endif
153 #  ifndef CRTL_CP_IS_OEM
154 #    define CRTL_CP_IS_OEM
155 #  endif
156 #endif
157 
158 /* screen size detection */
159 #define SCREENWIDTH 80
160 #define SCREENSIZE(scrrows, scrcols)  screensize(scrrows, scrcols)
161 int screensize(int *tt_rows, int *tt_cols);
162 
163 /* on the OS/2 console screen, line-wraps are always enabled */
164 #define SCREENLWRAP 1
165 
166 #endif /* !__os2cfg_h */
167