1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124 |
- #ifndef __unzpriv_h
- #define __unzpriv_h
- #ifndef UNZIP
- # define UNZIP
- #endif
- #ifndef MORE
- # ifndef RISCOS
- # define MORE
- # endif
- #endif
- #ifdef FUNZIP
- # ifdef REENTRANT
- # undef REENTRANT
- # endif
- # ifdef DLL
- # undef DLL
- # endif
- # ifdef SFX
- # undef SFX
- # endif
- # ifdef USE_BZIP2
- # undef USE_BZIP2
- # endif
- #endif
- #if (defined(USE_ZLIB) && !defined(HAVE_ZL_INFLAT64) && !defined(NO_DEFLATE64))
-
- # define NO_DEFLATE64
- #endif
- #ifdef NO_DEFLATE64
-
- # ifdef USE_DEFLATE64
- # undef USE_DEFLATE64
- # endif
- #else
-
- # if (!defined(USE_DEFLATE64) && !defined(SFX))
- # define USE_DEFLATE64
- # endif
- #endif
- #if (defined(SFX) && !defined(BZIP2_SFX) && defined(USE_BZIP2))
- # undef USE_BZIP2
- #endif
- #if (defined(NO_VMS_TEXT_CONV) || defined(VMS))
- # ifdef VMS_TEXT_CONV
- # undef VMS_TEXT_CONV
- # endif
- #else
- # if (!defined(VMS_TEXT_CONV) && !defined(SFX))
- # define VMS_TEXT_CONV
- # endif
- #endif
- #if (!defined(NO_UNIXBACKUP) && !defined(UNIXBACKUP))
- # if defined(UNIX) || defined(OS2) || defined(WIN32)
- # define UNIXBACKUP
- # endif
- #endif
- #if (defined(DLL) && !defined(REENTRANT))
- # define REENTRANT
- #endif
- #if (!defined(DYNAMIC_CRC_TABLE) && !defined(FUNZIP))
- # define DYNAMIC_CRC_TABLE
- #endif
- #if (defined(DYNAMIC_CRC_TABLE) && !defined(REENTRANT))
- # ifndef DYNALLOC_CRCTAB
- # define DYNALLOC_CRCTAB
- # endif
- #endif
- #if (defined(WIN32) && defined(UNIX))
-
- # if (defined(FORCE_WIN32_OVER_UNIX) && defined(FORCE_UNIX_OVER_WIN32))
-
- # undef FORCE_UNIX_OVER_WIN32
- # endif
- # ifdef FORCE_WIN32_OVER_UNIX
-
- # undef UNIX
- # else
-
- # undef WIN32
- # endif
- #endif
- #if (defined(M_XENIX) || defined(DNIX))
- # define NO_STDDEF_H
- #endif
- #if (defined(M_XENIX) && !defined(M_UNIX))
- # define SCO_XENIX
- # define NO_LIMITS_H
- # define NO_UID_GID
- # define size_t int
- #endif
- #ifdef realix
- # define SYSV
- # define NO_UID_GID
- #endif
- #if (defined(_AIX) && !defined(_ALL_SOURCE))
- # define _ALL_SOURCE
- #endif
- #if defined(apollo)
- # define NO_STDLIB_H
- #endif
- #ifdef DNIX
- # define SYSV
- # define SHORT_NAMES
- # define FILENAME_MAX NAME_MAX
- #endif
- #if (defined(SYSTEM_FIVE) || defined(__SYSTEM_FIVE))
- # ifndef SYSV
- # define SYSV
- # endif
- #endif
- #if (defined(M_SYSV) || defined(M_SYS5))
- # ifndef SYSV
- # define SYSV
- # endif
- #endif
- #if (defined(__SVR4) || defined(__svr4__) || defined(sgi) || defined(__hpux))
- # ifndef SYSV
- # define SYSV
- # endif
- #endif
- #if (defined(LINUX) || defined(__QNX__))
- # ifndef SYSV
- # define SYSV
- # endif
- #endif
- #if (defined(ultrix) || defined(__ultrix) || defined(bsd4_2))
- # if (!defined(BSD) && !defined(SYSV))
- # define BSD
- # endif
- #endif
- #if (defined(sun) || defined(pyr) || defined(CONVEX))
- # if (!defined(BSD) && !defined(SYSV))
- # define BSD
- # endif
- #endif
- #ifdef pyr
- # ifdef BSD
- # define pyr_bsd
- # define USE_STRINGS_H
- # define ZMEM
- # endif
- # define DECLARE_ERRNO
- #endif
- #if (defined(__TURBOC__) && !defined(WIN32))
- #endif
- #if (defined(VMS) || defined(__MINT__))
- # define WILD_STAT_BUG
- #endif
- #ifdef DLL
- # define MAIN UZ_EXP UzpMain
- # ifdef OS2DLL
- # undef Info
- # define REDIRECTC(c) varputchar(__G__ c)
- # define REDIRECTPRINT(buf,size) varmessage(__G__ buf, size)
- # define FINISH_REDIRECT() finish_REXX_redirect(__G)
- # else
- # define REDIRECTC(c)
- # define REDIRECTPRINT(buf,size) 0
- # define FINISH_REDIRECT() close_redirect(__G)
- # endif
- #endif
- #ifdef RISCOS
- # include "acorn/riscos.h"
- #endif
- #ifdef AMIGA
- # include "amiga/amiga.h"
- #endif
- #ifdef AOS_VS
- # ifdef __FILEIO_C
- # include "aosvs/aosvs.h"
- # endif
- #endif
- #ifdef ATARI
- # include <time.h>
- # include <stat.h>
- # include <fcntl.h>
- # include <limits.h>
- # define SYMLINKS
- # define EXE_EXTENSION ".tos"
- # ifndef DATE_FORMAT
- # define DATE_FORMAT DF_DMY
- # endif
- # define DIR_END '/'
- # define INT_SPRINTF
- # define timezone _timezone
- # define lenEOL 2
- # define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);}
- # undef SHORT_NAMES
- # if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
- # define TIMESTAMP
- # endif
- #endif
- #ifdef __ATHEOS__
- # include "atheos/athcfg.h"
- #endif
- #ifdef __BEOS__
- # include "beos/beocfg.h"
- #endif
- #ifdef __human68k__
-
-
- # if (!defined(_MBCS) && !defined(NO_MBCS))
-
- # define _MBCS
- # endif
- # if (defined(_MBCS) && defined(NO_MBCS))
-
- # undef _MBCS
- # endif
- # include <time.h>
- # include <fcntl.h>
- # include <io.h>
- # include <conio.h>
- # include <sys/stat.h>
- # ifdef HAVE_MBSTRING_H
- # include <mbstring.h>
- # endif
- # ifdef HAVE_MBCTYPE_H
- # include <mbctype.h>
- # else
- # ifndef _ismbblead
- # define _ismbblead(c) (0x80 <= (c) && ((c) < 0xa0 || 0xe0 <= (c)))
- # endif
- # endif
- # ifndef DATE_FORMAT
- # define DATE_FORMAT DF_YMD
- # endif
- # define lenEOL 1
- # define PutNativeEOL *q++ = native(LF);
- # define INT_SPRINTF
- # define SYMLINKS
- # ifdef SFX
- # define MAIN main_sfx
- # endif
- #endif
- #ifdef MACOS
- # include "maccfg.h"
- #endif
- #ifdef WINDLL
- # ifdef MORE
- # undef MORE
- # endif
- # ifdef OS2_EAS
- # undef OS2_EAS
- # endif
- #endif
- #if (defined(_MSC_VER) || (defined(M_I86) && !defined(__WATCOMC__)))
- # ifndef MSC
- # define MSC
- # endif
- #endif
- #if (defined(MSDOS) || defined(OS2) || defined(FLEXOS))
- # include <sys/types.h> /* off_t, time_t, dev_t, ... */
- # include <sys/stat.h>
- # include <io.h> /* lseek(), open(), setftime(), dup(), creat() */
- # include <time.h> /* localtime() */
- # include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */
- # ifdef OS2
- # include "os2/os2cfg.h"
- # else
- # ifdef FLEXOS
- # include "flexos/flxcfg.h"
- # else
- # include "msdos/doscfg.h"
- # endif
- # endif
- # if (defined(_MSC_VER) && (_MSC_VER == 700) && !defined(GRR))
-
- # define TIMET_TO_NATIVE(x) (x) += (ulg)2209075200L;
- # define NATIVE_TO_TIMET(x) (x) -= (ulg)2209075200L;
- # endif
- # if (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0450))
- # define timezone _timezone
- # endif
- # if (defined(__GO32__) || defined(FLEXOS))
- # define DIR_END '/'
- # else
- # define DIR_END '\\'
- # define DIR_END2 '/'
- # endif
- # ifdef DATE_FORMAT
- # undef DATE_FORMAT
- # endif
- # define DATE_FORMAT dateformat()
- # define lenEOL 2
- # define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);}
- # if (!defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME))
- # define USE_EF_UT_TIME
- # endif
- #endif
- #ifdef MTS
- # include <sys/types.h> /* off_t, time_t, dev_t, ... */
- # include <sys/stat.h>
- # include <sys/file.h> /* MTS uses this instead of fcntl.h */
- # include <timeb.h>
- # include <time.h>
- # include <unix.h> /* some important non-ANSI routines */
- # define mkdir(s,n) (-1)
- # define EBCDIC
- # define NO_STRNICMP
- # define USE_FWRITE
- # define close_outfile() fclose(G.outfile)
- # define umask(n)
- # define FOPWT "w"
- # ifndef DATE_FORMAT
- # define DATE_FORMAT DF_MDY
- # endif
- # define lenEOL 1
- # define PutNativeEOL *q++ = native(LF);
- #endif
-
- #ifdef NLM
- # include "netware/nlmcfg.h"
- #endif
-
- #ifdef QDOS
- # define DIRENT
- # include <fcntl.h>
- # include <unistd.h>
- # include <sys/stat.h>
- # include <time.h>
- # include "qdos/izqdos.h"
- # ifndef DATE_FORMAT
- # define DATE_FORMAT DF_MDY
- # endif
- # define lenEOL 1
- # define PutNativeEOL *q++ = native(LF);
- # define DIR_END '_'
- # define RETURN QReturn
- # undef PATH_MAX
- # define PATH_MAX 36
- # if (!defined(NOTIMESTAMP) && !defined(TIMESTAMP))
- # define TIMESTAMP
- # endif
- # define SCREENSIZE(ttrows, ttcols) screensize(ttrows, ttcols)
- # define SCREENWIDTH 80
- #endif
- #ifdef TANDEM
- # include "tandem.h"
- # include <fcntl.h>
- # ifndef __INT32
-
- # ifndef INT_16BIT
- # define INT_16BIT
- # endif
- # ifdef USE_DEFLATE64
-
- # define MED_MEM
- # define INBUFSIZ 8192
- # endif
- # endif
-
- # define PutNativeEOL *q++ = native(LF);
- # define lenEOL 1
- # ifndef DATE_FORMAT
- # define DATE_FORMAT DF_DMY
- # endif
- # define SCREENLINES 25
-
- # define RESTORE_UIDGID
- # define NO_STRNICMP
- #endif
- #ifdef THEOS
- # include "theos/thscfg.h"
- #endif
- #ifdef TOPS20
- # include <sys/types.h> /* off_t, time_t, dev_t, ... */
- # include <sys/stat.h>
- # include <sys/param.h>
- # include <sys/time.h>
- # include <sys/timeb.h>
- # include <sys/file.h>
- # include <timex.h>
- # include <monsym.h> /* get amazing monsym() macro */
- extern int open(), close(), read();
- extern int stat(), unlink(), jsys(), fcntl();
- extern long lseek(), dup(), creat();
- # define strchr index
- # define strrchr rindex
- # define REALLY_SHORT_SYMS
- # define NO_MKDIR
- # ifndef HAVE_STRNICMP
- # define NO_STRNICMP
- # endif
- # define DIR_BEG '<'
- # define DIR_END '>'
- # define DIR_EXT ".directory"
- # ifndef DATE_FORMAT
- # define DATE_FORMAT DF_MDY
- # endif
- # define EXE_EXTENSION ".exe"
- #endif
- #ifdef UNIX
- # include "unix/unxcfg.h"
- #endif
- #ifdef CMS_MVS
- # include "vmmvs.h"
- # define CLOSE_INFILE() close_infile(__G)
- #endif
- #ifdef VMS
- # include "vms/vmscfg.h"
- #endif
- #if (defined(WIN32) && !defined(POCKET_UNZIP) && !defined(_WIN32_WCE))
- # include "win32/w32cfg.h"
- #endif
- #if (defined(_WIN32_WCE) || defined(POCKET_UNZIP))
- # include "wince/wcecfg.h"
- #endif
- #ifdef EFT
- # define Z_OFF_T off_t
- #else
- #if (defined(UNIX) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
- # define Z_OFF_T off_t
- #else
- # define Z_OFF_T long
- #endif
- #endif
- #ifndef ZOFF_T_DEFINED
- typedef Z_OFF_T zoff_t;
- # define ZOFF_T_DEFINED
- #endif
- #ifndef Z_STAT_DEFINED
- typedef struct stat z_stat;
- # define Z_STAT_DEFINED
- #endif
- #ifndef MINIX
- # include <stdio.h>
- #endif
- #include <ctype.h> /* skip for VMS, to use tolower() function? */
- #include <errno.h> /* used in mapname() */
- #ifdef USE_STRINGS_H
- # include <strings.h> /* strcpy, strcmp, memcpy, index/rindex, etc. */
- #else
- # include <string.h> /* strcpy, strcmp, memcpy, strchr/strrchr, etc. */
- #endif
- #if (defined(MODERN) && !defined(NO_LIMITS_H))
- # include <limits.h> /* MAX/MIN constant symbols for system types... */
- #endif
- #include <signal.h> /* used in unzip.c, fileio.c */
- #ifdef MODERN
- # ifndef NO_STDDEF_H
- # include <stddef.h>
- # endif
- # ifndef NO_STDLIB_H
- # include <stdlib.h> /* standard library prototypes, malloc(), etc. */
- # endif
- typedef size_t extent;
- #else
- # ifndef AOS_VS
- Z_OFF_T lseek();
- # ifdef VAXC
- # include <stdlib.h>
- # else
- char *malloc();
- # endif
- # endif
- typedef unsigned int extent;
- #endif
- #define UNZIP_BZ2VERS 46
- #ifdef ZIP64_SUPPORT
- # ifdef USE_BZIP2
- # define UNZIP_VERSION UNZIP_BZ2VERS
- # else
- # define UNZIP_VERSION 45
- # endif
- #else
- #ifdef USE_DEFLATE64
- # define UNZIP_VERSION 21
- #else
- # define UNZIP_VERSION 20
- #endif
- #endif
- #define VMS_UNZIP_VERSION 42
- #if (defined(MSDOS) || defined(OS2))
- # define DOS_OS2
- #endif
- #if (defined(OS2) || defined(WIN32))
- # define OS2_W32
- #endif
- #if (defined(DOS_OS2) || defined(WIN32))
- # define DOS_OS2_W32
- # define DOS_W32_OS2
- #endif
- #if (defined(DOS_OS2_W32) || defined(__human68k__))
- # define DOS_H68_OS2_W32
- #endif
- #if (defined(DOS_OS2) || defined(FLEXOS))
- # define DOS_FLX_OS2
- #endif
- #if (defined(DOS_OS2_W32) || defined(FLEXOS))
- # define DOS_FLX_OS2_W32
- #endif
- #if (defined(DOS_H68_OS2_W32) || defined(FLEXOS))
- # define DOS_FLX_H68_OS2_W32
- #endif
- #if (defined(DOS_FLX_OS2) || defined(NLM))
- # define DOS_FLX_NLM_OS2
- #endif
- #if (defined(DOS_FLX_OS2_W32) || defined(NLM))
- # define DOS_FLX_NLM_OS2_W32
- #endif
- #if (defined(DOS_FLX_H68_OS2_W32) || defined(NLM))
- # define DOS_FLX_H68_NLM_OS2_W32
- #endif
- #if (defined(TOPS20) || defined(VMS))
- # define T20_VMS
- #endif
- #if (defined(MSDOS) || defined(T20_VMS))
- # define DOS_T20_VMS
- #endif
- #if (defined(__ATHEOS__) || defined(__BEOS__))
- # define ATH_BEO
- #endif
- #if (defined(ATH_BEO) || defined(UNIX))
- # define ATH_BEO_UNX
- #endif
- #if (defined(ATH_BEO_UNX) || defined(THEOS))
- # define ATH_BEO_THS_UNX
- #endif
- #ifndef DIR_END
- # define DIR_END '/'
- #endif
- #ifndef DATE_FORMAT
- # ifdef DATEFMT_ISO_DEFAULT
- # define DATE_FORMAT DF_YMD
- # else
- # define DATE_FORMAT DF_MDY
- # endif
- #endif
- #ifndef DATE_SEPCHAR
- # define DATE_SEPCHAR '-'
- #endif
- #ifndef CLOSE_INFILE
- # define CLOSE_INFILE() close(G.zipfd)
- #endif
- #ifndef RETURN
- # define RETURN return
- #endif
- #ifndef EXIT
- # define EXIT exit
- #endif
- #ifndef USAGE
- # define USAGE(ret) usage(__G__ (ret))
- #endif
- #ifndef TIMET_TO_NATIVE
- # define TIMET_TO_NATIVE(x)
- # define NATIVE_TO_TIMET(x)
- #endif
- #ifndef STRNICMP
- # ifdef NO_STRNICMP
- # define STRNICMP zstrnicmp
- # else
- # define STRNICMP strnicmp
- # endif
- #endif
- #if (defined(DOS_FLX_NLM_OS2_W32) || defined(ATH_BEO_UNX) || defined(RISCOS))
- # ifndef HAVE_UNLINK
- # define HAVE_UNLINK
- # endif
- #endif
- #if (defined(AOS_VS) || defined(ATARI))
- # ifndef HAVE_UNLINK
- # define HAVE_UNLINK
- # endif
- #endif
- #if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF))
- # if (defined(SYSV) || defined(CONVEX) || defined(NeXT) || defined(BSD4_4))
- # define INT_SPRINTF
- # endif
- # if (defined(DOS_FLX_NLM_OS2_W32) || defined(VMS) || defined(AMIGA))
- # define INT_SPRINTF
- # endif
- # if (defined(ultrix) || defined(__ultrix))
- # if (defined(POSIX) || defined(__POSIX))
- # define INT_SPRINTF
- # endif
- # ifdef __GNUC__
- # define PCHAR_SPRINTF
- # endif
- # endif
- # if (defined(__osf__) || defined(_AIX) || defined(CMS_MVS) || defined(THEOS))
- # define INT_SPRINTF
- # endif
- # if defined(sun)
- # define PCHAR_SPRINTF
- # endif
- #endif
- #if (!defined(PCHAR_SPRINTF) && !defined(INT_SPRINTF))
- # ifdef __STDC__
- # define INT_SPRINTF
- # endif
- # ifndef INT_SPRINTF
- # define PCHAR_SPRINTF
- # endif
- #endif
- #define MSG_STDERR(f) (f & 1)
- #define MSG_INFO(f) ((f & 6) == 0)
- #define MSG_WARN(f) ((f & 6) == 2)
- #define MSG_ERROR(f) ((f & 6) == 4)
- #define MSG_FATAL(f) ((f & 6) == 6)
- #define MSG_ZFN(f) (f & 0x0008)
- #define MSG_FN(f) (f & 0x0010)
- #define MSG_LNEWLN(f) (f & 0x0020)
- #define MSG_TNEWLN(f) (f & 0x0040)
- #define MSG_MNEWLN(f) (f & 0x0080)
- #define MSG_NO_WGUI(f) (f & 0x0100)
- #define MSG_NO_AGUI(f) (f & 0x0200)
- #define MSG_NO_DLL2(f) (f & 0x0400)
- #define MSG_NO_NDLL(f) (f & 0x0800)
- #define MSG_NO_WDLL(f) (f & 0x1000)
- #if (defined(MORE) && !defined(SCREENLINES))
- # ifdef DOS_FLX_NLM_OS2_W32
- # define SCREENLINES 25
- # else
- # define SCREENLINES 24
- # endif
- #endif
- #if (defined(MORE) && !defined(SCREENSIZE))
- # ifndef SCREENWIDTH
- # define SCREENSIZE(scrrows, scrcols) { \
- if ((scrrows) != NULL) *(scrrows) = SCREENLINES; }
- # else
- # define SCREENSIZE(scrrows, scrcols) { \
- if ((scrrows) != NULL) *(scrrows) = SCREENLINES; \
- if ((scrcols) != NULL) *(scrcols) = SCREENWIDTH; }
- # endif
- #endif
- #if (defined(__16BIT__) || defined(MED_MEM) || defined(SMALL_MEM))
- # define DIR_BLKSIZ 64
- #else
- # define DIR_BLKSIZ 16384
- #endif
- #ifndef WSIZE
- # ifdef USE_DEFLATE64
- # define WSIZE 65536L
- # else
- # define WSIZE 0x8000
- # endif
- #endif
- #ifdef __16BIT__
- # ifndef INT_16BIT
- # define INT_16BIT
- # endif
- #else
- # define nearmalloc malloc
- # define nearfree free
- # if (!defined(__IBMC__) || !defined(OS2))
- # ifndef near
- # define near
- # endif
- # ifndef far
- # define far
- # endif
- # endif
- #endif
- #if (defined(DYNALLOC_CRCTAB) && !defined(DYNAMIC_CRC_TABLE))
- # undef DYNALLOC_CRCTAB
- #endif
- #if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT))
- # undef DYNALLOC_CRCTAB
- #endif
- #if (defined(USE_ZLIB) && !defined(USE_OWN_CRCTAB))
- # ifdef DYNALLOC_CRCTAB
- # undef DYNALLOC_CRCTAB
- # endif
- #endif
- #if (defined(USE_ZLIB) && defined(ASM_CRC))
- # undef ASM_CRC
- #endif
- #ifdef USE_ZLIB
- # ifdef IZ_CRC_BE_OPTIMIZ
- # undef IZ_CRC_BE_OPTIMIZ
- # endif
- # ifdef IZ_CRC_LE_OPTIMIZ
- # undef IZ_CRC_LE_OPTIMIZ
- # endif
- #endif
- #if (!defined(IZ_CRC_BE_OPTIMIZ) && !defined(IZ_CRC_LE_OPTIMIZ))
- # ifdef IZ_CRCOPTIM_UNFOLDTBL
- # undef IZ_CRCOPTIM_UNFOLDTBL
- # endif
- #endif
- #ifndef INBUFSIZ
- # if (defined(MED_MEM) || defined(SMALL_MEM))
- # define INBUFSIZ 2048
- # else
- # define INBUFSIZ 8192
- # endif
- #endif
- #if (defined(INT_16BIT) && (defined(USE_DEFLATE64) || lenEOL > 1))
-
- # if (!defined(SMALL_MEM) && !defined(MED_MEM))
- # define MED_MEM
- # endif
- #endif
- #ifdef SMALL_MEM
- # define LoadFarString(x) fLoadFarString(__G__ (x))
- # define LoadFarStringSmall(x) fLoadFarStringSmall(__G__ (x))
- # define LoadFarStringSmall2(x) fLoadFarStringSmall2(__G__ (x))
- # if (defined(_MSC_VER) && (_MSC_VER >= 600))
- # define zfstrcpy(dest, src) _fstrcpy((dest), (src))
- # define zfstrcmp(s1, s2) _fstrcmp((s1), (s2))
- # endif
- # if !(defined(SFX) || defined(FUNZIP))
- # if (defined(_MSC_VER))
- # define zfmalloc(sz) _fmalloc((sz))
- # define zffree(x) _ffree(x)
- # endif
- # if (defined(__TURBOC__))
- # include <alloc.h>
- # define zfmalloc(sz) farmalloc((unsigned long)(sz))
- # define zffree(x) farfree(x)
- # endif
- # endif
- # ifndef Far
- # define Far far
- # endif
- # define OUTBUFSIZ INBUFSIZ
- # if (lenEOL == 1)
- # define RAWBUFSIZ (OUTBUFSIZ>>1)
- # else
- # define RAWBUFSIZ ((OUTBUFSIZ>>1) - (OUTBUFSIZ>>7))
- # endif
- # define TRANSBUFSIZ (OUTBUFSIZ-RAWBUFSIZ)
- typedef short shrint;
- #else
- # define zfstrcpy(dest, src) strcpy((dest), (src))
- # define zfstrcmp(s1, s2) strcmp((s1), (s2))
- # define zfmalloc malloc
- # define zffree(x) free(x)
- # ifdef QDOS
- # define LoadFarString(x) Qstrfix(x)
- # define LoadFarStringSmall(x) Qstrfix(x)
- # define LoadFarStringSmall2(x) Qstrfix(x)
- # else
- # define LoadFarString(x) (char *)(x)
- # define LoadFarStringSmall(x) (char *)(x)
- # define LoadFarStringSmall2(x) (char *)(x)
- # endif
- # ifdef MED_MEM
- # define OUTBUFSIZ 0xFF80
- # define TRANSBUFSIZ 0xFF80
- typedef short shrint;
- # else
- # define OUTBUFSIZ (lenEOL*WSIZE)
- # define TRANSBUFSIZ (lenEOL*OUTBUFSIZ)
- # ifdef AMIGA
- typedef short shrint;
- # else
- typedef int shrint;
- # endif
- # endif
- # define RAWBUFSIZ OUTBUFSIZ
- #endif
- #ifndef Far
- # define Far
- #endif
- #ifndef Cdecl
- # define Cdecl
- #endif
- #ifndef MAIN
- # define MAIN main
- #endif
- #ifdef SFX
- # ifndef NO_ZIPINFO
- # define NO_ZIPINFO
- # endif
- # ifdef TIMESTAMP
- # undef TIMESTAMP
- # endif
- #endif
- #ifdef SFX
- # ifdef CHEAP_SFX_AUTORUN
- # ifndef NO_SFX_EXDIR
- # define NO_SFX_EXDIR
- # endif
- # endif
- # ifndef NO_SFX_EXDIR
- # ifndef SFX_EXDIR
- # define SFX_EXDIR
- # endif
- # else
- # ifdef SFX_EXDIR
- # undef SFX_EXDIR
- # endif
- # endif
- #endif
- #if (defined(TIMESTAMP) && defined(NOTIMESTAMP))
- # undef TIMESTAMP
- #endif
- #if (!defined(COPYRIGHT_CLEAN) && !defined(USE_SMITH_CODE))
- # define COPYRIGHT_CLEAN
- #endif
- #if (!defined(LZW_CLEAN) && !defined(USE_UNSHRINK))
- # define USE_UNSHRINK
- #endif
- #ifndef O_BINARY
- # define O_BINARY 0
- #endif
- #ifndef PIPE_ERROR
- # ifndef EPIPE
- # define EPIPE -1
- # endif
- # define PIPE_ERROR (errno == EPIPE)
- #endif
- #ifdef VMS
- # define FOPR "r","ctx=stm"
- # define FOPM "r+","ctx=stm","rfm=fix","mrs=512"
- # define FOPW "w","ctx=stm","rfm=fix","mrs=512"
- # define FOPWR "w+","ctx=stm","rfm=fix","mrs=512"
- #endif
- #ifdef CMS_MVS
- # define FOPR "rb,byteseek"
- # define FOPM "r+b,byteseek"
- # ifdef MVS
- # define FOPW "wb,recfm=u,lrecl=32760,byteseek"
- # define FOPWE "wb"
- # define FOPWT "w,lrecl=133"
- # define FOPWTE "w"
- # else
- # define FOPW "wb,recfm=v,lrecl=32760"
- # define FOPWT "w"
- # endif
- #endif
- #ifdef TOPS20
- # define FOPW "w8"
- #endif
- #ifdef MODERN
- # ifndef FOPR
- # define FOPR "rb"
- # endif
- # ifndef FOPM
- # define FOPM "r+b"
- # endif
- # ifndef FOPW
- # define FOPW "wb"
- # endif
- # ifndef FOPWT
- # define FOPWT "wt"
- # endif
- # ifndef FOPWR
- # define FOPWR "w+b"
- # endif
- #else
- # ifndef FOPR
- # define FOPR "r"
- # endif
- # ifndef FOPM
- # define FOPM "r+"
- # endif
- # ifndef FOPW
- # define FOPW "w"
- # endif
- # ifndef FOPWT
- # define FOPWT "w"
- # endif
- # ifndef FOPWR
- # define FOPWR "w+"
- # endif
- #endif
- #ifdef DOS_FLX_NLM_OS2_W32
- # include <limits.h>
- #endif
- #ifdef VMS
- # undef PATH_MAX
- #endif
- #ifndef PATH_MAX
- # ifdef MAXPATHLEN
- # define PATH_MAX MAXPATHLEN
- # else
- # ifdef _MAX_PATH
- # define PATH_MAX _MAX_PATH
- # else
- # if FILENAME_MAX > 255
- # define PATH_MAX FILENAME_MAX
- # else
- # define PATH_MAX 1024
- # endif
- # endif
- # endif
- #endif
- #define FILNAMSIZ PATH_MAX
- #ifdef UNICODE_SUPPORT
- # if !(defined(UTF8_MAYBE_NATIVE) || defined(UNICODE_WCHAR))
- # undef UNICODE_SUPPORT
- # endif
- #endif
- #ifdef UNICODE_SUPPORT
- # ifdef UNICODE_WCHAR
- # if !(defined(_WIN32_WCE) || defined(POCKET_UNZIP))
- # include <wchar.h>
- # endif
- # endif
- # ifndef _MBCS
- # include <locale.h>
- # ifndef SETLOCALE
- # define SETLOCALE(category, locale) setlocale(category, locale)
- # endif
- # endif
- #endif
- #ifdef _MBCS
- # include <locale.h>
-
- # define ___MBS_TMP_DEF char *___tmp_ptr;
- # define ___TMP_PTR ___tmp_ptr
- # ifndef CLEN
- # define NEED_UZMBCLEN
- # define CLEN(ptr) (int)uzmbclen((ZCONST unsigned char *)(ptr))
- # endif
- # ifndef PREINCSTR
- # define PREINCSTR(ptr) (ptr += CLEN(ptr))
- # endif
- # define POSTINCSTR(ptr) (___TMP_PTR=(char *)(ptr), PREINCSTR(ptr),___TMP_PTR)
- char *plastchar OF((ZCONST char *ptr, extent len));
- # define lastchar(ptr, len) ((int)(unsigned)*plastchar(ptr, len))
- # ifndef MBSCHR
- # define NEED_UZMBSCHR
- # define MBSCHR(str,c) (char *)uzmbschr((ZCONST unsigned char *)(str), c)
- # endif
- # ifndef MBSRCHR
- # define NEED_UZMBSRCHR
- # define MBSRCHR(str,c) (char *)uzmbsrchr((ZCONST unsigned char *)(str), c)
- # endif
- # ifndef SETLOCALE
- # define SETLOCALE(category, locale) setlocale(category, locale)
- # endif
- #else
- # define ___MBS_TMP_DEF
- # define ___TMP_PTR
- # define CLEN(ptr) 1
- # define PREINCSTR(ptr) (++(ptr))
- # define POSTINCSTR(ptr) ((ptr)++)
- # define plastchar(ptr, len) (&ptr[(len)-1])
- # define lastchar(ptr, len) (ptr[(len)-1])
- # define MBSCHR(str, c) strchr(str, c)
- # define MBSRCHR(str, c) strrchr(str, c)
- # ifndef SETLOCALE
- # define SETLOCALE(category, locale)
- # endif
- #endif
- #define INCSTR(ptr) PREINCSTR(ptr)
- #if (defined(MALLOC_WORK) && !defined(MY_ZCALLOC))
-
- # ifndef zcalloc
- # define zcalloc(items, size) \
- (zvoid far *)calloc((unsigned)(items), (unsigned)(size))
- # endif
- # ifndef zcfree
- # define zcfree free
- # endif
- #endif
- #if (defined(CRAY) && defined(ZMEM))
- # undef ZMEM
- #endif
- #ifdef ZMEM
- # undef ZMEM
- # define memcmp(b1,b2,len) bcmp(b2,b1,len)
- # define memcpy(dest,src,len) bcopy(src,dest,len)
- # define memzero bzero
- #else
- # define memzero(dest,len) memset(dest,0,len)
- #endif
- #ifndef TRUE
- # define TRUE 1
- #endif
- #ifndef FALSE
- # define FALSE 0
- #endif
- #ifndef SEEK_SET
- # define SEEK_SET 0
- # define SEEK_CUR 1
- # define SEEK_END 2
- #endif
- #if (!defined(S_IEXEC) && defined(S_IXUSR))
- # define S_IEXEC S_IXUSR
- #endif
- #if (defined(UNIX) && defined(S_IFLNK) && !defined(MTS))
- # define SYMLINKS
- # ifndef S_ISLNK
- # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
- # endif
- #endif
- #ifndef S_ISDIR
- # ifdef CMS_MVS
- # define S_ISDIR(m) (FALSE)
- # else
- # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
- # endif
- #endif
- #ifndef IS_VOLID
- # define IS_VOLID(m) ((m) & 0x08)
- #endif
- #ifdef LARGE_FILE_SUPPORT
-
- # if defined(UNIX) || defined(VMS)
-
- # define zstat stat
- # define zfstat fstat
-
- # define zlseek lseek
- # define zfseeko fseeko
-
- # define zftello ftello
-
- # define zfopen fopen
- # define zfdopen fdopen
- # endif
- # ifdef WIN32
- # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__LCC__)
-
-
- # define zstat _stati64
- # define zfstat _fstati64
-
- # define zlseek _lseeki64
- # if defined(_MSC_VER) && (_MSC_VER >= 1400)
-
-
- # define zfseeko _fseeki64
-
- # define zftello _ftelli64
- # else
- # if defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ >= 0x800)
-
-
- # define zfseeko _fseeki64
-
- # define zftello _ftelli64
- # else
-
-
-
- int zfseeko OF((FILE *, zoff_t, int));
-
- zoff_t zftello OF((FILE *));
- # endif
- # endif
-
- # define zfopen fopen
- # define zfdopen fdopen
- # endif
- # ifdef __CYGWIN__
-
-
- # define zstat _stati64
- # define zfstat _fstati64
-
- # define zlseek _lseeki64
-
- # define zfseeko fseeko
-
- # define zftello ftello
-
- # define zfopen fopen
- # define zfdopen fdopen
- # endif
- # if defined(__WATCOMC__) || defined(__BORLANDC__)
-
-
- # define zstat _stati64
- # define zfstat _fstati64
- # ifdef __WATCOMC__
-
- # define zlseek _lseeki64
- # endif
-
- int zfseeko OF((FILE *, zoff_t, int));
-
- zoff_t zftello OF((FILE *));
-
- # define zfopen fopen
- # define zfdopen fdopen
- # endif
- # ifdef __IBMC__
-
-
-
-
-
- # endif
- # endif
- #else
-
- # ifndef REGULUS
- # define zstat stat
- # endif
- # define zfstat fstat
- # define zlseek lseek
- # define zfseeko fseek
- # define zftello ftell
- # define zfopen fopen
- # define zfdopen fdopen
- # if defined(UNIX) || defined(VMS) || defined(WIN32)
-
- # ifndef DO_SAFECHECK_2GB
- # define DO_SAFECHECK_2GB
- # endif
- # endif
- #endif
- #if (defined(DO_SAFECHECK_2GB) && defined(SFX))
- # undef DO_SAFECHECK_2GB
- #endif
- #ifndef SSTAT
- # ifdef WILD_STAT_BUG
- # define SSTAT(path,pbuf) (iswild(path) || zstat(path,pbuf))
- # else
- # define SSTAT zstat
- # endif
- #endif
- #ifndef FZOFFT_FMT
- # ifdef LARGE_FILE_SUPPORT
- # define FZOFFT_FMT "ll"
- # define FZOFFT_HEX_WID_VALUE "16"
- # else
- # define FZOFFT_FMT "l"
- # define FZOFFT_HEX_WID_VALUE "8"
- # endif
- #endif
- #define FZOFFT_HEX_WID ((char *) -1)
- #define FZOFFT_HEX_DOT_WID ((char *) -2)
- #define FZOFFT_NUM 4
- #define FZOFFT_LEN 24
- #ifdef SHORT_SYMS
- # define extract_or_test_files xtr_or_tst_files
- # define extract_or_test_member xtr_or_tst_member
- #endif
- #ifdef REALLY_SHORT_SYMS
- # define process_cdir_file_hdr XXpcdfh
- # define process_local_file_hdr XXplfh
- # define extract_or_test_files XXxotf
- # define extract_or_test_member XXxotm
- # define check_for_newer XXcfn
- # define overwrite_all XXoa
- # define process_all_files XXpaf
- # define extra_field XXef
- # define explode_lit8 XXel8
- # define explode_lit4 XXel4
- # define explode_nolit8 XXnl8
- # define explode_nolit4 XXnl4
- # define cpdist8 XXcpdist8
- # define inflate_codes XXic
- # define inflate_stored XXis
- # define inflate_fixed XXif
- # define inflate_dynamic XXid
- # define inflate_block XXib
- # define maxcodemax XXmax
- #endif
- #ifndef S_TIME_T_MAX
- # define S_TIME_T_MAX ((time_t)(ulg)0x7fffffffL)
- #endif
- #ifndef U_TIME_T_MAX
- # define U_TIME_T_MAX ((time_t)(ulg)0xffffffffL)
- #endif
- #ifdef DOSTIME_MINIMUM
- # undef DOSTIME_MINIMUM
- #endif
- #define DOSTIME_MINIMUM ((ulg)0x00210000L)
- #ifdef DOSTIME_2038_01_18
- # undef DOSTIME_2038_01_18
- #endif
- #define DOSTIME_2038_01_18 ((ulg)0x74320000L)
- #ifdef QDOS
- # define ZSUFX "_zip"
- # define ALT_ZSUFX ".zip"
- #else
- # ifdef RISCOS
- # define ZSUFX "/zip"
- # else
- # define ZSUFX ".zip"
- # endif
- # define ALT_ZSUFX ".ZIP"
- #endif
- #define CENTRAL_HDR_SIG "\001\002"
- #define LOCAL_HDR_SIG "\003\004"
- #define END_CENTRAL_SIG "\005\006"
- #define EXTD_LOCAL_SIG "\007\010"
- #define IZ_DIR 76
- #define MPN_OK 0
- #define MPN_INF_TRUNC (1<<8)
- #define MPN_INF_SKIP (2<<8)
- #define MPN_ERR_SKIP (3<<8)
- #define MPN_ERR_TOOLONG (4<<8)
- #define MPN_NOMEM (10<<8)
- #define MPN_CREATED_DIR (16<<8)
- #define MPN_VOL_LABEL (17<<8)
- #define MPN_INVALID (99<<8)
- #define MPN_MASK 0x7F00
- #define IZ_EF_TRUNC 79
- #define SKIP 0
- #define DISPLAY 1
- #define DISPL_8 5
- #define DS_FN 2
- #define DS_FN_C 2
- #define DS_FN_L 6
- #define EXTRA_FIELD 3
- #define DS_EF 3
- #ifdef AMIGA
- # define FILENOTE 4
- #endif
- #if (defined(SFX) && defined(CHEAP_SFX_AUTORUN))
- # define CHECK_AUTORUN 7
- # define CHECK_AUTORUN_Q 8
- #endif
- #define DOES_NOT_EXIST -1
- #define EXISTS_AND_OLDER 0
- #define EXISTS_AND_NEWER 1
- #define OVERWRT_QUERY 0
- #define OVERWRT_ALWAYS 1
- #define OVERWRT_NEVER 2
- #define IS_OVERWRT_ALL (G.overwrite_mode == OVERWRT_ALWAYS)
- #define IS_OVERWRT_NONE (G.overwrite_mode == OVERWRT_NEVER)
- #ifdef VMS
-
- # define OPENOUT_OK 0
- # define OPENOUT_FAILED 1
- # define OPENOUT_SKIPOK 2
- # define OPENOUT_SKIPWARN 3
- #endif
- #define ROOT 0
- #define INIT 1
- #define APPEND_DIR 2
- #define APPEND_NAME 3
- #define GETPATH 4
- #define END 5
- #define FS_FAT_ 0
- #define AMIGA_ 1
- #define VMS_ 2
- #define UNIX_ 3
- #define VM_CMS_ 4
- #define ATARI_ 5
- #define FS_HPFS_ 6
- #define MAC_ 7
- #define Z_SYSTEM_ 8
- #define CPM_ 9
- #define TOPS20_ 10
- #define FS_NTFS_ 11
- #define QDOS_ 12
- #define ACORN_ 13
- #define FS_VFAT_ 14
- #define MVS_ 15
- #define BEOS_ 16
- #define TANDEM_ 17
- #define THEOS_ 18
- #define MAC_OSX_ 19
- #define ATHEOS_ 30
- #define NUM_HOSTS 31
- #define STORED 0
- #define SHRUNK 1
- #define REDUCED1 2
- #define REDUCED2 3
- #define REDUCED3 4
- #define REDUCED4 5
- #define IMPLODED 6
- #define TOKENIZED 7
- #define DEFLATED 8
- #define ENHDEFLATED 9
- #define DCLIMPLODED 10
- #define BZIPPED 12
- #define LZMAED 14
- #define IBMTERSED 18
- #define IBMLZ77ED 19
- #define WAVPACKED 97
- #define PPMDED 98
- #define NUM_METHODS 17
- #define DF_MDY 0
- #define DF_DMY 1
- #define DF_YMD 2
- #define EF_PKSZ64 0x0001
- #define EF_AV 0x0007
- #define EF_EFS 0x0008
- #define EF_OS2 0x0009
- #define EF_PKW32 0x000a
- #define EF_PKVMS 0x000c
- #define EF_PKUNIX 0x000d
- #define EF_PKFORK 0x000e
- #define EF_PKPATCH 0x000f
- #define EF_PKPKCS7 0x0014
- #define EF_PKFX509 0x0015
- #define EF_PKCX509 0x0016
- #define EF_PKENCRHD 0x0017
- #define EF_PKRMCTL 0x0018
- #define EF_PKLSTCS7 0x0019
- #define EF_PKIBM 0x0065
- #define EF_PKIBM2 0x0066
- #define EF_IZVMS 0x4d49
- #define EF_IZUNIX 0x5855
- #define EF_IZUNIX2 0x7855
- #define EF_IZUNIX3 0x7875
- #define EF_TIME 0x5455
- #define EF_UNIPATH 0x7075
- #define EF_UNICOMNT 0x6375
- #define EF_MAC3 0x334d
- #define EF_JLMAC 0x07c8
- #define EF_ZIPIT 0x2605
- #define EF_ZIPIT2 0x2705
- #define EF_SMARTZIP 0x4d63
- #define EF_VMCMS 0x4704
- #define EF_MVS 0x470f
- #define EF_ACL 0x4c41
- #define EF_NTSD 0x4453
- #define EF_ATHEOS 0x7441
- #define EF_BEOS 0x6542
- #define EF_QDOS 0xfb4a
- #define EF_AOSVS 0x5356
- #define EF_SPARK 0x4341
- #define EF_TANDEM 0x4154
- #define EF_THEOS 0x6854
- #define EF_THEOSO 0x4854
- #define EF_MD5 0x4b46
- #define EF_ASIUNIX 0x756e
- #define EB_HEADSIZE 4
- #define EB_ID 0
- #define EB_LEN 2
- #define EB_UCSIZE_P 0
- #define EB_CMPRHEADLEN 6
- #define EB_UX_MINLEN 8
- #define EB_UX_FULLSIZE 12
- #define EB_UX_ATIME 0
- #define EB_UX_MTIME 4
- #define EB_UX_UID 8
- #define EB_UX_GID 10
- #define EB_UX2_MINLEN 4
- #define EB_UX2_UID 0
- #define EB_UX2_GID 2
- #define EB_UX2_VALID (1 << 8)
- #define EB_UX3_MINLEN 7
- #define EB_UT_MINLEN 1
- #define EB_UT_FLAGS 0
- #define EB_UT_TIME1 1
- #define EB_UT_FL_MTIME (1 << 0)
- #define EB_UT_FL_ATIME (1 << 1)
- #define EB_UT_FL_CTIME (1 << 2)
- #define EB_FLGS_OFFS 4
- #define EB_OS2_HLEN 4
- #define EB_BEOS_HLEN 5
- #define EB_BE_FL_UNCMPR 0x01
- #define EB_MAC3_HLEN 14
- #define EB_SMARTZIP_HLEN 64
- #define EB_M3_FL_DATFRK 0x01
- #define EB_M3_FL_UNCMPR 0x04
- #define EB_M3_FL_TIME64 0x08
- #define EB_M3_FL_NOUTC 0x10
- #define EB_NTSD_C_LEN 4
- #define EB_NTSD_L_LEN 5
- #define EB_NTSD_VERSION 4
- #define EB_NTSD_MAX_VER (0)
- #define EB_ASI_CRC32 0
- #define EB_ASI_MODE 4
- #define EB_IZVMS_HLEN 12
- #define EB_IZVMS_FLGS 4
- #define EB_IZVMS_UCSIZ 6
- #define EB_IZVMS_BCMASK 07
- #define EB_IZVMS_BCSTOR 0
- #define EB_IZVMS_BC00 1
- #define EB_IZVMS_BCDEFL 2
- #define LREC_SIZE 26
- #define CREC_SIZE 42
- #define ECREC_SIZE 18
- #define ECLOC64_SIZE 16
- #define ECREC64_SIZE 52
- #define MAX_BITS 13
- #define HSIZE (1 << MAX_BITS)
- #define LF 10
- #define CR 13
- #define CTRLZ 26
- #ifdef EBCDIC
- # define foreign(c) ascii[(uch)(c)]
- # define native(c) ebcdic[(uch)(c)]
- # define NATIVE "EBCDIC"
- # define NOANSIFILT
- #endif
- #ifdef VMS
- # define ENV_UNZIP "UNZIP_OPTS"
- # define ENV_ZIPINFO "ZIPINFO_OPTS"
- #endif
- #ifdef RISCOS
- # define ENV_UNZIP "Unzip$Options"
- # define ENV_ZIPINFO "Zipinfo$Options"
- # define ENV_UNZIPEXTS "Unzip$Exts"
- #endif
- #ifndef ENV_UNZIP
- # define ENV_UNZIP "UNZIP"
- # define ENV_ZIPINFO "ZIPINFO"
- #endif
- #define ENV_UNZIP2 "UNZIPOPT"
- #define ENV_ZIPINFO2 "ZIPINFOOPT"
- #if (!defined(QQ) && !defined(NOQQ))
- # define QQ
- #endif
- #ifdef QQ
- # define QCOND (!uO.qflag)
- #else
- # define QCOND (longhdr)
- #endif
- #ifdef OLD_QQ
- # define QCOND2 (uO.qflag < 2)
- #else
- # define QCOND2 (!uO.qflag)
- #endif
- #ifdef WILD_STOP_AT_DIR
- # define __WDLPRO , int sepc
- # define __WDL , sepc
- # define __WDLDEF int sepc;
- # define WISEP , (uO.W_flag ? '/' : '\0')
- #else
- # define __WDLPRO
- # define __WDL
- # define __WDLDEF
- # define WISEP
- #endif
- #ifdef ZIP64_SUPPORT
- # ifndef Z_UINT8_DEFINED
- # if (defined(__GNUC__) || defined(__hpux) || defined(__SUNPRO_C))
- typedef unsigned long long z_uint8;
- # else
- typedef unsigned __int64 z_uint8;
- # endif
- # define Z_UINT8_DEFINED
- # endif
- #endif
- #ifndef Z_UINT4_DEFINED
- # if (defined(MODERN) && !defined(NO_LIMITS_H))
- # if (defined(UINT_MAX) && (UINT_MAX == 0xffffffffUL))
- typedef unsigned int z_uint4;
- # define Z_UINT4_DEFINED
- # else
- # if (defined(ULONG_MAX) && (ULONG_MAX == 0xffffffffUL))
- typedef unsigned long z_uint4;
- # define Z_UINT4_DEFINED
- # else
- # if (defined(USHRT_MAX) && (USHRT_MAX == 0xffffffffUL))
- typedef unsigned short z_uint4;
- # define Z_UINT4_DEFINED
- # endif
- # endif
- # endif
- # endif
- #endif
- #ifndef Z_UINT4_DEFINED
- typedef ulg z_uint4;
- # define Z_UINT4_DEFINED
- #endif
- #ifdef ZIP64_SUPPORT
- typedef z_uint8 zusz_t;
- typedef z_uint8 zucn_t;
- typedef z_uint4 zuvl_t;
- # define MASK_ZUCN64 (~(zucn_t)0)
- #else
- typedef ulg zusz_t;
- typedef unsigned int zucn_t;
- typedef unsigned short zuvl_t;
- # define MASK_ZUCN64 (~(zucn_t)0)
- #endif
- #define MASK_ZUCN16 ((zucn_t)0xFFFF)
- #ifdef NO_UID_GID
- # ifdef UID_USHORT
- typedef unsigned short uid_t;
- typedef unsigned short gid_t;
- # else
- typedef unsigned int uid_t;
- typedef unsigned int gid_t;
- # endif
- #endif
- #if (defined(GOT_UTIMBUF) || defined(sgi) || defined(ATARI))
- typedef struct utimbuf ztimbuf;
- #else
- typedef struct ztimbuf {
- time_t actime;
- time_t modtime;
- } ztimbuf;
- #endif
- typedef struct iztimes {
- time_t atime;
- time_t mtime;
- time_t ctime;
- } iztimes;
- #ifdef SET_DIR_ATTRIB
- typedef struct direntry {
- struct direntry *next;
- char *fn;
- char buf[1];
- } direntry;
- #endif
- #ifdef SYMLINKS
- typedef struct slinkentry {
- struct slinkentry *next;
- extent targetlen;
- extent attriblen;
- char *target;
- char *fname;
- char buf[1];
- } slinkentry;
- #endif
- typedef struct min_info {
- zoff_t offset;
- zusz_t compr_size;
- zusz_t uncompr_size;
- ulg crc;
- zuvl_t diskstart;
- uch hostver;
- uch hostnum;
- unsigned file_attr;
- unsigned encrypted : 1;
- unsigned ExtLocHdr : 1;
- unsigned textfile : 1;
- unsigned textmode : 1;
- unsigned lcflag : 1;
- unsigned vollabel : 1;
- #ifdef SYMLINKS
- unsigned symlink : 1;
- #endif
- unsigned HasUxAtt : 1;
- #ifdef UNICODE_SUPPORT
- unsigned GPFIsUTF8: 1;
- #endif
- #ifndef SFX
- char Far *cfilname;
- #endif
- } min_info;
- typedef struct VMStimbuf {
- char *revdate;
- char *credate;
- } VMStimbuf;
- #ifdef MALLOC_WORK
- union work {
- struct {
- shrint *Parent;
- uch *value;
- uch *Stack;
- } shrink;
- uch *Slide;
- };
- #else
- union work {
- struct {
- shrint Parent[HSIZE];
- uch value[HSIZE];
- uch Stack[HSIZE];
- } shrink;
- uch Slide[WSIZE];
- };
- #endif
- #define slide G.area.Slide
- #if (defined(DLL) && !defined(NO_SLIDE_REDIR))
- # define redirSlide G.redirect_sldptr
- #else
- # define redirSlide G.area.Slide
- #endif
- typedef uch local_byte_hdr[ LREC_SIZE ];
- # define L_VERSION_NEEDED_TO_EXTRACT_0 0
- # define L_VERSION_NEEDED_TO_EXTRACT_1 1
- # define L_GENERAL_PURPOSE_BIT_FLAG 2
- # define L_COMPRESSION_METHOD 4
- # define L_LAST_MOD_DOS_DATETIME 6
- # define L_CRC32 10
- # define L_COMPRESSED_SIZE 14
- # define L_UNCOMPRESSED_SIZE 18
- # define L_FILENAME_LENGTH 22
- # define L_EXTRA_FIELD_LENGTH 24
- typedef uch cdir_byte_hdr[ CREC_SIZE ];
- # define C_VERSION_MADE_BY_0 0
- # define C_VERSION_MADE_BY_1 1
- # define C_VERSION_NEEDED_TO_EXTRACT_0 2
- # define C_VERSION_NEEDED_TO_EXTRACT_1 3
- # define C_GENERAL_PURPOSE_BIT_FLAG 4
- # define C_COMPRESSION_METHOD 6
- # define C_LAST_MOD_DOS_DATETIME 8
- # define C_CRC32 12
- # define C_COMPRESSED_SIZE 16
- # define C_UNCOMPRESSED_SIZE 20
- # define C_FILENAME_LENGTH 24
- # define C_EXTRA_FIELD_LENGTH 26
- # define C_FILE_COMMENT_LENGTH 28
- # define C_DISK_NUMBER_START 30
- # define C_INTERNAL_FILE_ATTRIBUTES 32
- # define C_EXTERNAL_FILE_ATTRIBUTES 34
- # define C_RELATIVE_OFFSET_LOCAL_HEADER 38
- typedef uch ec_byte_rec[ ECREC_SIZE+4 ];
- # define NUMBER_THIS_DISK 4
- # define NUM_DISK_WITH_START_CEN_DIR 6
- # define NUM_ENTRIES_CEN_DIR_THS_DISK 8
- # define TOTAL_ENTRIES_CENTRAL_DIR 10
- # define SIZE_CENTRAL_DIRECTORY 12
- # define OFFSET_START_CENTRAL_DIRECTORY 16
- # define ZIPFILE_COMMENT_LENGTH 20
- typedef uch ec_byte_loc64[ ECLOC64_SIZE+4 ];
- # define NUM_DISK_START_EOCDR64 4
- # define OFFSET_START_EOCDR64 8
- # define NUM_THIS_DISK_LOC64 16
- typedef uch ec_byte_rec64[ ECREC64_SIZE+4 ];
- # define ECREC64_LENGTH 4
- # define EC_VERSION_MADE_BY_0 12
- # define EC_VERSION_NEEDED_0 14
- # define NUMBER_THIS_DSK_REC64 16
- # define NUM_DISK_START_CEN_DIR64 20
- # define NUM_ENTRIES_CEN_DIR_THS_DISK64 24
- # define TOTAL_ENTRIES_CENTRAL_DIR64 32
- # define SIZE_CENTRAL_DIRECTORY64 40
- # define OFFSET_START_CENTRAL_DIRECT64 48
- typedef struct local_file_header {
- zusz_t csize;
- zusz_t ucsize;
- ulg last_mod_dos_datetime;
- ulg crc32;
- uch version_needed_to_extract[2];
- ush general_purpose_bit_flag;
- ush compression_method;
- ush filename_length;
- ush extra_field_length;
- } local_file_hdr;
- typedef struct central_directory_file_header {
- zusz_t csize;
- zusz_t ucsize;
- zusz_t relative_offset_local_header;
- ulg last_mod_dos_datetime;
- ulg crc32;
- ulg external_file_attributes;
- zuvl_t disk_number_start;
- ush internal_file_attributes;
- uch version_made_by[2];
- uch version_needed_to_extract[2];
- ush general_purpose_bit_flag;
- ush compression_method;
- ush filename_length;
- ush extra_field_length;
- ush file_comment_length;
- } cdir_file_hdr;
- typedef struct end_central_dir_record {
- zusz_t size_central_directory;
- zusz_t offset_start_central_directory;
- zucn_t num_entries_centrl_dir_ths_disk;
- zucn_t total_entries_central_dir;
- zuvl_t number_this_disk;
- zuvl_t num_disk_start_cdir;
- int have_ecr64;
- int is_zip64_archive;
- ush zipfile_comment_length;
- } ecdir_rec;
- struct huft {
- uch e;
- uch b;
- union {
- ush n;
- struct huft *t;
- } v;
- };
- typedef struct _APIDocStruct {
- char *compare;
- char *function;
- char *syntax;
- char *purpose;
- } APIDocStruct;
- #if (defined(OS2) && !defined(FUNZIP))
- # include "os2/os2data.h"
- #endif
- #include "globals.h"
- #ifndef WINDLL
- int MAIN OF((int argc, char **argv));
- int unzip OF((__GPRO__ int argc, char **argv));
- int uz_opts OF((__GPRO__ int *pargc, char ***pargv));
- int usage OF((__GPRO__ int error));
- #endif
- int process_zipfiles OF((__GPRO));
- void free_G_buffers OF((__GPRO));
- int process_cdir_file_hdr OF((__GPRO));
- int process_local_file_hdr OF((__GPRO));
- int getZip64Data OF((__GPRO__ ZCONST uch *ef_buf,
- unsigned ef_len));
- #ifdef UNICODE_SUPPORT
- int getUnicodeData OF((__GPRO__ ZCONST uch *ef_buf,
- unsigned ef_len));
- #endif
- unsigned ef_scan_for_izux OF((ZCONST uch *ef_buf, unsigned ef_len,
- int ef_is_c, ulg dos_mdatetime,
- iztimes *z_utim, ulg *z_uidgid));
- #if (defined(RISCOS) || defined(ACORN_FTYPE_NFS))
- zvoid *getRISCOSexfield OF((ZCONST uch *ef_buf, unsigned ef_len));
- #endif
- #ifndef SFX
- #ifndef NO_ZIPINFO
- #ifndef WINDLL
- int zi_opts OF((__GPRO__ int *pargc, char ***pargv));
- #endif
- void zi_end_central OF((__GPRO));
- int zipinfo OF((__GPRO));
- #endif
- int list_files OF((__GPRO));
- #ifdef TIMESTAMP
- int get_time_stamp OF((__GPRO__ time_t *last_modtime,
- ulg *nmember));
- #endif
- int ratio OF((zusz_t uc, zusz_t c));
- void fnprint OF((__GPRO));
- #endif
- int open_input_file OF((__GPRO));
- int open_outfile OF((__GPRO));
- void undefer_input OF((__GPRO));
- void defer_leftover_input OF((__GPRO));
- unsigned readbuf OF((__GPRO__ char *buf, register unsigned len));
- int readbyte OF((__GPRO));
- int fillinbuf OF((__GPRO));
- int seek_zipf OF((__GPRO__ zoff_t abs_offset));
- #ifdef FUNZIP
- int flush OF((__GPRO__ ulg size));
- #else
- int flush OF((__GPRO__ uch *buf, ulg size, int unshrink));
- #endif
- void handler OF((int signal));
- time_t dos_to_unix_time OF((ulg dos_datetime));
- int check_for_newer OF((__GPRO__ char *filename));
- int do_string OF((__GPRO__ unsigned int length, int option));
- ush makeword OF((ZCONST uch *b));
- ulg makelong OF((ZCONST uch *sig));
- zusz_t makeint64 OF((ZCONST uch *sig));
- char *fzofft OF((__GPRO__ zoff_t val,
- ZCONST char *pre, ZCONST char *post));
- #if (!defined(STR_TO_ISO) || defined(NEED_STR2ISO))
- char *str2iso OF((char *dst, ZCONST char *src));
- #endif
- #if (!defined(STR_TO_OEM) || defined(NEED_STR2OEM))
- char *str2oem OF((char *dst, ZCONST char *src));
- #endif
- #ifdef NO_STRNICMP
- int zstrnicmp OF((register ZCONST char *s1,
- register ZCONST char *s2,
- register unsigned n));
- #endif
- #ifdef REGULUS
- int zstat OF((ZCONST char *p, struct stat *s));
- #endif
- #ifdef ZMEM
- zvoid *memset OF((register zvoid *, register int, register unsigned int));
- int memcmp OF((register ZCONST zvoid*, register ZCONST zvoid *,
- register unsigned int));
- zvoid *memcpy OF((register zvoid *, register ZCONST zvoid *,
- register unsigned int));
- #endif
- #ifdef NEED_UZMBCLEN
- extent uzmbclen OF((ZCONST unsigned char *ptr));
- #endif
- #ifdef NEED_UZMBSCHR
- unsigned char *uzmbschr OF((ZCONST unsigned char *str, unsigned int c));
- #endif
- #ifdef NEED_UZMBSRCHR
- unsigned char *uzmbsrchr OF((ZCONST unsigned char *str, unsigned int c));
- #endif
- #ifdef SMALL_MEM
- char *fLoadFarString OF((__GPRO__ const char Far *sz));
- char *fLoadFarStringSmall OF((__GPRO__ const char Far *sz));
- char *fLoadFarStringSmall2 OF((__GPRO__ const char Far *sz));
- #ifndef zfstrcpy
- char Far * Far zfstrcpy OF((char Far *s1, const char Far *s2));
- #endif
- #if (!defined(SFX) && !defined(zfstrcmp))
- int Far zfstrcmp OF((const char Far *s1, const char Far *s2));
- #endif
- #endif
- int extract_or_test_files OF((__GPRO));
- #ifndef SFX
- unsigned find_compr_idx OF((unsigned compr_methodnum));
- #endif
- int memextract OF((__GPRO__ uch *tgt, ulg tgtsize,
- ZCONST uch *src, ulg srcsize));
- int memflush OF((__GPRO__ ZCONST uch *rawbuf, ulg size));
- #if (defined(VMS) || defined(VMS_TEXT_CONV))
- uch *extract_izvms_block OF((__GPRO__ ZCONST uch *ebdata,
- unsigned size, unsigned *retlen,
- ZCONST uch *init, unsigned needlen));
- #endif
- char *fnfilter OF((ZCONST char *raw, uch *space,
- extent size));
- #if (!defined(SFX) && !defined(FUNZIP))
- int explode OF((__GPRO));
- #endif
- int huft_free OF((struct huft *t));
- int huft_build OF((__GPRO__ ZCONST unsigned *b, unsigned n,
- unsigned s, ZCONST ush *d, ZCONST uch *e,
- struct huft **t, unsigned *m));
- #ifdef USE_ZLIB
- int UZinflate OF((__GPRO__ int is_defl64));
- # define inflate_free(x) inflateEnd(&((Uz_Globs *)(&G))->dstrm)
- #else
- int inflate OF((__GPRO__ int is_defl64));
- int inflate_free OF((__GPRO));
- #endif
- #if (!defined(SFX) && !defined(FUNZIP))
- #ifndef COPYRIGHT_CLEAN
- int unreduce OF((__GPRO));
- #endif
- #ifndef LZW_CLEAN
- int unshrink OF((__GPRO));
- #endif
- #endif
- #ifdef USE_BZIP2
- int UZbunzip2 OF((__GPRO));
- void bz_internal_error OF((int bzerrcode));
- #endif
- #ifdef DLL
- void setFileNotFound OF((__GPRO));
- int unzipToMemory OF((__GPRO__ char *zip, char *file,
- UzpBuffer *retstr));
- int redirect_outfile OF((__GPRO));
- int writeToMemory OF((__GPRO__ ZCONST uch *rawbuf,
- extent size));
- int close_redirect OF((__GPRO));
-
- int UzpUnzip OF((int argc, char **argv));
- #ifdef OS2DLL
- int varmessage OF((__GPRO__ ZCONST uch *buf, ulg size));
- int varputchar OF((__GPRO__ int c));
- int finish_REXX_redirect OF((__GPRO));
- #endif
- #ifdef API_DOC
- void APIhelp OF((__GPRO__ int argc, char **argv));
- #endif
- #endif
- #ifdef MSDOS
- #if (!defined(FUNZIP) && !defined(SFX) && !defined(WINDLL))
- void check_for_windows OF((ZCONST char *app));
- #endif
- #if (defined(__GO32__) || defined(__EMX__))
- unsigned _dos_getcountryinfo(void *);
- #if (!defined(__DJGPP__) || (__DJGPP__ < 2))
- unsigned _dos_setftime(int, unsigned, unsigned);
- unsigned _dos_setfileattr(const char *, unsigned);
- unsigned _dos_creat(const char *, unsigned, int *);
- void _dos_getdrive(unsigned *);
- unsigned _dos_close(int);
- #endif
- #endif
- #endif
- #ifdef OS2
- #if (defined(REENTRANT) && defined(USETHREADID))
- ulg GetThreadId OF((void));
- #endif
- int GetCountryInfo OF((void));
- long GetFileTime OF((ZCONST char *name));
- int IsUpperNLS OF((int nChr));
- int ToLowerNLS OF((int nChr));
- void DebugMalloc OF((void));
- #endif
- #ifdef QDOS
- int QMatch (uch, uch);
- void QFilename (__GPRO__ char *);
- char *Qstrfix (char *);
- int QReturn (int zip_error);
- #endif
- #ifdef TOPS20
- int upper OF((char *s));
- int enquote OF((char *s));
- int dequote OF((char *s));
- int fnlegal OF(());
- #endif
- #ifdef CMS_MVS
- extent getVMMVSexfield OF((char *type, uch *ef_block, unsigned datalen));
- FILE *vmmvs_open_infile OF((__GPRO));
- void close_infile OF((__GPRO));
- #endif
- #ifdef VMS
- int check_format OF((__GPRO));
- char *vms_msg_text OF((void));
- #ifdef RETURN_CODES
- void return_VMS OF((__GPRO__ int zip_error));
- #else
- void return_VMS OF((int zip_error));
- #endif
- #ifdef VMSCLI
- ulg vms_unzip_cmdline OF((int *, char ***));
- int VMSCLI_usage OF((__GPRO__ int error));
- #endif
- #endif
- #ifdef WIN32
- int IsWinNT OF((void));
- #ifdef NTSD_EAS
- void process_defer_NT OF((__GPRO));
- int test_NTSD OF((__GPRO__ uch *eb, unsigned eb_size,
- uch *eb_ucptr, ulg eb_ucsize));
- # define TEST_NTSD test_NTSD
- #endif
- #ifdef W32_STAT_BANDAID
- int zstat_win32 OF((__W32STAT_GLOBALS__
- const char *path, z_stat *buf));
- #endif
- #endif
- Uz_Globs *globalsCtor OF((void));
- int envargs OF((int *Pargc, char ***Pargv,
- ZCONST char *envstr, ZCONST char *envstr2));
-
- void mksargs OF((int *argcp, char ***argvp));
- int match OF((ZCONST char *s, ZCONST char *p,
- int ic __WDLPRO));
- int iswild OF((ZCONST char *p));
- int dateformat OF((void));
- char dateseparator OF((void));
- #ifndef WINDLL
- void version OF((__GPRO));
- #endif
- int mapattr OF((__GPRO));
- int mapname OF((__GPRO__ int renamed));
- int checkdir OF((__GPRO__ char *pathcomp, int flag));
- char *do_wild OF((__GPRO__ ZCONST char *wildzipfn));
- char *GetLoadPath OF((__GPRO));
- #if (defined(MORE) && (defined(ATH_BEO_UNX) || defined(QDOS) || defined(VMS)))
- int screensize OF((int *tt_rows, int *tt_cols));
- # if defined(VMS)
- int screenlinewrap OF((void));
- # endif
- #endif
- #ifdef OS2_W32
- int SetFileSize OF((FILE *file, zusz_t filesize));
- #endif
- #ifndef MTS
- void close_outfile OF((__GPRO));
- #endif
- #ifdef SET_SYMLINK_ATTRIBS
- int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry));
- #endif
- #ifdef SET_DIR_ATTRIB
- int defer_dir_attribs OF((__GPRO__ direntry **pd));
- int set_direc_attribs OF((__GPRO__ direntry *d));
- #endif
- #ifdef TIMESTAMP
- # ifdef WIN32
- int stamp_file OF((__GPRO__
- ZCONST char *fname, time_t modtime));
- # else
- int stamp_file OF((ZCONST char *fname, time_t modtime));
- # endif
- #endif
- #ifdef NEED_ISO_OEM_INIT
- void prepare_ISO_OEM_translat OF((__GPRO));
- #endif
- #if (defined(MALLOC_WORK) && defined(MY_ZCALLOC))
- zvoid far *zcalloc OF((unsigned int, unsigned int));
- zvoid zcfree OF((zvoid far *));
- #endif
- #ifdef SYSTEM_SPECIFIC_CTOR
- void SYSTEM_SPECIFIC_CTOR OF((__GPRO));
- #endif
- #ifdef SYSTEM_SPECIFIC_DTOR
- void SYSTEM_SPECIFIC_DTOR OF((__GPRO));
- #endif
- #ifndef MAX
- # define MAX(a,b) ((a) > (b) ? (a) : (b))
- #endif
- #ifndef MIN
- # define MIN(a,b) ((a) < (b) ? (a) : (b))
- #endif
- #ifdef DEBUG
- # if (defined(THEOS) && defined(NO_BOGUS_SPC))
- # define NO_DEBUG_IN_MACROS
- # define Trace(x) _fprintf x
- # else
- # define Trace(x) fprintf x
- # endif
- #else
- # define Trace(x)
- #endif
- #ifdef DEBUG_TIME
- # define TTrace(x) fprintf x
- #else
- # define TTrace(x)
- #endif
- #ifdef NO_DEBUG_IN_MACROS
- # define MTrace(x)
- #else
- # define MTrace(x) Trace(x)
- #endif
- #if (defined(UNIX) || defined(T20_VMS))
- # define ToLower(x) ((char)(isupper((int)x)? tolower((int)x) : x))
- #else
- # define ToLower tolower
- #endif
- #ifdef USE_STRM_INPUT
-
- # define read(fd,buf,n) fread((buf),1,(n),(FILE *)(fd))
- # ifdef zlseek
- # undef zlseek
- # endif
- # define zlseek(fd,o,w) zfseeko((FILE *)(fd),(o),(w))
- # define close(fd) fclose((FILE *)(fd))
- #endif
- #ifndef Info
- # ifdef FUNZIP
- # define Info(buf,flag,sprf_arg) \
- fputs((char *)(sprintf sprf_arg, (buf)), (flag)&1? stderr : stdout)
- # else
- # ifdef INT_SPRINTF
- # define Info(buf,flag,sprf_arg) \
- (*G.message)((zvoid *)&G, (uch *)(buf), (ulg)sprintf sprf_arg, (flag))
- # else
- # define Info(buf,flag,sprf_arg) \
- (*G.message)((zvoid *)&G, (uch *)(buf), \
- (ulg)(sprintf sprf_arg, strlen((char *)(buf))), (flag))
- # endif
- # endif
- #endif
- #define FmZofft(val, pre, post) fzofft(__G__ val, pre, post)
- #define FnFilter1(fname) \
- fnfilter((fname), slide + (extent)(WSIZE>>1), (extent)(WSIZE>>2))
- #define FnFilter2(fname) \
- fnfilter((fname), slide + (extent)((WSIZE>>1) + (WSIZE>>2)),\
- (extent)(WSIZE>>2))
- #ifndef FUNZIP
- # define MESSAGE(str,len,flag) (*G.message)((zvoid *)&G,(str),(len),(flag))
- #endif
- #if 0
- # define CRCVAL_INITIAL crc32(0L, NULL, 0)
- #else
- # define CRCVAL_INITIAL 0L
- #endif
- #ifdef SYMLINKS
-
- # define SYMLINK_HOST(hn) ((hn) == UNIX_ || (hn) == ATARI_ || \
- (hn) == ATHEOS_ || (hn) == BEOS_ || (hn) == VMS_)
- #endif
- #ifndef TEST_NTSD
- # define TEST_NTSD NULL
- #endif
- #define SKIP_(length) if(length&&((error=do_string(__G__ length,SKIP))!=0))\
- {error_in_archive=error; if(error>1) return error;}
- #ifdef FUNZIP
- # define FLUSH(w) flush(__G__ (ulg)(w))
- # define NEXTBYTE getc(G.in)
- #else
- # define FLUSH(w) ((G.mem_mode) ? memflush(__G__ redirSlide,(ulg)(w)) \
- : flush(__G__ redirSlide,(ulg)(w),0))
- # define NEXTBYTE (G.incnt-- > 0 ? (int)(*G.inptr++) : readbyte(__G))
- #endif
- #define READBITS(nbits,zdest) {if(nbits>G.bits_left) {int temp; G.zipeof=1;\
- while (G.bits_left<=8*(int)(sizeof(G.bitbuf)-1) && (temp=NEXTBYTE)!=EOF) {\
- G.bitbuf|=(ulg)temp<<G.bits_left; G.bits_left+=8; G.zipeof=0;}}\
- zdest=(shrint)((unsigned)G.bitbuf&mask_bits[nbits]);G.bitbuf>>=nbits;\
- G.bits_left-=nbits;}
- #ifdef _MBCS
- # define STRLOWER(str1, str2) \
- { \
- char *p, *q, c; unsigned i; \
- p = (char *)(str1); \
- q = (char *)(str2); \
- while ((c = *p) != '\0') { \
- if ((i = CLEN(p)) > 1) { \
- while (i--) *q++ = *p++; \
- } else { \
- *q++ = (char)(isupper((int)(c))? tolower((int)(c)) : c); \
- p++; \
- } \
- } \
- *q = '\0'; \
- }
- #else
- # define STRLOWER(str1, str2) \
- { \
- char *p, *q; \
- p = (char *)(str1) - 1; \
- q = (char *)(str2); \
- while (*++p) \
- *q++ = (char)(isupper((int)(*p))? tolower((int)(*p)) : *p); \
- *q = '\0'; \
- }
- #endif
- #ifndef foreign
- # define foreign(c) (c)
- #endif
- #ifndef native
- # define native(c) (c)
- # define A_TO_N(str1)
- #else
- # ifndef NATIVE
- # define NATIVE "native chars"
- # endif
- # define A_TO_N(str1) {register uch *p;\
- for (p=(uch *)(str1); *p; p++) *p=native(*p);}
- #endif
- #if (!defined(NATIVE) && !defined(CRTL_CP_IS_ISO) && !defined(CRTL_CP_IS_OEM))
- # define CRTL_CP_IS_ISO
- #endif
- #ifndef _ISO_INTERN
- # ifdef CRTL_CP_IS_OEM
- # ifndef IZ_ISO2OEM_ARRAY
- # define IZ_ISO2OEM_ARRAY
- # endif
- # define _ISO_INTERN(str1) if (iso2oem) {register uch *p;\
- for (p=(uch *)(str1); *p; p++)\
- *p = native((*p & 0x80) ? iso2oem[*p & 0x7f] : *p);}
- # else
- # define _ISO_INTERN(str1) A_TO_N(str1)
- # endif
- #endif
- #ifndef _OEM_INTERN
- # ifdef CRTL_CP_IS_OEM
- # define _OEM_INTERN(str1) A_TO_N(str1)
- # else
- # ifndef IZ_OEM2ISO_ARRAY
- # define IZ_OEM2ISO_ARRAY
- # endif
- # define _OEM_INTERN(str1) if (oem2iso) {register uch *p;\
- for (p=(uch *)(str1); *p; p++)\
- *p = native((*p & 0x80) ? oem2iso[*p & 0x7f] : *p);}
- # endif
- #endif
- #ifndef STR_TO_ISO
- # ifdef CRTL_CP_IS_ISO
- # define STR_TO_ISO strcpy
- # else
- # define STR_TO_ISO str2iso
- # define NEED_STR2ISO
- # endif
- #endif
- #ifndef STR_TO_OEM
- # ifdef CRTL_CP_IS_OEM
- # define STR_TO_OEM strcpy
- # else
- # define STR_TO_OEM str2oem
- # define NEED_STR2OEM
- # endif
- #endif
- #if (!defined(INTERN_TO_ISO) && !defined(ASCII2ISO))
- # ifdef CRTL_CP_IS_OEM
-
- # define ASCII2ISO(c) \
- ((((c) & 0x80) && oem2iso) ? oem2iso[(c) & 0x7f] : (c))
- # if (defined(NEED_STR2ISO) && !defined(CRYP_USES_OEM2ISO))
- # define CRYP_USES_OEM2ISO
- # endif
- # else
-
- # define ASCII2ISO(c) (c)
- # endif
- #endif
- #if (!defined(INTERN_TO_OEM) && !defined(ASCII2OEM))
- # ifdef CRTL_CP_IS_OEM
-
- # define ASCII2OEM(c) (c)
- # else
-
- # define ASCII2OEM(c) \
- ((((c) & 0x80) && iso2oem) ? iso2oem[(c) & 0x7f] : (c))
- # if (defined(NEED_STR2OEM) && !defined(CRYP_USES_ISO2OEM))
- # define CRYP_USES_ISO2OEM
- # endif
- # endif
- #endif
- #ifdef CRTL_CP_IS_ISO
- # ifndef STR_TO_CP2
- # define STR_TO_CP2 STR_TO_OEM
- # endif
- #else
- # ifdef CRTL_CP_IS_OEM
- # ifndef STR_TO_CP2
- # define STR_TO_CP2 STR_TO_ISO
- # endif
- # else
- # ifndef STR_TO_CP1
- # define STR_TO_CP1 STR_TO_ISO
- # endif
- # ifndef STR_TO_CP2
- # define STR_TO_CP2 STR_TO_OEM
- # endif
- # endif
- #endif
- #ifndef Ext_ASCII_TO_Native
- # define Ext_ASCII_TO_Native(string, hostnum, hostver, isuxatt, islochdr) \
- if (((hostnum) == FS_FAT_ && \
- !(((islochdr) || (isuxatt)) && \
- ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \
- (hostnum) == FS_HPFS_ || \
- ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \
- _OEM_INTERN((string)); \
- } else { \
- _ISO_INTERN((string)); \
- }
- #endif
- extern ZCONST unsigned near mask_bits[17];
- extern ZCONST char *fnames[2];
- #ifdef EBCDIC
- extern ZCONST uch ebcdic[];
- #endif
- #ifdef IZ_ISO2OEM_ARRAY
- extern ZCONST uch Far *iso2oem;
- extern ZCONST uch Far iso2oem_850[];
- #endif
- #ifdef IZ_OEM2ISO_ARRAY
- extern ZCONST uch Far *oem2iso;
- extern ZCONST uch Far oem2iso_850[];
- #endif
- extern ZCONST char Far VersionDate[];
- extern ZCONST char Far CentSigMsg[];
- #ifndef SFX
- extern ZCONST char Far EndSigMsg[];
- #endif
- extern ZCONST char Far SeekMsg[];
- extern ZCONST char Far FilenameNotMatched[];
- extern ZCONST char Far ExclFilenameNotMatched[];
- extern ZCONST char Far ReportMsg[];
- #ifndef SFX
- extern ZCONST char Far Zipnfo[];
- extern ZCONST char Far CompiledWith[];
- #endif
- #ifdef DECLARE_ERRNO
- extern int errno;
- #endif
- #if (defined(UNICODE_SUPPORT) && defined(UNICODE_WCHAR))
-
- # define zwchar_to_wchar_t_default_char '_'
-
- # define wide_to_mb_default_string "_"
-
- typedef unsigned long zwchar;
-
- # if 0
-
- int is_ascii_string OF((ZCONST char *mbstring));
- # endif
-
- char *utf8_to_local_string OF((ZCONST char *utf8_string, int escape_all));
-
- zwchar *utf8_to_wide_string OF((ZCONST char *utf8_string));
-
- char *wide_to_local_string OF((ZCONST zwchar *wide_string, int escape_all));
- # if 0
-
- char *local_to_display_string OF((ZCONST char *local_string));
- # endif
-
- char *wide_to_escape_string OF((unsigned long));
- # define utf8_to_escaped_string(utf8_string) \
- utf8_to_local_string(utf8_string, TRUE)
- # if 0
-
- unsigned long escape_string_to_wide OF((ZCONST char *escape_string));
-
- char *local_to_utf8_string OF ((ZCONST char *local_string));
-
- zwchar *local_to_wide_string OF ((ZCONST char *local_string));
-
- char *wide_to_utf8_string OF((ZCONST zwchar *wide_string));
- # endif
- #endif
- #endif
|