?? zipinfo.c
字號:
/* Copyright (c) 1990-2001 Info-ZIP. All rights reserved. See the accompanying file LICENSE, version 2000-Apr-09 or later (the contents of which are also included in unzip.h) for terms of use. If, for some reason, all these files are missing, the Info-ZIP license also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html*//*--------------------------------------------------------------------------- zipinfo.c Greg Roelofs et al. This file contains all of the ZipInfo-specific listing routines for UnZip. Contains: zi_opts() zi_end_central() zipinfo() zi_long() zi_short() zi_time() ---------------------------------------------------------------------------*/#define UNZIP_INTERNAL#include "unzip.h"#ifndef NO_ZIPINFO /* strings use up too much space in small-memory systems *//* Define OS-specific attributes for use on ALL platforms--the S_xxxx * versions of these are defined differently (or not defined) by different * compilers and operating systems. */#define UNX_IFMT 0170000 /* Unix file type mask */#define UNX_IFREG 0100000 /* Unix regular file */#define UNX_IFSOCK 0140000 /* Unix socket (BSD, not SysV or Amiga) */#define UNX_IFLNK 0120000 /* Unix symbolic link (not SysV, Amiga) */#define UNX_IFBLK 0060000 /* Unix block special (not Amiga) */#define UNX_IFDIR 0040000 /* Unix directory */#define UNX_IFCHR 0020000 /* Unix character special (not Amiga) */#define UNX_IFIFO 0010000 /* Unix fifo (BCC, not MSC or Amiga) */#define UNX_ISUID 04000 /* Unix set user id on execution */#define UNX_ISGID 02000 /* Unix set group id on execution */#define UNX_ISVTX 01000 /* Unix directory permissions control */#define UNX_ENFMT UNX_ISGID /* Unix record locking enforcement flag */#define UNX_IRWXU 00700 /* Unix read, write, execute: owner */#define UNX_IRUSR 00400 /* Unix read permission: owner */#define UNX_IWUSR 00200 /* Unix write permission: owner */#define UNX_IXUSR 00100 /* Unix execute permission: owner */#define UNX_IRWXG 00070 /* Unix read, write, execute: group */#define UNX_IRGRP 00040 /* Unix read permission: group */#define UNX_IWGRP 00020 /* Unix write permission: group */#define UNX_IXGRP 00010 /* Unix execute permission: group */#define UNX_IRWXO 00007 /* Unix read, write, execute: other */#define UNX_IROTH 00004 /* Unix read permission: other */#define UNX_IWOTH 00002 /* Unix write permission: other */#define UNX_IXOTH 00001 /* Unix execute permission: other */#define VMS_IRUSR UNX_IRUSR /* VMS read/owner */#define VMS_IWUSR UNX_IWUSR /* VMS write/owner */#define VMS_IXUSR UNX_IXUSR /* VMS execute/owner */#define VMS_IRGRP UNX_IRGRP /* VMS read/group */#define VMS_IWGRP UNX_IWGRP /* VMS write/group */#define VMS_IXGRP UNX_IXGRP /* VMS execute/group */#define VMS_IROTH UNX_IROTH /* VMS read/other */#define VMS_IWOTH UNX_IWOTH /* VMS write/other */#define VMS_IXOTH UNX_IXOTH /* VMS execute/other */#define AMI_IFMT 06000 /* Amiga file type mask */#define AMI_IFDIR 04000 /* Amiga directory */#define AMI_IFREG 02000 /* Amiga regular file */#define AMI_IHIDDEN 00200 /* to be supported in AmigaDOS 3.x */#define AMI_ISCRIPT 00100 /* executable script (text command file) */#define AMI_IPURE 00040 /* allow loading into resident memory */#define AMI_IARCHIVE 00020 /* not modified since bit was last set */#define AMI_IREAD 00010 /* can be opened for reading */#define AMI_IWRITE 00004 /* can be opened for writing */#define AMI_IEXECUTE 00002 /* executable image, a loadable runfile */#define AMI_IDELETE 00001 /* can be deleted */#define THS_IFMT 0xF000 /* Theos file type mask */#define THS_IFIFO 0x1000 /* pipe */#define THS_IFCHR 0x2000 /* char device */#define THS_IFSOCK 0x3000 /* socket */#define THS_IFDIR 0x4000 /* directory */#define THS_IFLIB 0x5000 /* library */#define THS_IFBLK 0x6000 /* block device */#define THS_IFREG 0x8000 /* regular file */#define THS_IFREL 0x9000 /* relative (direct) */#define THS_IFKEY 0xA000 /* keyed */#define THS_IFIND 0xB000 /* indexed */#define THS_IFRND 0xC000 /* ???? */#define THS_IFR16 0xD000 /* 16 bit real mode program */#define THS_IFP16 0xE000 /* 16 bit protected mode prog */#define THS_IFP32 0xF000 /* 32 bit protected mode prog */#define THS_IMODF 0x0800 /* modified */#define THS_INHID 0x0400 /* not hidden */#define THS_IEUSR 0x0200 /* erase permission: owner */#define THS_IRUSR 0x0100 /* read permission: owner */#define THS_IWUSR 0x0080 /* write permission: owner */#define THS_IXUSR 0x0040 /* execute permission: owner */#define THS_IROTH 0x0004 /* read permission: other */#define THS_IWOTH 0x0002 /* write permission: other */#define THS_IXOTH 0x0001 /* execute permission: other */#ifdef OLD_THEOS_EXTRA# include "theos/oldstat.h"#endif#ifndef NSK_UNSTRUCTURED# define NSK_UNSTRUCTURED 0#endif#ifndef NSK_OBJECTFILECODE# define NSK_OBJECTFILECODE 100#endif#ifndef NSK_EDITFILECODE# define NSK_EDITFILECODE 101#endif#define LFLAG 3 /* short "ls -l" type listing */static int zi_long OF((__GPRO__ ulg *pEndprev));static int zi_short OF((__GPRO));static void zi_showMacTypeCreator OF((__GPRO__ uch *ebfield));static char *zi_time OF((__GPRO__ ZCONST ulg *datetimez, ZCONST time_t *modtimez, char *d_t_str));/**********************************************//* Strings used in zipinfo.c (ZipInfo half) *//**********************************************/static ZCONST char nullStr[] = "";static ZCONST char PlurSufx[] = "s";static ZCONST char Far LongHeader[] = "Archive: %s %ld bytes %u file%s\n";static ZCONST char Far ShortHeader[] = "Archive: %s %ld %u\n";static ZCONST char Far EndCentDirRec[] = "\nEnd-of-central-directory record:\n";static ZCONST char Far LineSeparators[] = "-------------------------------\n\n";static ZCONST char Far ActOffsetCentDir[] = "\ Actual offset of end-of-central-dir record: %9ld (%.8lXh)\n\ Expected offset of end-of-central-dir record: %9ld (%.8lXh)\n\ (based on the length of the central directory and its expected offset)\n\n";static ZCONST char Far SinglePartArchive1[] = "\ This zipfile constitutes the sole disk of a single-part archive; its\n\ central directory contains %u %s. The central directory is %lu\n\ (%.8lXh) bytes long, and its (expected) offset in bytes from the\n";static ZCONST char Far SinglePartArchive2[] = "\ beginning of the zipfile is %lu (%.8lXh).\n\n";static ZCONST char Far MultiPartArchive1[] = "\ This zipfile constitutes disk %u of a multi-part archive. The central\n\ directory starts on disk %u; %u of its entries %s contained within\n";static ZCONST char Far MultiPartArchive2[] = "\ this zipfile, out of a total of %u %s. The entire central\n\ directory is %lu (%.8lXh) bytes long, and its offset in bytes from\n";static ZCONST char Far MultiPartArchive3[] = "\ the beginning of the zipfile in which it begins is %lu (%.8lXh).\n\n";static ZCONST char Far NoZipfileComment[] = " There is no zipfile comment.\n";static ZCONST char Far ZipfileCommentDesc[] = " The zipfile comment is %u bytes long and contains the following text:\n\n";static ZCONST char Far ZipfileCommBegin[] = "======================== zipfile comment begins ==========================\n";static ZCONST char Far ZipfileCommEnd[] = "========================= zipfile comment ends ===========================\n";static ZCONST char Far ZipfileCommTrunc2[] = "\n The zipfile comment is truncated.\n";static ZCONST char Far ZipfileCommTruncMsg[] = "\ncaution: zipfile comment truncated\n";static ZCONST char Far CentralDirEntry[] = "\nCentral directory entry #%lu:\n---------------------------\n\n";static ZCONST char Far ZipfileStats[] = "%lu file%s, %lu bytes uncompressed, %lu bytes compressed: %s%d.%d%%\n";/* zi_long() strings */static ZCONST char Far OS_FAT[] = "MS-DOS, OS/2 or NT FAT";static ZCONST char Far OS_Amiga[] = "Amiga";static ZCONST char Far OS_VMS[] = "VMS";static ZCONST char Far OS_Unix[] = "Unix";static ZCONST char Far OS_VMCMS[] = "VM/CMS";static ZCONST char Far OS_AtariST[] = "Atari ST";static ZCONST char Far OS_HPFS[] = "OS/2 or NT HPFS";static ZCONST char Far OS_Macintosh[] = "Macintosh HFS";static ZCONST char Far OS_ZSystem[] = "Z-System";static ZCONST char Far OS_CPM[] = "CP/M";static ZCONST char Far OS_TOPS20[] = "TOPS-20";static ZCONST char Far OS_NTFS[] = "NTFS";static ZCONST char Far OS_QDOS[] = "SMS/QDOS";static ZCONST char Far OS_Acorn[] = "Acorn RISC OS";static ZCONST char Far OS_MVS[] = "MVS";static ZCONST char Far OS_VFAT[] = "Win32 VFAT";static ZCONST char Far OS_BeOS[] = "BeOS";static ZCONST char Far OS_Tandem[] = "Tandem NSK";static ZCONST char Far OS_Theos[] = "Theos";#ifdef OLD_THEOS_EXTRA static ZCONST char Far OS_TheosOld[] = "Theos (Old)";#endif /* OLD_THEOS_EXTRA */static ZCONST char Far MthdNone[] = "none (stored)";static ZCONST char Far MthdShrunk[] = "shrunk";static ZCONST char Far MthdRedF1[] = "reduced (factor 1)";static ZCONST char Far MthdRedF2[] = "reduced (factor 2)";static ZCONST char Far MthdRedF3[] = "reduced (factor 3)";static ZCONST char Far MthdRedF4[] = "reduced (factor 4)";static ZCONST char Far MthdImplode[] = "imploded";static ZCONST char Far MthdToken[] = "tokenized";static ZCONST char Far MthdDeflate[] = "deflated";static ZCONST char Far MthdDeflat64[] = "deflated (enhanced-64k)";static ZCONST char Far MthdDCLImplode[] = "imploded (PK DCL)";static ZCONST char Far DeflNorm[] = "normal";static ZCONST char Far DeflMax[] = "maximum";static ZCONST char Far DeflFast[] = "fast";static ZCONST char Far DeflSFast[] = "superfast";static ZCONST char Far ExtraBytesPreceding[] = " There are an extra %ld bytes preceding this file.\n\n";static ZCONST char Far UnknownNo[] = "unknown (%d)";static ZCONST char Far LocalHeaderOffset[] = "\n offset of local header from start of archive: %lu (%.8lXh) bytes\n";static ZCONST char Far HostOS[] = " file system or operating system of origin: %s\n";static ZCONST char Far EncodeSWVer[] = " version of encoding software: %u.%u\n";static ZCONST char Far MinOSCompReq[] = " minimum file system compatibility required: %s\n";static ZCONST char Far MinSWVerReq[] = " minimum software version required to extract: %u.%u\n";static ZCONST char Far CompressMethod[] = " compression method: %s\n";static ZCONST char Far SlideWindowSizeImplode[] = " size of sliding dictionary (implosion): %cK\n";static ZCONST char Far ShannonFanoTrees[] = " number of Shannon-Fano trees (implosion): %c\n";static ZCONST char Far CompressSubtype[] = " compression sub-type (deflation): %s\n";static ZCONST char Far FileSecurity[] = " file security status: %sencrypted\n";static ZCONST char Far ExtendedLocalHdr[] = " extended local header: %s\n";static ZCONST char Far FileModDate[] = " file last modified on (DOS date/time): %s\n";#ifdef USE_EF_UT_TIME static ZCONST char Far UT_FileModDate[] = " file last modified on (UT extra field modtime): %s %s\n"; static ZCONST char Far LocalTime[] = "local";#ifndef NO_GMTIME static ZCONST char Far GMTime[] = "UTC";#endif#endif /* USE_EF_UT_TIME */static ZCONST char Far CRC32Value[] = " 32-bit CRC value (hex): %.8lx\n";static ZCONST char Far CompressedFileSize[] = " compressed size: %lu bytes\n";static ZCONST char Far UncompressedFileSize[] = " uncompressed size: %lu bytes\n";static ZCONST char Far FilenameLength[] = " length of filename: %u characters\n";static ZCONST char Far ExtraFieldLength[] = " length of extra field: %u bytes\n";static ZCONST char Far FileCommentLength[] = " length of file comment: %u characters\n";static ZCONST char Far FileDiskNum[] = " disk number on which file begins: disk %u\n";static ZCONST char Far ApparentFileType[] = " apparent file type: %s\n";static ZCONST char Far VMSFileAttributes[] = " VMS file attributes (%06o octal): %s\n";static ZCONST char Far AmigaFileAttributes[] = " Amiga file attributes (%06o octal): %s\n";static ZCONST char Far UnixFileAttributes[] = " Unix file attributes (%06o octal): %s\n";static ZCONST char Far NonMSDOSFileAttributes[] = " non-MSDOS external file attributes: %06lX hex\n";static ZCONST char Far MSDOSFileAttributes[] = " MS-DOS file attributes (%02X hex): none\n";static ZCONST char Far MSDOSFileAttributesRO[] = " MS-DOS file attributes (%02X hex): read-only\n";static ZCONST char Far MSDOSFileAttributesAlpha[] = " MS-DOS file attributes (%02X hex): %s%s%s%s%s%s%s%s\n";static ZCONST char Far TheosFileAttributes[] = " Theos file attributes (%04X hex): %s\n";static ZCONST char Far TheosFTypLib[] = "Library ";static ZCONST char Far TheosFTypDir[] = "Directory ";static ZCONST char Far TheosFTypReg[] = "Sequential ";static ZCONST char Far TheosFTypRel[] = "Direct ";static ZCONST char Far TheosFTypKey[] = "Keyed ";static ZCONST char Far TheosFTypInd[] = "Indexed ";static ZCONST char Far TheosFTypR16[] = " 86 program ";static ZCONST char Far TheosFTypP16[] = "286 program ";static ZCONST char Far TheosFTypP32[] = "386 program ";static ZCONST char Far TheosFTypUkn[] = "??? ";static ZCONST char Far ExtraFieldTrunc[] = "\n\ error: EF data block (type 0x%04x) size %u exceeds remaining extra field\n\ space %u; block length has been truncated.\n";static ZCONST char Far ExtraFields[] = "\n\ The central-directory extra field contains:";static ZCONST char Far ExtraFieldType[] = "\n\ - A subfield with ID 0x%04x (%s) and %u data bytes";static ZCONST char Far efPKSZ64[] = "PKWARE 64-bit sizes";static ZCONST char Far efAV[] = "PKWARE AV";static ZCONST char Far efOS2[] = "OS/2";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -