⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zipinfo.c

📁 压缩解压,是unzip540的升级,这个外国网站摘来的源码,是evb编写.
💻 C
📖 第 1 页 / 共 5 页
字号:
    Double check that we're back at the end-of-central-directory record.  ---------------------------------------------------------------------------*/    if (strncmp(G.sig, end_central_sig, 4)) {   /* just to make sure again */        Info(slide, 0x401, ((char *)slide, LoadFarString(EndSigMsg)));        error_in_archive = PK_WARN;   /* didn't find sig */    }    if (members == 0 && error_in_archive <= PK_WARN)        error_in_archive = PK_FIND;    if (uO.lflag >= 10)        (*G.message)((zvoid *)&G, (uch *)"\n", 1L, 0);    return error_in_archive;} /* end function zipinfo() *//************************//*  Function zi_long()  *//************************/static int zi_long(__G__ pEndprev)   /* return PK-type error code */    __GDEF    ulg *pEndprev;                   /* for zi_long() check of extra bytes */{#ifdef USE_EF_UT_TIME    iztimes z_utime;#endif    int  error, error_in_archive=PK_COOL;    unsigned  hostnum, hostver, extnum, extver, methnum, xattr;    char workspace[12], attribs[22];    ZCONST char *varmsg_str;    char unkn[16];    static ZCONST char Far *os[NUM_HOSTS] = {        OS_FAT, OS_Amiga, OS_VMS, OS_Unix, OS_VMCMS, OS_AtariST, OS_HPFS,        OS_Macintosh, OS_ZSystem, OS_CPM, OS_TOPS20, OS_NTFS, OS_QDOS,        OS_Acorn, OS_VFAT, OS_MVS, OS_BeOS, OS_Tandem, OS_Theos, OS_MacDarwin,        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,        OS_AtheOS    };    static ZCONST char Far *method[NUM_METHODS] = {        MthdNone, MthdShrunk, MthdRedF1, MthdRedF2, MthdRedF3, MthdRedF4,        MthdImplode, MthdToken, MthdDeflate, MthdDeflat64, MthdDCLImplode,        MthdPKRes11, MthdBZip2    };    static ZCONST char Far *dtypelng[4] = {        DeflNorm, DeflMax, DeflFast, DeflSFast    };/*---------------------------------------------------------------------------    Check whether there's any extra space inside the zipfile.  If *pEndprev is    zero, it's probably a signal that OS/2 extra fields are involved (with    unknown compressed size).  We won't worry about prepended junk here...  ---------------------------------------------------------------------------*/    if (G.crec.relative_offset_local_header != *pEndprev && *pEndprev > 0L) {        /*  GRR DEBUG        Info(slide, 0, ((char *)slide,          "  [crec.relative_offset_local_header = %lu, endprev = %lu]\n",          G.crec.relative_offset_local_header, *pEndprev));         */        Info(slide, 0, ((char *)slide, LoadFarString(ExtraBytesPreceding),          (long)G.crec.relative_offset_local_header - (long)(*pEndprev)));    }    /* calculate endprev for next time around (problem:  extra fields may     * differ in length between local and central-directory records) */    *pEndprev = G.crec.relative_offset_local_header + (4L + LREC_SIZE) +      G.crec.filename_length + G.crec.extra_field_length + G.crec.csize;/*---------------------------------------------------------------------------    Read the extra field, if any. It may be used to get UNIX style modtime.  ---------------------------------------------------------------------------*/    if ((error = do_string(__G__ G.crec.extra_field_length, EXTRA_FIELD)) != 0)    {        if (G.extra_field != NULL) {            free(G.extra_field);            G.extra_field = NULL;        }        error_in_archive = error;        /* The premature return in case of a "fatal" error (PK_EOF) is         * delayed until we analyze the extra field contents.         * This allows us to display all the other info that has been         * successfully read in.         */    }/*---------------------------------------------------------------------------    Print out various interesting things about the compressed file.  ---------------------------------------------------------------------------*/    hostnum = (unsigned)(G.pInfo->hostnum);    hostver = (unsigned)(G.pInfo->hostver);    extnum = (unsigned)MIN(G.crec.version_needed_to_extract[1], NUM_HOSTS);    extver = (unsigned)G.crec.version_needed_to_extract[0];    methnum = (unsigned)MIN(G.crec.compression_method, NUM_METHODS);    (*G.message)((zvoid *)&G, (uch *)"  ", 2L, 0);  fnprint(__G);    Info(slide, 0, ((char *)slide, LoadFarString(LocalHeaderOffset),      G.crec.relative_offset_local_header,      G.crec.relative_offset_local_header));    if (hostnum >= NUM_HOSTS) {        sprintf(unkn, LoadFarString(UnknownNo),                (int)G.crec.version_made_by[1]);        varmsg_str = unkn;    } else {        varmsg_str = LoadFarStringSmall(os[hostnum]);#ifdef OLD_THEOS_EXTRA        if (hostnum == FS_VFAT_ && hostver == 20) {            /* entry made by old non-official THEOS port zip archive */            varmsg_str = LoadFarStringSmall(OS_TheosOld);        }#endif /* OLD_THEOS_EXTRA */    }    Info(slide, 0, ((char *)slide, LoadFarString(HostOS), varmsg_str));    Info(slide, 0, ((char *)slide, LoadFarString(EncodeSWVer), hostver/10,      hostver%10));    if ((extnum >= NUM_HOSTS) || (os[extnum] == NULL)) {        sprintf(unkn, LoadFarString(UnknownNo),                (int)G.crec.version_needed_to_extract[1]);        varmsg_str = unkn;    } else {        varmsg_str = LoadFarStringSmall(os[extnum]);    }    Info(slide, 0, ((char *)slide, LoadFarString(MinOSCompReq), varmsg_str));    Info(slide, 0, ((char *)slide, LoadFarString(MinSWVerReq), extver/10,      extver%10));    if (methnum >= NUM_METHODS) {        sprintf(unkn, LoadFarString(UnknownNo), G.crec.compression_method);        varmsg_str = unkn;    } else {        varmsg_str = LoadFarStringSmall(method[methnum]);    }    Info(slide, 0, ((char *)slide, LoadFarString(CompressMethod), varmsg_str));    if (methnum == IMPLODED) {        Info(slide, 0, ((char *)slide, LoadFarString(SlideWindowSizeImplode),          (G.crec.general_purpose_bit_flag & 2)? '8' : '4'));        Info(slide, 0, ((char *)slide, LoadFarString(ShannonFanoTrees),          (G.crec.general_purpose_bit_flag & 4)? '3' : '2'));    } else if (methnum == DEFLATED || methnum == ENHDEFLATED) {        ush  dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3);        Info(slide, 0, ((char *)slide, LoadFarString(CompressSubtype),          LoadFarStringSmall(dtypelng[dnum])));    }    Info(slide, 0, ((char *)slide, LoadFarString(FileSecurity),      (G.crec.general_purpose_bit_flag & 1) ? nullStr : "not "));    Info(slide, 0, ((char *)slide, LoadFarString(ExtendedLocalHdr),      (G.crec.general_purpose_bit_flag & 8) ? "yes" : "no"));    /* print upper 3 bits for amusement? */    /* For printing of date & time, a "char d_t_buf[21]" is required.     * To save stack space, we reuse the "char attribs[22]" buffer which     * is not used yet.     */#   define d_t_buf attribs    zi_time(__G__ &G.crec.last_mod_dos_datetime, NULL, d_t_buf);    Info(slide, 0, ((char *)slide, LoadFarString(FileModDate), d_t_buf));#ifdef USE_EF_UT_TIME    if (G.extra_field &&#ifdef IZ_CHECK_TZ        G.tz_is_valid &&#endif        (ef_scan_for_izux(G.extra_field, G.crec.extra_field_length, 1,                          G.crec.last_mod_dos_datetime, &z_utime, NULL)         & EB_UT_FL_MTIME))    {        TIMET_TO_NATIVE(z_utime.mtime)   /* NOP unless MSC 7.0 or Macintosh */        d_t_buf[0] = (char)0;               /* signal "show local time" */        zi_time(__G__ &G.crec.last_mod_dos_datetime, &(z_utime.mtime), d_t_buf);        Info(slide, 0, ((char *)slide, LoadFarString(UT_FileModDate),          d_t_buf, LoadFarStringSmall(LocalTime)));#ifndef NO_GMTIME        d_t_buf[0] = (char)1;           /* signal "show UTC (GMT) time" */        zi_time(__G__ &G.crec.last_mod_dos_datetime, &(z_utime.mtime), d_t_buf);        Info(slide, 0, ((char *)slide, LoadFarString(UT_FileModDate),          d_t_buf, LoadFarStringSmall(GMTime)));#endif /* !NO_GMTIME */    }#endif /* USE_EF_UT_TIME */    Info(slide, 0, ((char *)slide, LoadFarString(CRC32Value), G.crec.crc32));    Info(slide, 0, ((char *)slide, LoadFarString(CompressedFileSize),      G.crec.csize));    Info(slide, 0, ((char *)slide, LoadFarString(UncompressedFileSize),      G.crec.ucsize));    Info(slide, 0, ((char *)slide, LoadFarString(FilenameLength),      G.crec.filename_length));    Info(slide, 0, ((char *)slide, LoadFarString(ExtraFieldLength),      G.crec.extra_field_length));    Info(slide, 0, ((char *)slide, LoadFarString(FileCommentLength),      G.crec.file_comment_length));    Info(slide, 0, ((char *)slide, LoadFarString(FileDiskNum),      G.crec.disk_number_start + 1));    Info(slide, 0, ((char *)slide, LoadFarString(ApparentFileType),      (G.crec.internal_file_attributes & 1)? "text"         : (G.crec.internal_file_attributes & 2)? "ebcdic"              : "binary"));             /* changed to accept EBCDIC */#ifdef ATARI    printf("  external file attributes (hex):                   %.8lx\n",      G.crec.external_file_attributes);#endif    xattr = (unsigned)((G.crec.external_file_attributes >> 16) & 0xFFFF);    if (hostnum == VMS_) {        char   *p=attribs, *q=attribs+1;        int    i, j, k;        for (k = 0;  k < 12;  ++k)            workspace[k] = 0;        if (xattr & VMS_IRUSR)            workspace[0] = 'R';        if (xattr & VMS_IWUSR) {            workspace[1] = 'W';            workspace[3] = 'D';        }        if (xattr & VMS_IXUSR)            workspace[2] = 'E';        if (xattr & VMS_IRGRP)            workspace[4] = 'R';        if (xattr & VMS_IWGRP) {            workspace[5] = 'W';            workspace[7] = 'D';        }        if (xattr & VMS_IXGRP)            workspace[6] = 'E';        if (xattr & VMS_IROTH)            workspace[8] = 'R';        if (xattr & VMS_IWOTH) {            workspace[9] = 'W';            workspace[11] = 'D';        }        if (xattr & VMS_IXOTH)            workspace[10] = 'E';        *p++ = '(';        for (k = j = 0;  j < 3;  ++j) {    /* loop over groups of permissions */            for (i = 0;  i < 4;  ++i, ++k)  /* loop over perms within a group */                if (workspace[k])                    *p++ = workspace[k];            *p++ = ',';                       /* group separator */            if (j == 0)                while ((*p++ = *q++) != ',')                    ;                         /* system, owner perms are same */        }        *p-- = '\0';        *p = ')';   /* overwrite last comma */        Info(slide, 0, ((char *)slide, LoadFarString(VMSFileAttributes), xattr,          attribs));    } else if (hostnum == AMIGA_) {        switch (xattr & AMI_IFMT) {            case AMI_IFDIR:  attribs[0] = 'd';  break;            case AMI_IFREG:  attribs[0] = '-';  break;            default:         attribs[0] = '?';  break;        }        attribs[1] = (xattr & AMI_IHIDDEN)?   'h' : '-';        attribs[2] = (xattr & AMI_ISCRIPT)?   's' : '-';        attribs[3] = (xattr & AMI_IPURE)?     'p' : '-';        attribs[4] = (xattr & AMI_IARCHIVE)?  'a' : '-';        attribs[5] = (xattr & AMI_IREAD)?     'r' : '-';        attribs[6] = (xattr & AMI_IWRITE)?    'w' : '-';        attribs[7] = (xattr & AMI_IEXECUTE)?  'e' : '-';        attribs[8] = (xattr & AMI_IDELETE)?   'd' : '-';        attribs[9] = 0;   /* better dlm the string */        Info(slide, 0, ((char *)slide, LoadFarString(AmigaFileAttributes),          xattr, attribs));    } else if (hostnum == THEOS_) {        ZCONST char Far *fpFtyp;        switch (xattr & THS_IFMT) {            case THS_IFLIB:  fpFtyp = TheosFTypLib;  break;            case THS_IFDIR:  fpFtyp = TheosFTypDir;  break;            case THS_IFREG:  fpFtyp = TheosFTypReg;  break;            case THS_IFREL:  fpFtyp = TheosFTypRel;  break;            case THS_IFKEY:  fpFtyp = TheosFTypKey;  break;            case THS_IFIND:  fpFtyp = TheosFTypInd;  break;            case THS_IFR16:  fpFtyp = TheosFTypR16;  break;            case THS_IFP16:  fpFtyp = TheosFTypP16;  break;            case THS_IFP32:  fpFtyp = TheosFTypP32;  break;            default:         fpFtyp = TheosFTypUkn;  break;        }        strcpy(attribs, LoadFarStringSmall(fpFtyp));        attribs[12] = (xattr & THS_INHID) ? '.' : 'H';        attribs[13] = (xattr & THS_IMODF) ? '.' : 'M';        attribs[14] = (xattr & THS_IWOTH) ? '.' : 'W';        attribs[15] = (xattr & THS_IROTH) ? '.' : 'R';        attribs[16] = (xattr & THS_IEUSR) ? '.' : 'E';        attribs[17] = (xattr & THS_IXUSR) ? '.' : 'X';        attribs[18] = (xattr & THS_IWUSR) ? '.' : 'W';        attribs[19] = (xattr & THS_IRUSR) ? '.' : 'R';        attribs[20] = 0;        Info(slide, 0, ((char *)slide, LoadFarString(TheosFileAttributes),          xattr, attribs));#ifdef OLD_THEOS_EXTRA

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -