1 /*
2   Copyright (c) 1990-2009 Info-ZIP.  All rights reserved.
3 
4   See the accompanying file LICENSE, version 2009-Jan-02 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     Unix specific configuration section:
11   ---------------------------------------------------------------------------*/
12 
13 #ifndef __unxcfg_h
14 #define __unxcfg_h
15 
16 
17 /* LARGE FILE SUPPORT - 10/6/04 EG */
18 /* This needs to be set before the includes so they set the right sizes */
19 
20 #if (defined(NO_LARGE_FILE_SUPPORT) && defined(LARGE_FILE_SUPPORT))
21 #  undef LARGE_FILE_SUPPORT
22 #endif
23 
24 /* Automatically set ZIP64_SUPPORT if LFS */
25 #ifdef LARGE_FILE_SUPPORT
26 # if (!defined(NO_ZIP64_SUPPORT) && !defined(ZIP64_SUPPORT))
27 #   define ZIP64_SUPPORT
28 # endif
29 #endif
30 
31 /* NO_ZIP64_SUPPORT takes preceedence over ZIP64_SUPPORT */
32 #if defined(NO_ZIP64_SUPPORT) && defined(ZIP64_SUPPORT)
33 #  undef ZIP64_SUPPORT
34 #endif
35 
36 #ifdef LARGE_FILE_SUPPORT
37   /* 64-bit Large File Support */
38 
39   /* The following Large File Summit (LFS) defines turn on large file support
40      on Linux (probably 2.4 or later kernel) and many other unixen */
41 
42   /* These have to be before any include that sets types so the large file
43      versions of the types are set in the includes */
44 
45 # define _LARGEFILE_SOURCE      /* some OSes need this for fseeko */
46 # define _LARGEFILE64_SOURCE
47 # define _FILE_OFFSET_BITS 64   /* select default interface as 64 bit */
48 # define _LARGE_FILES           /* some OSes need this for 64-bit off_t */
49 # define __USE_LARGEFILE64
50 #endif /* LARGE_FILE_SUPPORT */
51 
52 
53 #include <sys/types.h>          /* off_t, time_t, dev_t, ... */
54 #include <sys/stat.h>
55 
56 #ifdef NO_OFF_T
57   typedef long zoff_t;
58 #else
59   typedef off_t zoff_t;
60 #endif
61 #define ZOFF_T_DEFINED
62 typedef struct stat z_stat;
63 #define Z_STAT_DEFINED
64 
65 #ifndef COHERENT
66 #  include <fcntl.h>            /* O_BINARY for open() w/o CR/LF translation */
67 #else /* COHERENT */
68 #  ifdef _I386
69 #    include <fcntl.h>          /* Coherent 4.0.x, Mark Williams C */
70 #  else
71 #    include <sys/fcntl.h>      /* Coherent 3.10, Mark Williams C */
72 #  endif
73 #  define SHORT_SYMS
74 #  ifndef __COHERENT__          /* Coherent 4.2 has tzset() */
75 #    define tzset  settz
76 #  endif
77 #endif /* ?COHERENT */
78 
79 #ifndef NO_PARAM_H
80 #  ifdef NGROUPS_MAX
81 #    undef NGROUPS_MAX      /* SCO bug:  defined again in <sys/param.h> */
82 #  endif
83 #  ifdef BSD
84 #    define TEMP_BSD        /* may be defined again in <sys/param.h> */
85 #    undef BSD
86 #  endif
87 #  include <sys/param.h>    /* conflict with <sys/types.h>, some systems? */
88 #  ifdef TEMP_BSD
89 #    undef TEMP_BSD
90 #    ifndef BSD
91 #      define BSD
92 #    endif
93 #  endif
94 #endif /* !NO_PARAM_H */
95 
96 #ifdef __osf__
97 #  define DIRENT
98 #  ifdef BSD
99 #    undef BSD
100 #  endif
101 #endif /* __osf__ */
102 
103 #ifdef __CYGWIN__
104 #  include <unistd.h>
105 #  define DIRENT
106 #  define HAVE_TERMIOS_H
107 #  ifndef timezone
108 #    define timezone _timezone
109 #  endif
110 #endif
111 
112 #ifdef BSD
113 #  include <sys/time.h>
114 #  include <sys/timeb.h>
115 #  if (defined(_AIX) || defined(__GLIBC__) || defined(__GNU__))
116 #    include <time.h>
117 #  endif
118 #else
119 #  include <time.h>
120    struct tm *gmtime(), *localtime();
121 #endif
122 
123 #if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN)))
124 #  include <unistd.h>           /* this includes utime.h on SGIs */
125 #  if (defined(BSD4_4) || defined(linux) || defined(__GLIBC__))
126 #    include <utime.h>
127 #    define GOT_UTIMBUF
128 #  endif
129 #  if (!defined(GOT_UTIMBUF) && (defined(__hpux) || defined(__SUNPRO_C)))
130 #    include <utime.h>
131 #    define GOT_UTIMBUF
132 #  endif
133 #  if (!defined(GOT_UTIMBUF) && defined(__GNU__))
134 #    include <utime.h>
135 #    define GOT_UTIMBUF
136 #  endif
137 #endif
138 #if (defined(__DGUX__) && !defined(GOT_UTIMBUF))
139    /* DG/UX requires this because of a non-standard struct utimebuf */
140 #  include <utime.h>
141 #  define GOT_UTIMBUF
142 #endif
143 
144 #if (defined(V7) || defined(pyr_bsd))
145 #  define strchr   index
146 #  define strrchr  rindex
147 #endif
148 #ifdef V7
149 #  define O_RDONLY 0
150 #  define O_WRONLY 1
151 #  define O_RDWR   2
152 #endif
153 
154 #if defined(NO_UNICODE_SUPPORT) && defined(UNICODE_SUPPORT)
155    /* disable Unicode (UTF-8) support when requested */
156 #  undef UNICODE_SUPPORT
157 #endif
158 
159 #if (defined(_MBCS) && defined(NO_MBCS))
160    /* disable MBCS support when requested */
161 #  undef _MBCS
162 #endif
163 
164 #if (!defined(NO_SETLOCALE) && !defined(_MBCS))
165 # if (!defined(UNICODE_SUPPORT) || !defined(UTF8_MAYBE_NATIVE))
166    /* enable setlocale here, unless this happens later for UTF-8 and/or
167     * MBCS support */
168 #  include <locale.h>
169 #  ifndef SETLOCALE
170 #    define SETLOCALE(category, locale) setlocale(category, locale)
171 #  endif
172 # endif
173 #endif
174 #ifndef NO_SETLOCALE
175 # if (!defined(NO_WORKING_ISPRINT) && !defined(HAVE_WORKING_ISPRINT))
176    /* enable "enhanced" unprintable chars detection in fnfilter() */
177 #  define HAVE_WORKING_ISPRINT
178 # endif
179 #endif
180 
181 #ifdef MINIX
182 #  include <stdio.h>
183 #endif
184 #if (!defined(HAVE_STRNICMP) & !defined(NO_STRNICMP))
185 #  define NO_STRNICMP
186 #endif
187 #ifndef DATE_FORMAT
188 #  define DATE_FORMAT DF_MDY    /* GRR:  customize with locale.h somehow? */
189 #endif
190 #define lenEOL          1
191 #ifdef EBCDIC
192 #  define PutNativeEOL  *q++ = '\n';
193 #else
194 #  define PutNativeEOL  *q++ = native(LF);
195 #endif
196 #define SCREENSIZE(ttrows, ttcols)  screensize(ttrows, ttcols)
197 #define SCREENWIDTH     80
198 #define SCREENLWRAP     1
199 #define USE_EF_UT_TIME
200 #if (!defined(NO_LCHOWN) || !defined(NO_LCHMOD))
201 #  define SET_SYMLINK_ATTRIBS
202 #endif
203 #ifdef MTS
204 #  ifdef SET_DIR_ATTRIB
205 #    undef SET_DIR_ATTRIB
206 #  endif
207 #else /* !MTS */
208 #  define SET_DIR_ATTRIB
209 #  if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))   /* GRR 970513 */
210 #    define TIMESTAMP
211 #  endif
212 #  define RESTORE_UIDGID
213 #endif /* ?MTS */
214 
215 /* Static variables that we have to add to Uz_Globs: */
216 #define SYSTEM_SPECIFIC_GLOBALS \
217     int created_dir, renamed_fullpath;\
218     char *rootpath, *buildpath, *end;\
219     ZCONST char *wildname;\
220     char *dirname, matchname[FILNAMSIZ];\
221     int rootlen, have_dirname, dirnamelen, notfirstcall;\
222     zvoid *wild_dir;
223 
224 /* created_dir, and renamed_fullpath are used by both mapname() and    */
225 /*    checkdir().                                                      */
226 /* rootlen, rootpath, buildpath and end are used by checkdir().        */
227 /* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */
228 /*    and notfirstcall are used by do_wild().                          */
229 
230 #endif /* !__unxcfg_h */
231