📄 zipinfo.c
字号:
/*--------------------------------------------------------------------------- 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_IFDIR 0040000 /* Unix directory */#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_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 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 char nullStr[] = "";static ZCONST char Far LongHeader[] = "Archive: %s %ld bytes %d file%s\n";static ZCONST char Far ShortHeader[] = "Archive: %s %ld %d\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 #%d:\n---------------------------\n\n";static ZCONST char Far ZipfileStats[] = "%d 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 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 MthdEnDeflate[] = "deflated (enhanced)";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: %d.%d\n";static ZCONST char Far MinOSCompReq[] = " minimum file system compatibility required: %s\n";static ZCONST char Far MinSWVerReq[] = " minimum software version required to extract: %d.%d\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\n";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 efAV[] = "PKWARE AV";static ZCONST char Far efOS2[] = "OS/2";static ZCONST char Far efPKVMS[] = "PKWARE VMS";static ZCONST char Far efPKWin32[] = "PKWARE Win32";static ZCONST char Far efPKUnix[] = "PKWARE Unix";static ZCONST char Far efIZVMS[] = "Info-ZIP VMS";static ZCONST char Far efIZUnix[] = "old Info-ZIP Unix/OS2/NT";static ZCONST char Far efIZUnix2[] = "Unix UID/GID";static ZCONST char Far efTime[] = "universal time";static ZCONST char Far efJLMac[] = "old Info-ZIP Macintosh";static ZCONST char Far efMac3[] = "new Info-ZIP Macintosh";static ZCONST char Far efZipIt[] = "ZipIt Macintosh";static ZCONST char Far efZipIt2[] = "ZipIt Macintosh (short)";static ZCONST char Far efVMCMS[] = "VM/CMS";static ZCONST char Far efMVS[] = "MVS";static ZCONST char Far efACL[] = "OS/2 ACL";static ZCONST char Far efNTSD[] = "Security Descriptor";static ZCONST char Far efBeOS[] = "BeOS";static ZCONST char Far efQDOS[] = "SMS/QDOS";static ZCONST char Far efAOSVS[] = "AOS/VS";static ZCONST char Far efSpark[] = "Acorn SparkFS";static ZCONST char Far efMD5[] = "Fred Kantor MD5";static ZCONST char Far efASiUnix[] = "ASi Unix";static ZCONST char Far efUnknown[] = "unknown";static ZCONST char Far OS2EAs[] = ".\n\ The local extra field has %lu bytes of OS/2 extended attributes.\n\ (May not match OS/2 \"dir\" amount due to storage method)";static ZCONST char Far izVMSdata[] = ". The extra\n\ field is %s and has %lu bytes of VMS %s information%s";static ZCONST char Far izVMSstored[] = "stored";static ZCONST char Far izVMSrleenc[] = "run-length encoded";static ZCONST char Far izVMSdeflat[] = "deflated";static ZCONST char Far izVMScunknw[] = "compressed(?)";static ZCONST char Far *izVMScomp[4] = {izVMSstored, izVMSrleenc, izVMSdeflat, izVMScunknw};static ZCONST char Far ACLdata[] = ".\n\ The local extra field has %lu bytes of access control list information";static ZCONST char Far NTSDData[] = ".\n\ The local extra field has %lu bytes of NT security descriptor data";static ZCONST char Far UTdata[] = ".\n\ The local extra field has UTC/GMT %s time%s";static ZCONST char Far UTmodification[] = "modification";static ZCONST char Far UTaccess[] = "access";static ZCONST char Far UTcreation[] = "creation";static ZCONST char Far ZipItFname[] = ".\n\ The Mac long filename is %s.\n";static ZCONST char Far Mac3data[] = ".\n\ The local extra field has %lu bytes of %scompressed Macintosh\n\ finder attributes"; /* MacOSdata[] is used by EF_MAC3, EF_ZIPIT, EF_ZIPIT2 and EF_JLEE e. f. */static ZCONST char Far MacOSdata[] = ".\n\ The associated file has type code `%c%c%c%c' and creator code `%c%c%c%c'";static ZCONST char Far MacOSdata1[] = ".\n\ The associated file has type code `0x%lx' and creator code `0x%lx'";static ZCONST char Far MacOSJLEEflags[] = "\n File is marked as %s";static ZCONST char Far MacOS_RF[] = "Resource-fork";static ZCONST char Far MacOS_DF[] = "Data-fork";static ZCONST char Far MacOSMAC3flags[] = ".\n\ File is marked as %s, File Dates are in %d Bit";static ZCONST char Far BeOSdata[] = ".\n\ The local extra field has %lu bytes of %scompressed BeOS file attributes"; /* The associated file has type code `%c%c%c%c' and creator code `%c%c%c%c'" */static ZCONST char Far QDOSdata[] = ".\n\ The QDOS extra field subtype is `%c%c%c%c'";static ZCONST char Far AOSVSdata[] = ".\n\ The AOS/VS extra field revision is %d.%d";static ZCONST char Far MD5data[] = ".\n\ The 128-bit MD5 signature is %s";#ifdef CMS_MVS static ZCONST char Far VmMvsExtraField[] = ".\n\ The stored file open mode (FLDATA TYPE) is \"%s\""; static ZCONST char Far VmMvsInvalid[] = "[invalid]";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -