?? unzip.c
字號(hào):
static ZCONST char Far Dll[] = "DLL";# endif# ifdef DOSWILD static ZCONST char Far DosWild[] = "DOSWILD";# endif# ifdef LZW_CLEAN static ZCONST char Far LZW_Clean[] = "LZW_CLEAN (PKZIP/Zip 1.x unshrinking method not supported)";# endif# ifndef MORE static ZCONST char Far No_More[] = "NO_MORE";# endif# ifdef NO_ZIPINFO static ZCONST char Far No_ZipInfo[] = "NO_ZIPINFO";# endif# ifdef NTSD_EAS static ZCONST char Far NTSDExtAttrib[] = "NTSD_EAS";# endif# ifdef OLD_THEOS_EXTRA static ZCONST char Far OldTheosExtra[] = "OLD_THEOS_EXTRA (handle also old Theos port extra field)";# endif# ifdef OS2_EAS static ZCONST char Far OS2ExtAttrib[] = "OS2_EAS";# endif# ifdef QLZIP static ZCONST char Far SMSExFldOnUnix[] = "QLZIP";# endif# ifdef REENTRANT static ZCONST char Far Reentrant[] = "REENTRANT";# endif# ifdef REGARGS static ZCONST char Far RegArgs[] = "REGARGS";# endif# ifdef RETURN_CODES static ZCONST char Far Return_Codes[] = "RETURN_CODES";# endif# ifdef SET_DIR_ATTRIB static ZCONST char Far SetDirAttrib[] = "SET_DIR_ATTRIB";# endif# ifdef TIMESTAMP static ZCONST char Far TimeStamp[] = "TIMESTAMP";# endif# ifdef UNIXBACKUP static ZCONST char Far UnixBackup[] = "UNIXBACKUP";# endif# ifdef USE_EF_UT_TIME static ZCONST char Far Use_EF_UT_time[] = "USE_EF_UT_TIME";# endif# ifndef LZW_CLEAN static ZCONST char Far Use_Unshrink[] = "USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)";# endif# ifndef COPYRIGHT_CLEAN static ZCONST char Far Use_Smith_Code[] = "USE_SMITH_CODE (PKZIP 0.9x unreducing method supported)";# endif# ifdef USE_DEFLATE64 static ZCONST char Far Use_Deflate64[] = "USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)";# endif# ifdef MULT_VOLUME static ZCONST char Far Use_MultiVol[] = "MULT_VOLUME (multi-volume archives supported)";# endif# if (defined(__DJGPP__) && (__DJGPP__ >= 2))# ifdef USE_DJGPP_ENV static ZCONST char Far Use_DJGPP_Env[] = "USE_DJGPP_ENV";# endif# ifdef USE_DJGPP_GLOB static ZCONST char Far Use_DJGPP_Glob[] = "USE_DJGPP_GLOB";# endif# endif /* __DJGPP__ && (__DJGPP__ >= 2) */# ifdef USE_VFAT static ZCONST char Far Use_VFAT_support[] = "USE_VFAT";# endif# ifdef USE_ZLIB static ZCONST char Far UseZlib[] = "USE_ZLIB (compiled with version %s; using version %s)";# endif# ifdef VMS_TEXT_CONV static ZCONST char Far VmsTextConv[] = "VMS_TEXT_CONV";# endif# ifdef VMSCLI static ZCONST char Far VmsCLI[] = "VMSCLI";# endif# ifdef VMSWILD static ZCONST char Far VmsWild[] = "VMSWILD";# endif# ifdef WILD_STOP_AT_DIR static ZCONST char Far WildStopAtDir[] = "WILD_STOP_AT_DIR";# endif# if CRYPT# ifdef PASSWD_FROM_STDIN static ZCONST char Far PasswdStdin[] = "PASSWD_FROM_STDIN";# endif static ZCONST char Far Decryption[] = "\t[decryption, version %d.%d%s of %s]\n"; static ZCONST char Far CryptDate[] = CR_VERSION_DATE;# endif# ifndef __RSXNT__# ifdef __EMX__ static ZCONST char Far EnvEMX[] = "EMX"; static ZCONST char Far EnvEMXOPT[] = "EMXOPT";# endif# if (defined(__GO32__) && (!defined(__DJGPP__) || (__DJGPP__ < 2))) static ZCONST char Far EnvGO32[] = "GO32"; static ZCONST char Far EnvGO32TMP[] = "GO32TMP";# endif# endif /* !__RSXNT__ */#ifdef VMS/* UnzipUsageLine1[] is also used in vms/cmdline.c: do not make it static */ ZCONST char Far UnzipUsageLine1[] = "\UnZip %d.%d%d%s of %s, by Info-ZIP. For more details see: unzip -v.\n\n";#ifdef COPYRIGHT_CLEAN static ZCONST char Far UnzipUsageLine1v[] = "\UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\\n\n";#else static ZCONST char Far UnzipUsageLine1v[] = "\UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\\n\n";#endif /* ?COPYRIGHT_CLEAN */#else /* !VMS */#ifdef COPYRIGHT_CLEAN static ZCONST char Far UnzipUsageLine1[] = "\UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\bug reports to the authors at Zip-Bugs@lists.wku.edu; see README for details.\\n\n";#else static ZCONST char Far UnzipUsageLine1[] = "\UnZip %d.%d%d%s of %s, by Info-ZIP. UnReduce (c) 1989 by S. H. Smith.\n\Send bug reports to authors at Zip-Bugs@lists.wku.edu; see README for details.\\n\n";#endif /* ?COPYRIGHT_CLEAN */#define UnzipUsageLine1v UnzipUsageLine1#endif /* ?VMS */static ZCONST char Far UnzipUsageLine2v[] = "\Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;\\nsee ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.\\n\n";#ifdef MACOSstatic ZCONST char Far UnzipUsageLine2[] = "\Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-d exdir]\n \ Default action is to extract files in list, to exdir;\n\ file[.zip] may be a wildcard. %s\n";#else /* !MACOS */#ifdef VM_CMSstatic ZCONST char Far UnzipUsageLine2[] = "\Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d fm]\n \ Default action is to extract files in list, except those in xlist, to disk fm;\\n file[.zip] may be a wildcard. %s\n";#else /* !VM_CMS */static ZCONST char Far UnzipUsageLine2[] = "\Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]\n \ Default action is to extract files in list, except those in xlist, to exdir;\n\ file[.zip] may be a wildcard. %s\n";#endif /* ?VM_CMS */#endif /* ?MACOS */#ifdef NO_ZIPINFO# define ZIPINFO_MODE_OPTION "" static ZCONST char Far ZipInfoMode[] = "(ZipInfo mode is disabled in this version.)";#else# define ZIPINFO_MODE_OPTION "[-Z] "# ifdef VMS static ZCONST char Far ZipInfoMode[] = "\"-Z\" => ZipInfo mode (`unzip \"-Z\"' for usage).";# else static ZCONST char Far ZipInfoMode[] = "-Z => ZipInfo mode (\"unzip -Z\" for usage).";# endif#endif /* ?NO_ZIPINFO */#ifdef VMS static ZCONST char Far VMSusageLine2b[] = "\=> define foreign command symbol in LOGIN.COM: $ unzip :== $dev:[dir]unzip.exe\\n";#endif#ifdef MACOSstatic ZCONST char Far UnzipUsageLine3[] = "\n\ -d extract files into exdir -l list files (short format)\n\ -f freshen existing files, create none -t test compressed archive data\n\ -u update files, create if necessary -z display archive comment\n\%s\n";#else /* !MACOS */#ifdef VM_CMSstatic ZCONST char Far UnzipUsageLine3[] = "\n\ -p extract files to pipe, no messages -l list files (short format)\n\ -f freshen existing files, create none -t test compressed archive data\n\ -u update files, create if necessary -z display archive comment\n\ -x exclude files that follow (in xlist) -d extract files onto disk fm\n\%s\n";#else /* !VM_CMS */static ZCONST char Far UnzipUsageLine3[] = "\n\ -p extract files to pipe, no messages -l list files (short format)\n\ -f freshen existing files, create none -t test compressed archive data\n\ -u update files, create if necessary -z display archive comment\n\ -x exclude files that follow (in xlist) -d extract files into exdir\n\%s\n";#endif /* ?VM_CMS */#endif /* ?MACOS */static ZCONST char Far UnzipUsageLine4[] = "\modifiers: -q quiet mode (-qq => quieter)\n\ -n never overwrite existing files -a auto-convert any text files\n\ -o overwrite files WITHOUT prompting -aa treat ALL files as text\n \ -j junk paths (do not make directories) -v be verbose/print version info\n\ %c-C%c match filenames case-insensitively %c-L%c make (some) names \lowercase\n %-42s %c-V%c retain VMS version numbers\n%s";static ZCONST char Far UnzipUsageLine5[] = "\Examples (see unzip.txt for more info):\n\ unzip data1 -x joe => extract all files except joe from zipfile data1.zip\n\%s\ unzip -fo foo %-6s => quietly replace existing %s if archive file newer\n";#endif /* ?SFX *//*****************************//* main() / UzpMain() stub *//*****************************/int MAIN(argc, argv) /* return PK-type error code (except under VMS) */ int argc; char *argv[];{ int r; CONSTRUCTGLOBALS(); r = unzip(__G__ argc, argv); DESTROYGLOBALS(); RETURN(r);}/*******************************//* Primary UnZip entry point *//*******************************/int unzip(__G__ argc, argv) __GDEF int argc; char *argv[];{#ifndef NO_ZIPINFO char *p;#endif#ifdef DOS_FLX_H68_NLM_OS2_W32 int i;#endif int retcode, error=FALSE;#ifdef REENTRANT savsigs_info *oldsighandlers = NULL;# define SET_SIGHANDLER(sigtype, newsighandler) \ if ((retcode = setsignalhandler(__G__ &oldsighandlers, (sigtype), \ (newsighandler))) > PK_WARN) \ goto cleanup_and_exit#else# define SET_SIGHANDLER(sigtype, newsighandler) \ signal((sigtype), (newsighandler))#endif SETLOCALE(LC_CTYPE,"");#if (defined(__IBMC__) && defined(__DEBUG_ALLOC__)) extern void DebugMalloc(void); atexit(DebugMalloc);#endif#ifdef MALLOC_WORK /* The following (rather complex) expression determines the allocation size of the decompression work area. It simulates what the combined "union" and "struct" declaration of the "static" work area reservation achieves automatically at compile time. Any decent compiler should evaluate this expression completely at compile time and provide constants to the zcalloc() call. (For better readability, some subexpressions are encapsulated in temporarly defined macros.) */# define UZ_SLIDE_CHUNK (sizeof(shrint)+sizeof(uch)+sizeof(uch))# define UZ_NUMOF_CHUNKS \ (unsigned)(((WSIZE+UZ_SLIDE_CHUNK-1)/UZ_SLIDE_CHUNK > HSIZE) ? \ (WSIZE+UZ_SLIDE_CHUNK-1)/UZ_SLIDE_CHUNK : HSIZE) G.area.Slide = (uch *)zcalloc(UZ_NUMOF_CHUNKS, UZ_SLIDE_CHUNK);# undef UZ_SLIDE_CHUNK# undef UZ_NUMOF_CHUNKS G.area.shrink.Parent = (shrint *)G.area.Slide; G.area.shrink.value = G.area.Slide + (sizeof(shrint)*(HSIZE)); G.area.shrink.Stack = G.area.Slide + (sizeof(shrint) + sizeof(uch))*(HSIZE);#endif/*--------------------------------------------------------------------------- Set signal handler for restoring echo, warn of zipfile corruption, etc. ---------------------------------------------------------------------------*/#ifdef SIGINT SET_SIGHANDLER(SIGINT, handler);#endif#ifdef SIGTERM /* some systems really have no SIGTERM */ SET_SIGHANDLER(SIGTERM, handler);#endif#ifdef SIGBUS SET_SIGHANDLER(SIGBUS, handler);#endif#ifdef SIGSEGV SET_SIGHANDLER(SIGSEGV, handler);#endif#if (defined(WIN32) && defined(__RSXNT__)) for (i = 0 ; i < argc; i++) { _ISO_INTERN(argv[i]); }#endif/*--------------------------------------------------------------------------- Macintosh initialization code. ---------------------------------------------------------------------------*/#ifdef MACOS { int a; for (a = 0; a < 4; ++a) G.rghCursor[a] = GetCursor(a+128); G.giCursor = 0; }#endif/*--------------------------------------------------------------------------- NetWare initialization code. ---------------------------------------------------------------------------*/#ifdef NLM InitUnZipConsole();#endif/*--------------------------------------------------------------------------- Acorn RISC OS initialization code. ---------------------------------------------------------------------------*/#ifdef RISCOS set_prefix();#endif/*--------------------------------------------------------------------------- Theos initialization code. ---------------------------------------------------------------------------*/#ifdef THEOS /* The easiest way found to force creation of libraries when selected * members are to be unzipped. Explicitely add libraries names to the * arguments list before the first member of the library. */ if (! _setargv(&argc, &argv)) { Info(slide, 0x401, ((char *)slide, "cannot process argv\n")); retcode = PK_MEM; goto cleanup_and_exit; }#endif/*--------------------------------------------------------------------------- First figure out if we're running in UnZip mode or ZipInfo mode, and put the appropriate environment-variable options into the queue. Then rip through any command-line options lurking about... ---------------------------------------------------------------------------*/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -