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

📄 unix.c

📁 压缩解压,是unzip540的升级,这个外国网站摘来的源码,是evb编写.
💻 C
📖 第 1 页 / 共 4 页
字号:
    return (utime(fname, &tp));} /* end function stamp_file() */#endif /* TIMESTAMP */#ifndef SFX/************************//*  Function version()  *//************************/void version(__G)    __GDEF{#if (defined(__GNUC__) && defined(NX_CURRENT_COMPILER_RELEASE))    char cc_namebuf[40];    char cc_versbuf[40];#else#if (defined(CRAY) && defined(_RELEASE))    char cc_versbuf[40];#endif#endif#if ((defined(CRAY) || defined(cray)) && defined(_UNICOS))    char os_namebuf[40];#else#if defined(__NetBSD__)    char os_namebuf[40];#endif#endif    /* Pyramid, NeXT have problems with huge macro expansion, too:  no Info() */    sprintf((char *)slide, LoadFarString(CompiledWith),#ifdef __GNUC__#  ifdef NX_CURRENT_COMPILER_RELEASE      (sprintf(cc_namebuf, "NeXT DevKit %d.%02d ",        NX_CURRENT_COMPILER_RELEASE/100, NX_CURRENT_COMPILER_RELEASE%100),       cc_namebuf),      (strlen(__VERSION__) > 8)? "(gcc)" :        (sprintf(cc_versbuf, "(gcc %s)", __VERSION__), cc_versbuf),#  else      "gcc ", __VERSION__,#  endif#else#  if defined(CRAY) && defined(_RELEASE)      "cc ", (sprintf(cc_versbuf, "version %d", _RELEASE), cc_versbuf),#  else#  ifdef __VERSION__#   ifndef IZ_CC_NAME#    define IZ_CC_NAME "cc "#   endif      IZ_CC_NAME, __VERSION__#  else#   ifndef IZ_CC_NAME#    define IZ_CC_NAME "cc"#   endif      IZ_CC_NAME, "",#  endif#  endif#endif /* ?__GNUC__ */#ifndef IZ_OS_NAME#  define IZ_OS_NAME "Unix"#endif      IZ_OS_NAME,#if defined(sgi) || defined(__sgi)      " (Silicon Graphics IRIX)",#else#ifdef sun#  ifdef sparc#    ifdef __SVR4      " (Sun SPARC/Solaris)",#    else /* may or may not be SunOS */      " (Sun SPARC)",#    endif#  else#  if defined(sun386) || defined(i386)      " (Sun 386i)",#  else#  if defined(mc68020) || defined(__mc68020__)      " (Sun 3)",#  else /* mc68010 or mc68000:  Sun 2 or earlier */      " (Sun 2)",#  endif#  endif#  endif#else#ifdef __hpux      " (HP/UX)",#else#ifdef __osf__      " (DEC OSF/1)",#else#ifdef _AIX      " (IBM AIX)",#else#ifdef aiws      " (IBM RT/AIX)",#else#if defined(CRAY) || defined(cray)#  ifdef _UNICOS      (sprintf(os_namebuf, " (Cray UNICOS release %d)", _UNICOS), os_namebuf),#  else      " (Cray UNICOS)",#  endif#else#if defined(uts) || defined(UTS)      " (Amdahl UTS)",#else#ifdef NeXT#  ifdef mc68000      " (NeXTStep/black)",#  else      " (NeXTStep for Intel)",#  endif#else              /* the next dozen or so are somewhat order-dependent */#ifdef LINUX#  ifdef __ELF__      " (Linux ELF)",#  else      " (Linux a.out)",#  endif#else#ifdef MINIX      " (Minix)",#else#ifdef M_UNIX      " (SCO Unix)",#else#ifdef M_XENIX      " (SCO Xenix)",#else#ifdef __NetBSD__#  ifdef NetBSD0_8      (sprintf(os_namebuf, " (NetBSD 0.8%c)", (char)(NetBSD0_8 - 1 + 'A')),       os_namebuf),#  else#  ifdef NetBSD0_9      (sprintf(os_namebuf, " (NetBSD 0.9%c)", (char)(NetBSD0_9 - 1 + 'A')),       os_namebuf),#  else#  ifdef NetBSD1_0      (sprintf(os_namebuf, " (NetBSD 1.0%c)", (char)(NetBSD1_0 - 1 + 'A')),       os_namebuf),#  else      (BSD4_4 == 0.5)? " (NetBSD before 0.9)" : " (NetBSD 1.1 or later)",#  endif#  endif#  endif#else#ifdef __FreeBSD__      (BSD4_4 == 0.5)? " (FreeBSD 1.x)" : " (FreeBSD 2.0 or later)",#else#ifdef __bsdi__      (BSD4_4 == 0.5)? " (BSD/386 1.0)" : " (BSD/386 1.1 or later)",#else#ifdef __386BSD__      (BSD4_4 == 1)? " (386BSD, post-4.4 release)" : " (386BSD)",#else#ifdef __CYGWIN__      " (Cygwin)",#else#if defined(i686) || defined(__i686) || defined(__i686__)      " (Intel 686)",#else#if defined(i586) || defined(__i586) || defined(__i586__)      " (Intel 586)",#else#if defined(i486) || defined(__i486) || defined(__i486__)      " (Intel 486)",#else#if defined(i386) || defined(__i386) || defined(__i386__)      " (Intel 386)",#else#ifdef pyr      " (Pyramid)",#else#ifdef ultrix#  ifdef mips      " (DEC/MIPS)",#  else#  ifdef vax      " (DEC/VAX)",#  else /* __alpha? */      " (DEC/Alpha)",#  endif#  endif#else#ifdef gould      " (Gould)",#else#ifdef MTS      " (MTS)",#else#ifdef __convexc__      " (Convex)",#else#ifdef __QNX__      " (QNX 4)",#else#ifdef __QNXNTO__      " (QNX Neutrino)",#else#ifdef Lynx      " (LynxOS)",#else      "",#endif /* Lynx */#endif /* QNX Neutrino */#endif /* QNX 4 */#endif /* Convex */#endif /* MTS */#endif /* Gould */#endif /* DEC */#endif /* Pyramid */#endif /* 386 */#endif /* 486 */#endif /* 586 */#endif /* 686 */#endif /* Cygwin */#endif /* 386BSD */#endif /* BSDI BSD/386 */#endif /* NetBSD */#endif /* FreeBSD */#endif /* SCO Xenix */#endif /* SCO Unix */#endif /* Minix */#endif /* Linux */#endif /* NeXT */#endif /* Amdahl */#endif /* Cray */#endif /* RT/AIX */#endif /* AIX */#endif /* OSF/1 */#endif /* HP/UX */#endif /* Sun */#endif /* SGI */#ifdef __DATE__      " on ", __DATE__#else      "", ""#endif    );    (*G.message)((zvoid *)&G, slide, (ulg)strlen((char *)slide), 0);} /* end function version() */#endif /* !SFX */#ifdef QLZIPstruct qdirect  {    long            d_length __attribute__ ((packed));  /* file length */    unsigned char   d_access __attribute__ ((packed));  /* file access type */    unsigned char   d_type __attribute__ ((packed));    /* file type */    long            d_datalen __attribute__ ((packed)); /* data length */    long            d_reserved __attribute__ ((packed));/* Unused */    short           d_szname __attribute__ ((packed));  /* size of name */    char            d_name[36] __attribute__ ((packed));/* name area */    long            d_update __attribute__ ((packed));  /* last update */    long            d_refdate __attribute__ ((packed));    long            d_backup __attribute__ ((packed));   /* EOD */};#define LONGID  "QDOS02"#define EXTRALEN (sizeof(struct qdirect) + 8)#define JBLONGID    "QZHD"#define JBEXTRALEN  (sizeof(jbextra)  - 4 * sizeof(char))typedef struct {    char        eb_header[4] __attribute__ ((packed));  /* place_holder */    char        longid[8] __attribute__ ((packed));    struct      qdirect     header __attribute__ ((packed));} qdosextra;typedef struct {    char        eb_header[4];                           /* place_holder */    char        longid[4];    struct      qdirect     header;} jbextra;/*  The following two functions SH() and LG() convert big-endian short *  and long numbers into native byte order.  They are some kind of *  counterpart to the generic UnZip's makeword() and makelong() functions. */static ush SH(ush val){    uch swapbuf[2];    swapbuf[1] = (uch)(val & 0xff);    swapbuf[0] = (uch)(val >> 8);    return (*(ush *)swapbuf);}static ulg LG(ulg val){    /*  convert the big-endian unsigned long number `val' to the machine     *  dependant representation     */    ush swapbuf[2];    swapbuf[1] = SH((ush)(val & 0xffff));    swapbuf[0] = SH((ush)(val >> 16));    return (*(ulg *)swapbuf);}static void qlfix(__G__ ef_ptr, ef_len)    __GDEF    uch *ef_ptr;    unsigned ef_len;{    while (ef_len >= EB_HEADSIZE)    {        unsigned    eb_id  = makeword(EB_ID + ef_ptr);        unsigned    eb_len = makeword(EB_LEN + ef_ptr);        if (eb_len > (ef_len - EB_HEADSIZE)) {            /* discovered some extra field inconsistency! */            Trace((stderr,              "qlfix: block length %u > rest ef_size %u\n", eb_len,              ef_len - EB_HEADSIZE));            break;        }        switch (eb_id) {          case EF_QDOS:          {            struct _ntc_            {                long id;                long dlen;            } ntc;            long dlen = 0;            qdosextra   *extra = (qdosextra *)ef_ptr;            jbextra     *jbp   = (jbextra   *)ef_ptr;            if (!strncmp(extra->longid, LONGID, strlen(LONGID)))            {                if (eb_len != EXTRALEN)                    if (uO.qflag)                        Info(slide, 0x201, ((char *)slide,                          "warning:  invalid length in Qdos field for %s\n",                          FnFilter1(G.filename)));                    else                        Info(slide, 0x201, ((char *)slide,                          "warning:  invalid length in Qdos field"));                if (extra->header.d_type)                {                    dlen = extra->header.d_datalen;                }            }            if (!strncmp(jbp->longid, JBLONGID, strlen(JBLONGID)))            {                if (eb_len != JBEXTRALEN)                    if (uO.qflag)                        Info(slide, 0x201, ((char *)slide,                          "warning:  invalid length in QZ field for %s\n",                          FnFilter1(G.filename)));                    else                        Info(slide, 0x201, ((char *)slide,                          "warning:  invalid length in QZ field"));                if(jbp->header.d_type)                {                    dlen = jbp->header.d_datalen;                }            }            if ((long)LG(dlen) > 0)            {                G.outfile = fopen(G.filename,"r+");                fseek(G.outfile, -8, SEEK_END);                fread(&ntc, 8, 1, G.outfile);                if(ntc.id != *(long *)"XTcc")                {                    ntc.id = *(long *)"XTcc";                    ntc.dlen = dlen;                    fwrite (&ntc, 8, 1, G.outfile);                }                Info(slide, 0x201, ((char *)slide, "QData = %d", LG(dlen)));                fclose(G.outfile);            }            return;     /* finished, cancel further extra field scanning */          }          default:            Trace((stderr,"qlfix: unknown extra field block, ID=%d\n",               eb_id));        }        /* Skip this extra field block */        ef_ptr += (eb_len + EB_HEADSIZE);        ef_len -= (eb_len + EB_HEADSIZE);    }}#endif /* QLZIP */

⌨️ 快捷键说明

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