| 234 | /*******************************/ |
| 235 | |
| 236 | int process_zipfiles(__G) /* return PK-type error code */ |
| 237 | __GDEF |
| 238 | { |
| 239 | #ifndef SFX |
| 240 | char *lastzipfn = (char *)NULL; |
| 241 | int NumWinFiles, NumLoseFiles, NumWarnFiles; |
| 242 | int NumMissDirs, NumMissFiles; |
| 243 | #endif |
| 244 | int error=0, error_in_archive=0; |
| 245 | |
| 246 | |
| 247 | /*--------------------------------------------------------------------------- |
| 248 | Start by allocating buffers and (re)constructing the various PK signature |
| 249 | strings. |
| 250 | ---------------------------------------------------------------------------*/ |
| 251 | |
| 252 | G.inbuf = (uch *)malloc(INBUFSIZ + 4); /* 4 extra for hold[] (below) */ |
| 253 | G.outbuf = (uch *)malloc(OUTBUFSIZ + 1); /* 1 extra for string term. */ |
| 254 | |
| 255 | if ((G.inbuf == (uch *)NULL) || (G.outbuf == (uch *)NULL)) { |
| 256 | Info(slide, 0x401, ((char *)slide, |
| 257 | LoadFarString(CannotAllocateBuffers))); |
| 258 | return(PK_MEM); |
| 259 | } |
| 260 | G.hold = G.inbuf + INBUFSIZ; /* to check for boundary-spanning sigs */ |
| 261 | #ifndef VMS /* VMS uses its own buffer scheme for textmode flush(). */ |
| 262 | #ifdef SMALL_MEM |
| 263 | G.outbuf2 = G.outbuf+RAWBUFSIZ; /* never changes */ |
| 264 | #endif |
| 265 | #endif /* !VMS */ |
| 266 | |
| 267 | #if 0 /* CRC_32_TAB has been NULLified by CONSTRUCTGLOBALS !!!! */ |
| 268 | /* allocate the CRC table later when we know we can read zipfile data */ |
| 269 | CRC_32_TAB = NULL; |
| 270 | #endif /* 0 */ |
| 271 | |
| 272 | /* finish up initialization of magic signature strings */ |
| 273 | local_hdr_sig[0] /* = extd_local_sig[0] */ = /* ASCII 'P', */ |
| 274 | central_hdr_sig[0] = end_central_sig[0] = /* not EBCDIC */ |
| 275 | end_centloc64_sig[0] = end_central64_sig[0] = 0x50; |
| 276 | |
| 277 | local_hdr_sig[1] /* = extd_local_sig[1] */ = /* ASCII 'K', */ |
| 278 | central_hdr_sig[1] = end_central_sig[1] = /* not EBCDIC */ |
| 279 | end_centloc64_sig[1] = end_central64_sig[1] = 0x4B; |
| 280 | |
| 281 | /*--------------------------------------------------------------------------- |
| 282 | Make sure timezone info is set correctly; localtime() returns GMT on some |
| 283 | OSes (e.g., Solaris 2.x) if this isn't done first. The ifdefs around |
| 284 | tzset() were initially copied from dos_to_unix_time() in fileio.c. They |
| 285 | may still be too strict; any listed OS that supplies tzset(), regardless |
| 286 | of whether the function does anything, should be removed from the ifdefs. |
| 287 | ---------------------------------------------------------------------------*/ |
| 288 | |
| 289 | #if (defined(WIN32) && defined(USE_EF_UT_TIME)) |
| 290 | /* For the Win32 environment, we may have to "prepare" the environment |
| 291 | prior to the tzset() call, to work around tzset() implementation bugs. |
| 292 | */ |
| 293 | iz_w32_prepareTZenv(); |
no test coverage detected