🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: vmsnet.sources
Article #84

Zip v1.9 & UnZip v5.0, part 13/22

#84
From: goathunter
Date: Tue, 01 Sep 1992 22:52
1422 lines
49648 bytes
Submitted-by: goathunter@wkuvx1.bitnet
Posting-number: Volume 3, Issue 135
Archive-name: zip_unzip/part13

-+-+-+-+-+-+-+-+ START OF PART 13 -+-+-+-+-+-+-+-+
X`09    nam.nam$b_rss = FILNAMSIZ - 1;
X
X`09    outfab->fab$l_fop `7C= FAB$M_MXV;
X`09    outfab->fab$l_nam = &nam;
X
X`09    ierr = sys$create(outfab);
X`09    if (!ERR(ierr))
X`09    `7B
X`09`09outfab->fab$l_nam = 0L;
X`09`09filename`5Boutfab->fab$b_fns = nam.nam$b_rsl`5D = 0;
X`09    `7D
X`09    break;
X`09case 'o':
X`09    outfab->fab$l_fop `7C= FAB$M_SUP;
X`09    ierr = sys$create(outfab);
X`09    break;
X    `7D
X    return ierr;
X`7D
X
X/*
X*   Extra record format
X*   ===================
X*   signature       (2 bytes)   = 'I','M'
X*   size            (2 bytes)
X*   block signature (4 bytes)
X*   flags           (2 bytes)
X*   uncomprssed size(2 bytes)
X*   reserved        (4 bytes)
X*   data            ((size-12) bytes)
X*   ....
X*/
X
X#define BC_MASK `0907`09/* 3 bits for compression type */
X#define BC_STORED`090`09/* Stored */
X#define BC_00`09`091`09/* 0byte -> 0bit compression */
X#define BC_DEFL`09`092`09/* Deflated */
X
Xstruct extra_block
X`7B
X    UWORD sig;`09`09`09/* Extra field block header structure */
X    UWORD size;
X    ULONG bid;
X    UWORD flags;
X    UWORD length;
X    ULONG reserved;
X    byte body`5B1`5D;
X`7D;
X
X/*
X *   Extra field signature and block signatures
X */
X
X#define SIGNATURE "IM"
X#define FABL    (cc$rms_fab.fab$b_bln)
X#define RABL    (cc$rms_rab.rab$b_bln)
X#define XALLL   (cc$rms_xaball.xab$b_bln)
X#define XDATL   (cc$rms_xabdat.xab$b_bln)
X#define XFHCL   (cc$rms_xabfhc.xab$b_bln)
X#define XKEYL   (cc$rms_xabkey.xab$b_bln)
X#define XPROL   (cc$rms_xabpro.xab$b_bln)
X#define XRDTL   (cc$rms_xabrdt.xab$b_bln)
X#define XSUML   (cc$rms_xabsum.xab$b_bln)
X#define EXTBSL  4`09`09/* Block signature length   */
X#define RESL    8`09`09/* Rserved 8 bytes  */
X#define EXTHL   (4+EXTBSL)
X#define FABSIG  "VFAB"
X#define XALLSIG "VALL"
X#define XFHCSIG "VFHC"
X#define XDATSIG "VDAT"
X#define XRDTSIG "VRDT"
X#define XPROSIG "VPRO"
X#define XKEYSIG "VKEY"
X#define XNAMSIG "VNAM"
X#define VERSIG  "VMSV"
X
X
X
X#define W(p)    (*(unsigned short*)(p))
X#define L(p)    (*(unsigned long*)(p))
X#define EQL_L(a,b)      ( L(a) == L(b) )
X#define EQL_W(a,b)      ( W(a) == W(b) )
X
X/****************************************************************
X * Function find_vms_attrs scans ZIP entry extra field if any   *
X * and looks for VMS attribute records. Returns 0 if either no  *
X * attributes found or no fab given.                            *
X ****************************************************************/
Xint find_vms_attrs()
X`7B
X    byte *scan = extra_field;
X    struct extra_block *blk;
X    int len;
X
X    outfab = xabfhc = xabdat = xabrdt = xabpro = first_xab = last_xab = 0L;
X
X    if (scan == NULL)
X`09return 0;
X    len = lrec.extra_field_length;
X
X#define LINK(p) `7B`09/* Link xaballs and xabkeys into chain */`09\
X                if( first_xab == 0L )                   \
X                        first_xab = p;                  \
X                if( last_xab != 0L )                    \
X                        last_xab -> xab$l_nxt = p;      \
X                last_xab = p;                           \
X                p -> xab$l_nxt = 0;                     \
X        `7D
X    /* End of macro LINK */
X
X    while (len > 0)
X    `7B
X`09blk = (struct block *) scan;
X`09if (EQL_W(&blk->sig, SIGNATURE))
X`09`7B
X`09    byte *block_id;
X
X`09    block_id = &blk->bid;
X`09    if (EQL_L(block_id, FABSIG))
X`09    `7B
X`09`09outfab = (struct FAB *) extract_block(blk, 0,
X`09`09`09`09`09`09      &cc$rms_fab, FABL);
X`09    `7D
X`09    else if (EQL_L(block_id, XALLSIG))
X`09    `7B
X`09`09xaball = (struct XABALL *) extract_block(blk, 0,
X`09`09`09`09`09`09`09 &cc$rms_xaball, XALLL);
X`09`09LINK(xaball);
X`09    `7D
X`09    else if (EQL_L(block_id, XKEYSIG))
X`09    `7B
X`09`09xabkey = (struct XABKEY *) extract_block(blk, 0,
X`09`09`09`09`09`09`09 &cc$rms_xabkey, XKEYL);
X`09`09LINK(xabkey);
X`09    `7D
X`09    else if (EQL_L(block_id, XFHCSIG))
X`09    `7B
X`09`09xabfhc = (struct XABFHC *) extract_block(blk, 0,
X`09`09`09`09`09`09`09 &cc$rms_xabfhc, XFHCL);
X`09    `7D
X`09    else if (EQL_L(block_id, XDATSIG))
X`09    `7B
X`09`09xabdat = (struct XABDAT *) extract_block(blk, 0,
X`09`09`09`09`09`09`09 &cc$rms_xabdat, XDATL);
X`09    `7D
X`09    else if (EQL_L(block_id, XRDTSIG))
X`09    `7B
X`09`09xabrdt = (struct XABRDT *) extract_block(blk, 0,
X`09`09`09`09`09`09`09 &cc$rms_xabrdt, XRDTL);
X`09    `7D
X`09    else if (EQL_L(block_id, XPROSIG))
X`09    `7B
X`09`09xabpro = (struct XABPRO *) extract_block(blk, 0,
X`09`09`09`09`09`09`09 &cc$rms_xabpro, XPROL);
X`09    `7D
X`09    else if (EQL_L(block_id, VERSIG))
X`09    `7B
X`09`09char verbuf`5B80`5D;
X`09`09int verlen = 0;
X`09`09byte *vers;
X`09`09char *m;
X
X`09`09get_vms_version(verbuf, 80);
X`09`09vers = extract_block(blk, &verlen, 0, 0);
X`09`09if ((m = strrchr(vers, '-')) != NULL)
X`09`09    *m = 0;`09/* Cut out release number */
X`09`09if (strcmp(verbuf, vers) && quietflg == 0)
X`09`09`7B
X`09`09    printf("`5B Warning: VMS version mismatch.");
X
X`09`09    printf("   This version %s --", verbuf);
X`09`09    strncpy(verbuf, vers, verlen);
X`09`09    verbuf`5Bverlen`5D = 0;
X`09`09    printf(" version made by %s `5D\n", verbuf);
X`09`09`7D
X`09`09free(vers);
X`09    `7D
X`09    else if (quietflg == 0)
X`09`09fprintf(stderr, "`5B Warning: Unknown block signature %s `5D\n",
X`09`09`09block_id);
X`09`7D
X`09len -= blk->size + 4;
X`09scan += blk->size + 4;
X    `7D
X
X
X    if (outfab != 0)
X    `7B`09`09`09`09/* Do not link XABPRO,XABRDT now. Leave them for sys$clos
Ve() */
X
X`09outfab->fab$l_xab = 0L;
X`09if (xabfhc != 0L)
X`09`7B
X`09    xabfhc->xab$l_nxt = outfab->fab$l_xab;
X`09    outfab->fab$l_xab = xabfhc;
X`09`7D
X`09if (xabdat != 0L)
X`09`7B
X`09    xabdat->xab$l_nxt = outfab->fab$l_xab;
X`09    outfab->fab$l_xab = xabdat;
X`09`7D
X`09if (first_xab != 0L)`09/* Link xaball,xabkey subchain */
X`09`7B
X`09    last_xab->xab$l_nxt = outfab->fab$l_xab;
X`09    outfab->fab$l_xab = first_xab;
X`09`7D
X`09return 1;
X    `7D
X    else
X`09return 0;
X`7D
X
Xstatic void free_up()
X`7B`09`09`09`09/*
X`09`09`09`09*`09Free up all allocated xabs
X`09`09`09`09*/
X    if (xabdat != 0L) free(xabdat);
X    if (xabpro != 0L) free(xabpro);
X    if (xabrdt != 0L) free(xabrdt);
X    if (xabfhc != 0L) free(xabfhc);
X    while (first_xab != 0L)
X    `7B
X`09struct XAB *x;
X
X`09x = first_xab->xab$l_nxt;
X`09free(first_xab);
X`09first_xab = x;
X    `7D
X    if (outfab != 0L && outfab != &fileblk)
X`09free(outfab);
X`7D
X
Xstatic int get_vms_version(verbuf, len)
X    char *verbuf;
Xint len;
X`7B
X    int i = SYI$_VERSION;
X    int verlen = 0;
X    struct dsc$descriptor version;
X    char *m;
X
X    version.dsc$a_pointer = verbuf;
X    version.dsc$w_length = len - 1;
X    version.dsc$b_dtype = DSC$K_DTYPE_B;
X    version.dsc$b_class = DSC$K_CLASS_S;
X
X    if (ERR(lib$getsyi(&i, 0, &version, &verlen, 0, 0)) `7C`7C verlen == 0)
X`09return 0;
X
X    /* Cut out trailing spaces "V5.4-3   " -> "V5.4-3" */
X    for (m = verbuf + verlen, i = verlen - 1; i > 0 && verbuf`5Bi`5D == ' ';
V --i)
X`09--m;
X    *m = 0;
X
X    /* Cut out release number "V5.4-3" -> "V5.4" */
X    if ((m = strrchr(verbuf, '-')) != NULL)
X`09*m = 0;
X    return strlen(verbuf) + 1;`09/* Transmit ending 0 too */
X`7D
X
X/******************************
X *   Function extract_block   *
X ******************************/
X/*
X * Extracts block from p. If resulting length is less then needed, fill
X * extra space with corresponding bytes from 'init'.
X * Currently understands 3 formats of block compression:
X * - Simple storing
X * - Compression of zero bytes to zero bits
X * - Deflation. See memextract() from extract.c
X */
Xstatic byte *extract_block(p, retlen, init, needlen)
X    struct extra_block *p;
Xint *retlen;
Xbyte *init;
Xint needlen;
X`7B
X    byte *block;`09`09/* Pointer to block allocated */
X    int cmptype;
X    int usiz, csiz, max;
X
X    cmptype = p->flags & BC_MASK;
X    csiz = p->size - EXTBSL - RESL;
X    usiz = (cmptype == BC_STORED ? csiz : p->length);
X
X    if (needlen == 0)
X`09needlen = usiz;
X
X    if (retlen)
X`09*retlen = usiz;
X
X#ifndef MAX
X#define MAX(a,b)`09( (a) > (b) ? (a) : (b) )
X#endif
X
X    if ((block = (byte *) malloc(MAX(needlen, usiz))) == NULL)
X`09return NULL;
X
X    if (init && (usiz < needlen))
X`09memcpy(block, init, needlen);
X
X    switch (cmptype)
X    `7B
X`09case BC_STORED:`09/* The simplest case */
X`09    memcpy(block, &(p->body`5B0`5D), usiz);
X`09    break;
X`09case BC_00:
X`09    decompress_bits(block, usiz, &(p->body`5B0`5D));
X`09    break;
X`09case BC_DEFL:
X`09    memextract(block, usiz, &(p->body`5B0`5D), csiz);
X`09    break;
X`09default:
X`09    free(block);
X`09    block = NULL;
X    `7D
X    return block;
X`7D
X
X/*
X *  Simple uncompression routine. The compression uses bit stream.
X *  Compression scheme:
X *
X *  if(byte!=0)
X *      putbit(1),putbyte(byte)
X *  else
X *      putbit(0)
X */
Xstatic void decompress_bits(outptr, needlen, bitptr)
X    byte *bitptr;
X
X/* Pointer into compressed data */
Xbyte *outptr;`09`09`09/* Pointer into output block */
Xint needlen;`09`09`09/* Size of uncompressed block */
X`7B
X    ULONG bitbuf = 0;
X    int bitcnt = 0;
X
X#define _FILL   if(bitcnt+8 <= 32)                      \
X                `7B       bitbuf `7C= (*bitptr++) << bitcnt;\
X                        bitcnt += 8;                    \
X                `7D
X
X    while (needlen--)
X    `7B
X`09if (bitcnt <= 0)
X`09    _FILL;
X
X`09if (bitbuf & 1)
X`09`7B
X`09    bitbuf >>= 1;
X`09    if ((bitcnt -= 1) < 8)
X`09`09_FILL;
X`09    *outptr++ = (byte) bitbuf;
X`09    bitcnt -= 8;
X`09    bitbuf >>= 8;
X`09`7D
X`09else
X`09`7B
X`09    *outptr++ = 0;
X`09    bitcnt -= 1;
X`09    bitbuf >>= 1;
X`09`7D
X    `7D
X`7D
X
X/***************************/
X/*  Function FlushOutput() */
X/***************************/
X
Xint FlushOutput()
X`7B
X    if (mem_mode)
X    `7B`09`09`09`09/* Hope, mem_mode stays constant during
X`09`09`09`09 * extraction */
X`09int rc = FlushMemory();`09/* For mem_extract() */
X
X`09outpos += outcnt;
X`09outcnt = 0;
X`09outptr = outbuf;
X`09return rc;
X    `7D
X
X    /* return PK-type error code */
X    /* flush contents of output buffer */
X    if (tflag)
X    `7B`09`09`09`09/* Do not output. Update CRC only */
X`09UpdateCRC(outbuf, outcnt);
X`09outpos += outcnt;
X`09outcnt = 0;
X`09outptr = outbuf;
X`09return 0;
X    `7D
X    else
X`09return text_file ? _flush_records(0) : _flush_blocks(0);
X`7D
X
Xstatic int _flush_blocks(final_flag)`09/* Asynchronous version */
X    int final_flag;
X
X/* 1 if this is the final flushout */
X`7B
X    int round;
X    int rest;
X    int off = 0;
X    int out_count = outcnt;
X    int status;
X
X    while (out_count > 0)
X    `7B
X`09if (curbuf->bufcnt < BUFS512)
X`09`7B
X`09    int ncpy;
X
X`09    ncpy = out_count > (BUFS512 - curbuf->bufcnt) ?
X`09`09`09    BUFS512 - curbuf->bufcnt :
X`09`09`09    out_count;
X`09    memcpy(curbuf->buf + curbuf->bufcnt, outbuf + off, ncpy);
X`09    out_count -= ncpy;
X`09    curbuf->bufcnt += ncpy;
X`09    off += ncpy;
X`09`7D
X`09if (curbuf->bufcnt == BUFS512)
X`09`7B
X`09    status = WriteBuffer(curbuf->buf, curbuf->bufcnt);
X`09    if (status)
X`09`09return status;
X`09    curbuf = curbuf->next;
X`09    curbuf->bufcnt = 0;
X`09`7D
X    `7D
X
X    UpdateCRC(outbuf, outcnt);
X    outpos += outcnt;
X    outcnt = 0;
X    outptr = outbuf;
X
X    return (final_flag && (curbuf->bufcnt > 0)) ?
X`09WriteBuffer(curbuf->buf, curbuf->bufcnt) :
X`090;
X    /* 0:  no error */
X`7D
X
X#define RECORD_END(c) ((c) == CR `7C`7C (c) == LF `7C`7C (c) == CTRLZ)
X
Xstatic int _flush_records(final_flag)
X    int final_flag;
X
X/* 1 if this is the final flushout */
X`7B
X    int rest;
X    int end = 0, start = 0;
X    int off = 0;
X
X    if (outcnt == 0 && loccnt == 0)
X`09return 0;`09`09/* Nothing to do ... */
X
X    if (loccnt)
X    `7B
X`09for (end = 0; end < outcnt && !RECORD_END(outbuf`5Bend`5D);)
X`09    ++end;
X
X`09if (end >= outcnt && !final_flag)
X`09`7B
X`09    if (WriteRecord(locbuf, loccnt))
X`09`09return (50);
X`09    fprintf(stderr, "`5B Warning: Record too long (%d) `5D\n",
X`09`09    outcnt + loccnt);
X`09    memcpy(locbuf, outbuf, outcnt);
X`09    locptr = &locbuf`5Bloccnt = outcnt`5D;
X`09`7D
X`09else
X`09`7B
X`09    memcpy(locptr, outbuf, end);
X`09    if (WriteRecord(locbuf, loccnt + end))
X`09`09return (50);
X`09    loccnt = 0;
X`09    locptr = &locbuf;
X`09`7D
X`09start = end + 1;
X
X`09if (start < outcnt && outbuf`5Bend`5D == CR && outbuf`5Bstart`5D == LF)
X`09    ++start;
X    `7D
X
X    do
X    `7B
X`09while (start < outcnt && outbuf`5Bstart`5D == CR)`09/* Skip CR's at the
X`09`09`09`09`09`09`09*  beginning of rec. */
X`09    ++start;
X`09/* Find record end */
X`09for (end = start; end < outcnt && !RECORD_END(outbuf`5Bend`5D);)
X`09    ++end;
X
X`09if (end < outcnt)
X`09`7B`09`09`09/* Record end found, write the record */
X`09    if (WriteRecord(outbuf + start, end - start))
X`09`09return (50);
X`09    /* Shift to the begining of the next record */
X`09    start = end + 1;
X`09`7D
X
X`09if (start < outcnt && outbuf`5Bend`5D == CR && outbuf`5Bstart`5D == LF)
X`09    ++start;
X
X    `7D while (start < outcnt && end < outcnt);
X
X    rest = outcnt - start;
X
X    if (rest > 0)
X`09if (final_flag)
X`09`7B
X`09    /* This is a final flush. Put out all remaining in
X`09    *  the buffer                               */
X`09    if (loccnt && WriteRecord(locbuf, loccnt))
X`09`09return (50);
X`09`7D
X`09else
X`09`7B
X`09    memcpy(locptr, outbuf + start, rest);
X`09    locptr += rest;
X`09    loccnt += rest;
X`09`7D
X    UpdateCRC(outbuf, outcnt);
X    outpos += outcnt;
X    outcnt = 0;
X    outptr = outbuf;
X    return (0);`09`09`09/* 0:  no error */
X`7D
X
X/***************************/
X/*  Function WriteBuffer() */
X/***************************/
X
Xstatic int WriteBuffer(buf, len)/* return 0 if successful, 1 if not */
X    unsigned char *buf;
Xint len;
X`7B
X    int status;
X
X    status = sys$wait(outrab);
X#ifdef DEBUG
X    if (ERR(status))
X    `7B
X`09message("`5B WriteBuffer: sys$wait failed `5D\n", status);
X`09message("", outrab->rab$l_stv);
X    `7D
X#endif
X    outrab->rab$w_rsz = len;
X    outrab->rab$l_rbf = buf;
X
X    if (ERR(status = sys$write(outrab)))
X    `7B
X`09message("`5B WriteBuffer: sys$write failed `5D\n", status);
X`09message("", outrab->rab$l_stv);
X`09return 50;
X    `7D
X    return (0);
X`7D
X
X/***************************/
X/*  Function WriteRecord() */
X/***************************/
X
Xstatic int WriteRecord(rec, len)/* return 0 if successful, 1 if not */
X    unsigned char *rec;
Xint len;
X`7B
X    int status;
X
X    sys$wait(outrab);
X#ifdef DEBUG
X    if (ERR(status))
X    `7B
X`09message("`5B WriteRecord: sys$wait faled `5D\n", status);
X`09message("", outrab->rab$l_stv);
X    `7D
X#endif
X    outrab->rab$w_rsz = len;
X    outrab->rab$l_rbf = rec;
X
X    if (ERR(status = sys$put(outrab)))
X    `7B
X`09message("`5B WriteRecord: sys$put failed `5D\n", status);
X`09message("", outrab->rab$l_stv);
X`09return 50;
X    `7D
X    return (0);
X`7D
X
X/********************************/
X/*  Function CloseOutputFile()  */
X/********************************/
X
Xint CloseOutputFile()
X`7B
X    int status;
X
X    if (text_file) _flush_records(1);
X    else
X`09_flush_blocks(1);
X    /* Link XABRDT,XABDAT and optionaly XABPRO */
X    if (xabrdt != 0L)
X    `7B
X`09xabrdt->xab$l_nxt = 0L;
X`09outfab->fab$l_xab = xabrdt;
X    `7D
X    else
X    `7B
X`09rdt.xab$l_nxt = 0L;
X`09outfab->fab$l_xab = &rdt;
X    `7D
X    if (xabdat != 0L)
X    `7B
X`09xabdat->xab$l_nxt = outfab->fab$l_xab;
X`09outfab->fab$l_xab = xabdat;
X    `7D
X    if (secinf && xabpro != 0L)
X    `7B
X`09xabpro->xab$l_nxt = outfab->fab$l_xab;
X`09outfab->fab$l_xab = xabpro;
X    `7D
X
X    sys$wait(outrab);
X
X    status = sys$close(outfab);
X#ifdef DEBUG
X    if (ERR(status))
X    `7B
X`09message("\r`5B Warning: cannot set owner/protection/time attributes `5D\n
V", status);
X`09message("", outfab->fab$l_stv);
X    `7D
X#endif
X    free_up();
X`7D
X
X#ifdef DEBUG
Xdump_rms_block(p)
X    unsigned char *p;
X`7B
X    unsigned char bid, len;
X    int err;
X    char *type;
X    char buf`5B132`5D;
X    int i;
X
X    err = 0;
X    bid = p`5B0`5D;
X    len = p`5B1`5D;
X    switch (bid)
X    `7B
X`09case FAB$C_BID:
X`09    type = "FAB";
X`09    break;
X`09case XAB$C_ALL:
X`09    type = "xabALL";
X`09    break;
X`09case XAB$C_KEY:
X`09    type = "xabKEY";
X`09    break;
X`09case XAB$C_DAT:
X`09    type = "xabDAT";
X`09    break;
X`09case XAB$C_RDT:
X`09    type = "xabRDT";
X`09    break;
X`09case XAB$C_FHC:
X`09    type = "xabFHC";
X`09    break;
X`09case XAB$C_PRO:
X`09    type = "xabPRO";
X`09    break;
X`09default:
X`09    type = "Unknown";
X`09    err = 1;
X`09    break;
X    `7D
X    printf("Block @%08X of type %s (%d).", p, type, bid);
X    if (err)
X    `7B
X`09printf("\n");
X`09return;
X    `7D
X    printf(" Size = %d\n", len);
X    printf(" Offset - Hex - Dec\n");
X    for (i = 0; i < len; i += 8)
X    `7B
X`09int j;
X
X`09printf("%3d - ", i);
X`09for (j = 0; j < 8; j++)
X`09    if (i + j < len)
X`09`09printf("%02X ", p`5Bi + j`5D);
X`09    else
X`09`09printf("   ");
X`09printf(" - ");
X`09for (j = 0; j < 8; j++)
X`09    if (i + j < len)
X`09`09printf("%03d ", p`5Bi + j`5D);
X`09    else
X`09`09printf("    ");
X`09printf("\n");
X    `7D
X`7D
X
X#endif`09`09`09`09/* DEBUG */
X
Xstatic void message(string, status)
X    int status;
Xchar *string;
X`7B
X    char msgbuf`5B256`5D;
X
X    $DESCRIPTOR(msgd, msgbuf);
X    int msglen = 0;
X
X    if (ERR(lib$sys_getmsg(&status, &msglen, &msgd, 0, 0)))
X`09fprintf(stderr, "%s`5B VMS status = %d `5D\n", string, status);
X    else
X    `7B
X`09msgbuf`5Bmsglen`5D = 0;
X`09fprintf(stderr, "%s`5B %s `5D\n", string, msgbuf);
X    `7D
X`7D
X
X
X#endif`09`09`09`09/* !ZIPINFO */
X#endif`09`09`09`09/* VMS */
$ CALL UNPACK [.UNZIP50]VMS.C;1 908005245
$ create 'f'
X                     VMS Notes for UnZip 5.0
X                           24 May 1992
X
X
XThe various VMS tweaks to UnZip 5.0 and ZipInfo 0.97 were tested on a`20
XVAX 8600 running VMS 5.2 (and, later, VMS 5.4) and VAX C 3.0.  Older`20
Xversions were also tested on a VAX 11/785.
X
XTo build UnZip (and its trusty sidekick, ZipInfo), just run one of the`20
Xincluded command files MAKE_UNZIP_VAXC.COM or MAKE_UNZIP_GCC.COM, either
Xdecryption or non-decryption versions, depending on whether you have the
Xseparate crypt.c module and whether you use VAX C or GNU C (for example,`20
X"@make_unzip_vaxc").  By default, this creates shareable-image executables,
Xwhich are smaller and (supposedly) load faster than the normal type.  They`2
V0
Xalso (supposedly) will be better able to take advantage of any bug fixes`20
Xor new capabilities that DEC might introduce, since the library code isn't`2
V0
Xbuilt into the executable.  The shared executable is about a quarter the`20
Xsize of the ordinary type in the case of UnZip.
X
X`5BBtw, the VMS make utility "MMS" is not compatible enough with Unix make`2
V0
Xto use the same makefile.  Antonio Querubin, Jr., sent along an MMS makefile
V,
Xsubsequently modified by Igor Mandrichenko.  Read the comments at the top`20
Xof DESCRIP.MMS for more info.  An alternate Unix-like makefile designed for`
V20
Xuse with Todd Aven's MAKE/VMS is included, as well.  Comments on where to
Xget MAKE/VMS are at the bottom of VMS Contents.`5D
X
XUnZip is written to return the standard PK-type return codes (or error
Xcodes, or exit codes, or whatever you want to call them).  Unfortunately,
XVMS insists on interpreting the codes in its own lovable way, and this
Xresults in endearing commentary such as "access violation, error mask =
X0005, PC = 00003afc" (or something like that) when you run UnZip with no
Xarguments.  To avoid this I've added a special VMS_return() function which
Xeither ignores the error codes (and exits with normal status) or interprets
Xthem, prints a semi-informative message (enclosed in square `5B`5D brackets)
V,`20
Xand then exits with a normal error status.  I personally can't stand the`20
Xlatter behavior, so by default the error codes are simply ignored.  Tastes
Xvary, however, and some people may actually like semi-informative messages.
XIf you happen to be one of those people, you may enable the messages by`20
Xrecompiling misc.c with RETURN_CODES defined.  (This adds a block or two
Xto the executable size, though.)  The syntax is as follows:
X`09cc /def=(RETURN_CODES) misc
X
XTo use UnZip in the normal way, define a symbol "unzip" as follows:
X`09unzip :== "$diskname:`5Bdirectory`5Dunzip.exe"
X(substitute for "diskname" and "directory" as appropriate, and DON'T FORGET
XTHE `60$'!  It won't work if you omit that.)  In general it's wise to stick`
V20
Xsuch assignments in your LOGIN.COM file and THEN forget about them.  It is`2
V0
Xno longer necessary to worry about the record type of the zipfile...er,`20
Xwell, most of the time, anyway (see the Kermit section below).
X
XHaving done all this you are ready to roll.  Use the unzip command in
Xthe usual way; as with the Unix, OS/2 and MS-DOS versions, this one uses`20
X'-' as a switch character.  If nothing much happens when you do a directory
Xlisting, for example, you're probably trying to specify a filename which
Xhas uppercase letters in it...VMS thoughtfully converts everything on the
Xcommand line to lowercase, so even if you type:
X`09unzip -v zipfile Makefile
Xwhat you get is:
X`09unzip -v zipfile makefile
Xwhich, in my example here, doesn't match the contents of the zipfile.
XThis is relatively easy to circumvent by enclosing the filespec(s) in`20
Xquotes:
X`09unzip -tq unzip401 "Makefile" "VMS*" *.c *.h
X`5BThis example also demonstrates the use of wildcards, which act like Unix
Xwildcards, not VMS ones.   In other words, "VMS*" matches files VMSNOTES,
XVMS_MAKE.COM, and VMSSHARE.OPT, whereas the normal VMS behavior would be
Xto match only the first file (since the others have extensions--ordinarily,
Xyou would be required to specify "VMS*.*").`5D
X
XNote that created files get whatever default permissions you've set, but`20
Xcreated directories additionally inherit the (possibly more restrictive)`20
Xpermissions of the parent directory.  And, of course, things probably won't`
V20
Xwork too well if you don't have permission to write to whatever directory`20
Xinto which you're trying to extract things.  (That made sense; read it`20
Xagain if you don't believe me.)
X
XZipInfo, by the way, is an amusing little utility which tells you all sorts
Xof amazingly useless information about zipfiles.  Occasionally it's useful
Xto debug a problem with a corrupted zipfile (for example, we used it to`20
Xfind a bug in PAK-created zipfiles, versions 2.5 and earlier).  Feel free
Xto blow it away if you don't need it.  It's about 30 blocks on my system,
Xand I find I actually prefer its listing format to that of UnZip now (hardly
Xsurprising, since I wrote it :-) ).  I also find it useful to use "ii"`20
Xrather than "zipinfo" as the symbol for zipinfo, since it's easier to type`2
V0
Xthan either "zipinfo" or "unzip -v", and it echoes the common Unix alias`20
X"ll" for the similar style of directory listings.  Oh, and the reason it's`2
V0
Xstill got a beta version number is that I haven't finished it yet--it would`
V20
Xbe better with an automatic paging function, for example.  Oh well.
X
XRANDOM OTHER NOTES:  (1) Igor Mandrichenko (leader of our fearless Russian`2
V0
Xcontingent) rewrote major portions of the VMS file-handling code, with
Xthe result that UnZip is much smarter now about VMS file formats.  For
Xfull VMS compatibility (file attributes, ownership info, etc.), be sure
Xto use the -X option of Zip 1.6 and later.  There are also some notes
Xat the end of this file from Hugh Schmidt and Mike Freeman which give`20
Xhints on how to save VMS attributes using Zip 1.0 and UnZip 4.1.  Most of
Xthe information is still valid, but the -X option is much easier if you
Xdon't have to transfer the zipfiles to a Unix or PC system.  (2) Zip 1.0`20
Xcannot handle any zipfile that isn't in stream-LF format, so you may need`20
Xto use Rahul Dhesi's BILF utility which is included with UnZip.  It will
Xalso be necessary for certain other special occasions, like when you've`20
Xforgotten to set the correct Kermit parameters while uploading a zipfile`20
X(see Hugh Schmidt's note below for comments about Kermit, too).
X
XGreg Roelofs
X
X====================
X
XFrom INFO-ZIP Digest (Wed, 6 Nov 1991), Volume 91, Issue 290
X
X                VMS attributes and PKZIP compatibility
X                  VMS attributes restored! (2 msgs)
X
X------------------------------
X
XDate: Tue, 5 Nov 91 15:31 CDT
XFrom: Hugh Schmidt <HUGH@macc.wisc.edu>
XSubject: VMS attributes and PKZIP compatibility
XMessage-ID: <21110515313938@vms.macc.wisc.edu>
X
X           ******************************************************
X(1)        *** Retaining VMS attributes - a proposed strategy ***
X           ******************************************************
X
XThis is a proposed strategy for recovering VMS file attributes after
Xzip/unzip:
X
Xa) capture VMS file attributes: VMS ANALYZE/RMS/FDL/OUTPUT=fdlfile vmsfile.e
Vxt
Xb) compress files on VMS......: ZIP zipfile vmsfile.ext, fdlfile.fdl
Xc) uncompress files on VMS....: UNZIP zipfile vmsfile.ext, fdlfile.fdl
Xd) recover VMS file attributes: CONVERT/FDL=fdlfile.fdl vmsfile.ext vmsfile.
Vext
X
XThe wrinkle is that UNZIP creates files which are unreadable by CONVERT
Xdespite a concerted effort to accomodate VMS file management system:
X
Xfile_io.c, line 178: ...creat(filename,0, "rat=cr", "rfm=streamlf")
X
XThese files are unCONVERTABLE because they appear to VMS to contain
Xrecords with 512+ bytes.  Poring over VMS manuals (Programming V-6A, VAX
XC RTL Reference Manual) doesn't readily suggest better alternatives.
XExperimentation with "rat=fix", etc. may help suppress the spurious
Xblock-end delimeters.
X
X          ****************************************************
X(2)       *** VMS ZIP and PKZIP compatibility using KERMIT ***
X          ****************************************************
X
XMany use Procomm's kermit to transfer zipped files between PC and VMS
XVAX.  The following VMS kermit settings make VMS-ZIP compatible with
XPKZIP:
X
X                                             VMS kermit      Procomm kermit
X                                           ---------------   --------------
XUploading PKZIPped file to be UNZIPped:    set fi ty fixed    set fi ty bi
XDownloading ZIPped file to be PKUNZIPped:  set fi ty block    set fi ty bi
X
X"Block I/O lets you bypass the VMS RMS record-processing capabilities
Xentirely", (Guide to VMS file applications, Section 8.5).  The kermit
Xguys must have known this!
X
X         ************************************************
X(3)      *** Making ZIP files compatible with VMS RMS ***
X         ************************************************
X
XIt looks like a crummy patch, but to make VMS RMS happy, I inserted the
Xfollowing near line 570 in the putend() section of zipfile.c:
X
X#ifdef VMS
X fprintf(f,"\n")
X#endif
X
XIt's probably of no consequence, but it satisfies VMS ANALYZE.
X
X------------------------------
X
XDate: Tue, 5 Nov 91 19:40 CDT
XFrom: Hugh Schmidt <HUGH@macc.wisc.edu>
XSubject: VMS attributes restored!
XMessage-ID: <21110519403912@vms.macc.wisc.edu>
X
X           ************************************************************
X           ***   Aha!  It works!  VMS attributes can be restored! *****
X           ***                                                      ***
X           *** Change FAB$C_STMLF to FAB$C_FIX in file_io.c         ***
X           *** ANALYZE => .FDL `7C CONVERT => original VMS attributes ***
X           ************************************************************
X
X(1) Change line 147 in file_io.c and dropping lines 148-149:
X
X    fileblk.fab$b_rfm = FAB$C_STMLF;    /* stream-LF record format */
X    fileblk.fab$b_rat = FAB$M_CR;       /* carriage-return carriage ctrl */
X    /*                      `5E`5E`5E`5E *NOT* V_CR!!!     */
X
X=>
X
X    fileblk.fab$b_rfm = FAB$C_FIX;    /* fixed record format */
X
X(2) Use VMS ANALYZE to store the VMS attributes for the original file
X    into a file descripion language file.  Save the .FDL file with the
X    original file.
X
X(3) Apply the original attributes to the UNZIPped file using VMS CREATE
X    and the description file (test.fdl).
X
XIn the following example, the original attributes of a SPSSX system
Xformat file were restored.  Later, SPSSX successfully read the UNZIPped/
XCONVERTed file.
X
X!******** Procedure (or method for you ai'ers)
X!********
X!******** Create an .FDL file using ANALYZE
X
X$ analyze/rms/fdl/out=test test.spssxsav;1
X
X!******** ZIP the file and its description file
X
X$ zip test test.spssxsav;1 test.fdl;1
Xadding test.spssxsav (imploded 62%)
Xadding test.fdl (imploded 90%)
X
X!******** When the ZIPPED file is needed, UNZIP it and its description file
X
X$ unzip test
X  Exploding: test.spssxsav
X  Exploding: test.fdl
X
X!******** To restore the original attributes, apply the description file to
X!********  the UNZIPped file using VMS CONVERT
X
X$ convert/fdl=test  test.spssxsav;2 test.spssxsav;3
X
X! ******* The following show that the VMS attributes are restored.
X
X$ analyze/rms/check test.spssxsav;1
X
X`09File Spec: PROJDISK5:`5B322042.CORE`5DTEST.SPSSXSAV;1
X`09File Organization: sequential
X`09Record Format: fixed
X`09Record Attributes:
X`09Maximum Record Size: 4
X`09Longest Record: 4
X
XThe analysis uncovered NO errors.
X
X$ analyze/rms/check test.spssxsav;2
X`09File Spec: PROJDISK5:`5B322042.CORE`5DTEST.SPSSXSAV;2
X`09File Organization: sequential
X`09Record Format: undefined
X`09Record Attributes:
X`09Maximum Record Size: 0
X`09Longest Record: 512
XThe analysis uncovered NO errors.
X
X$ analyze/rms/check test.spssxsav;3
X`09File Spec: PROJDISK5:`5B322042.CORE`5DTEST.SPSSXSAV;3
X`09File Organization: sequential
X`09Record Format: fixed
X`09Record Attributes:
X`09Maximum Record Size: 4
X`09Longest Record: 4
X
XThank you all for your help and comments.  It was very reasurring to
Xknow that I was on the right track.  This is a humble contribution
Xcompared to the great efforts of others in the ZIP project.
X
X------------------------------
X
XDate: Wed, 6 Nov 91 12:49:33 EST
XFrom: Mike Freeman <freeman@watsun.cc.columbia.edu>
XSubject: Re: VMS attributes restored!
XMessage-ID: <CMM.0.90.0.689449773.freeman@watsun.cc.columbia.edu>
X
XHello, all.
X
XHUGH@macc.wisc.edu has come up with a commendable method for saving/
Xrestoring record attributes in Vax/VMS files when ZIPping/UNZIPping.
XThere are a couple of potential problems in his specific implementation,
Xhowever:
X
X(a) It would be better to leave the output file(s) in STREAM_LF format
X    and use Joe Meadows' FILE utility to put them in fixed-record
X    format if CONVERT has trouble reading them.
X
X    Outputting a text file as fixed-record format could be a pain, and
X    one would have to use FILE anyway.
X
X    (Incidentally, I ZIPped up a text file, UNZIPped it and used Hugh's
X    method to restore the attributes.  CONVERT had no trouble with the
X    STREAM_LF format -- it's only a problem with binary files and, as I
X    say, Joe Meadows' FILE will fix this.)
X
X(b) Even if ANALYZE/RMS complains, I do not think one ought to put the
X    "\n" in as Hugh advocates.  This contradicts the ZIP philosophy of
X    byte-for-byte storage/retrieval.
X
X    As Mr. Roelofs has said, there is nothing wrong with the ZIP file;
X    it's just that ANALYZE/RMS expects STREAM_LF files to end in an
X    <LF>.
X
XAnyway, I was able to use Hugh's method without modifying ZIP 1.0.  We
Xreally ought to get the word out about FILE, though -- it's very handy.
X
XMike Freeman, K7UIJ     `7C       Internet: freeman@watsun.cc.columbia.edu
X301 N.E. 107th Street   `7C       GEnie: M.FREEMAN11
XVancouvEr, WA 98685 USA `7C       Confidence is the feeling you have
XTelephone (206)574-8221 `7C       before you understand the situation.
X
X------------------------------
X
$ CALL UNPACK [.UNZIP50]VMS.NOTES;1 1631926756
$ create 'f'
Xsys$library:vaxcrtl.exe/share
$ CALL UNPACK [.UNZIP50]VMSSHARE.OPT;1 2088265681
$ create 'f'
X__________________________________________________________________________
X
X  This is the Info-ZIP file `60`60Where,'' last updated on 20 August 1992.
X__________________________________________________________________________
X
X
X  SITE OWNERS:  If you're listed in here but the information is not
X  correct (or if you're a big site but aren't listed at all), please
X  let us know!  E-mail to zip-bugs at the address given in Readme
X  and we'll update this file.
X
XBasic source-archive names for Info-ZIP's portable Zip, UnZip, and related
Xutilities (on some ftp sites, the .zip files may have a .zoo equivalent
Xin zoo 2.10 format):
X
X`09zip19.zip`09Zip 1.9 (includes zipnote and zipsplit)
X`09zip19.tar.Z`09ditto, compress'd tar format
X
X`09unzip50.zip`09UnZip 5.0 (includes zipinfo and funzip)
X`09unzip50.tar.Z`09ditto, compress'd tar format
X
X`09wunz12sr.zip`09WizUnZip 1.2 support files for Windows 3.1, UnZip 5.0
X
X`09zcrypt19.zip`09encryption/decryption support (includes zipcloak)
X
XRelated archives and files:
X
X`09UnzpHist.zip`09changes history of UnZip, back to 2.0
X
X`09zip19x.zip      MSDOS executables and docs for zip, zipnote, zipsplit
X`09unzip50.exe     MSDOS executable for unzip
X
X`09zip19_16.zip`09OS/2 1.x 16-bit executables and docs
X`09zip19_32.zip`09OS/2 2.x 32-bit executables and docs
X`09unz50_16.exe`09OS/2 1.x 16-bit executable
X`09unz50_32.exe`09OS/2 2.x 32-bit executable
X
X`09zip19vms.zip`09VMS executables and docs for zip, zipnote, zipsplit
X`09unz50vms.exe`09VMS executable for unzip
X
X`09zip_unzip.hqx   Macinstosh executables (zip 1.0 only, 1.9 not ready)
X
X`09winunz12.zip    Windows 3.1 executables (zip 1.0 only, 1.9 not ready)
X
X`09pkz110eu.exe`09MS-DOS PKZIP/PKUNZIP 1.1 (self-extracting archive)
X`09pkz193a.exe`09MS-DOS PKZIP/PKUNZIP beta 1.93 (self-extracting)
X`09pkz102-2.exe`09OS/2 PKZIP/PKUNZIP 1.02 (self-extracting)
X
Xftp sites for the US-exportable sources and executables.  Look for
Xthe file names given above in the following directories.  Some sites
Xlike to use slightly different names, such as zip-1.9.tar-z instead
Xof zip19.tar.Z.
X
X`09wuarchive.wustl.edu:/packages/compression/...
X`09wuarchive.wustl.edu:/mirrors/misc/unix/...
X`09wuarchive.wustl.edu:/mirrors/misc/vaxvms/...
X`09wuarchive.wustl.edu:/mirrors/msdos/zip/...
X`09wuarchive.wustl.edu:/mirrors/msdos/windows3/...
X
X`09ftp.uu.net:/pub/zip/...
X
X`09ftp-os2.nmsu.edu:/pub/os2/2.0/archivers/...
X`09ftp-os2.nmsu.edu:/pub/os2/all/archivers/...
X
X`09Zip 1.9 and UnZip 5.0 will also be available at any comp.sources.misc
X`09archive site as soon as they are posted.
X
X`09wuarchive.wustl.edu:/mirrors/msdos/zip/pkz110eu.exe
X`09ux1.cso.uiuc.edu:/pc/exec-pc/pkz193a.exe`09`5B128.174.5.59`5D
X
Xftp sites for the encryption and decryption sources:
X
X`09NOTE:  Non-US users, please do NOT ftp from the US site (US
X`09regulations and all that).  Likewise, US users, please do not
X`09ftp from the European sites (it's not illegal, but it sure is
X`09a waste of expensive bandwidth).
X
X`09From the US:
X`09   wuarchive.wustl.edu:/mirrors3/garbo.uwasa.fi/arcutil/zcrypt19.zip
X
X`09Outside the US:
X`09   garbo.uwasa.fi:/pc/arcutil/zcrypt19.zip
X`09   ftp.win.tue.nl:/pub/compression/zip/zcrypt19.zip
X`09   ftp.inria.fr:/system/arch-compr/zcrypt19.zip
X`09   ftp.informatik.tu-muenchen.de:/pub/utils/archiver/zcrypt19.zip
X`09     (mail server at ftp-mailer@ftp.informatik.tu-muenchen.de)
X
XTo find other ftp sites:
X
X`09The "archie" ftp database utility can be used to find an ftp site
X`09near you.  If you don't know how to use it, DON'T ASK US--check the
X`09Usenet groups news.newusers.questions or news.answers or some such,
X`09or ask your system administrator.
X
XUUCP sites:
X
X`09uunet!`7E/pub/zip/ ...
X
XMail servers:
X
X`09If you don't have anonymous FTP capability, you can mail one
X`09of the following commands (in the body of an e-mail message) to
X`09listserv@vm1.nodak.edu or listserv@vm.ecs.rpi.edu in order to
X`09get a copy via e-mail:
X
X`09/pdget mail pd:<misc.unix>unzip50.tar-z uuencode
X`09/pdget mail pd:<misc.unix>zip19.zip uuencode
X   or:`09/pdget mail pd:<misc.unix>zip19.tar-z uuencode
X
X`09To get the encryption source by email, send the following commands
X`09to ftp-mailer@ftp.informatik.tu-muenchen.de:
X
X`09get /pub/utils/archiver/zcrypt19.zip
X        quit
X
X__________________________________________________________________________
X
XAgain, if someone repackages any of the source or executable archives in
XVMS-, Mac- or Atari-specific formats, please let us know (send e-mail to`20
Xzip-bugs at the address listed in README).
X__________________________________________________________________________
X
$ CALL UNPACK [.UNZIP50]WHERE.;1 1668754520
$ create 'f'
X/* This is a dummy zip.h to allow crypt.c from Zip to compile for unzip */
X
X#include "unzip.h"
X#define SKIP_TIME_H   /* don't include time.h again in crypt.c */
X
X#define local
Xtypedef unsigned short ush;
Xtypedef unsigned long ulg;
X
Xextern ULONG crc_32_tab`5B`5D;
X#define crc32(c, b) (crc_32_tab`5B((int)(c) `5E (b)) & 0xff`5D `5E ((c) >> 8
V))
$ CALL UNPACK [.UNZIP50]ZIP.H;1 708390145
$ create 'f'
X.de X
X.nf
X.ien .ti -5
X.el \`7B .ti +2m
X.ps -1 \`7D
X\&\\$1
X.ien .ti +5
X.el \`7B .ti -2m
X.ps +1 \`7D
X.fi
X..
X.TH ZIPINFO 1 "19 Aug 92 (v1.0)"
X.SH NAME
Xzipinfo \- list detailed information about a ZIP archive file
X.SH SYNOPSIS
X\fBzipinfo\fP `5B\-\fB1smlvht\fP`5D \fRfile\fP`5B\fR.zip\fP`5D `5B\fRfilespe
Vc\fP\ ...`5D
X.SH ARGUMENTS
X.IP \fIfile\fP`5B\fI.zip\fP`5D \w'`5B\fIfilespec\fP`5D'u+2m
XPath of the ZIP archive.  The suffix `60`60\fR.zip\fP'' is applied
Xif the \fRfile\fP specified does not exist.  Note that
Xself-extracting ZIP files are supported; just specify
Xthe `60`60\fR.exe\fP'' suffix yourself.
X.IP `5B\fIfilespec\fP`5D
XAn optional list of archive members to be processed.
XExpressions may be used to match multiple members; be sure to quote
Xexpressions that contain characters interpreted by the Unix shell. See
XPATTERN MATCHING (below) for more details.
X.SH OPTIONS
X.PD 0
X.IP \-1 \w'\-1'u+2m
Xlist filenames only, one per line (useful for pipes)
X.IP \-s
Xlist zipfile info in short Unix `60`60ls \-l'' format:  default
X.IP \-m
Xlist zipfile info in medium Unix `60`60ls \-l'' format
X.IP \-l
Xlist zipfile info in long Unix `60`60ls \-l'' format
X.IP \-v
Xlist zipfile information in verbose, multi-page format
X.IP \-h
Xlist header line
X.IP \-t
Xlist totals for files listed or for all files
X.PD
X.SH PATTERN MATCHING
XAll archive members are listed unless a \fIfilespec\fP is provided to`20
Xspecify a subset of the archive members.  The \fIfilespec\fP is similar`20
Xto an \fRegrep\fP expression, and may contain:
X.PP
X.ta \w'`5B...`5D'u+2m
X*`09matches a sequence of 0 or more characters
X.br
X?`09matches exactly 1 character
X.br
X\\nnn`09matches the character having octal code nnn
X.PD 0
X.IP `5B...`5D \w'`5B...`5D'u+2m
Xmatches any single character found inside the brackets; ranges
Xare specified by a beginning character, a hyphen, and an ending
Xcharacter.  If an exclamation point or a carat (`60!' or `60`5E') follows
Xthe left bracket, then the range of characters matched is complemented
Xwith respect to the ASCII character set (that is, anything except the
Xcharacters inside the brackets is considered a match).
X.PD
X.SH DESCRIPTION
X.I ZipInfo
Xlists technical information about a ZIP archive, including information
Xfile access permissions, encryption status, type of compression, version
Xand operating system of compressing program, and the like.  The default
Xoption is to list files in the following format:
X.PP
X.X "-rw-rwl---  1.5 unx    2802 t- defX 11-Aug-91 13:48 perms.2660"
X.PP
XThe last three fields are clearly the modification date and time of
Xthe file, and its name.  The case of the filename is respected; thus
Xfiles which come from MS-DOS PKZIP are always capitalized.  If the file
Xwas zipped with a stored directory name, that is also displayed as part
Xof the filename.
X.PP
XThe second and third fields indicate that the file was zipped under
XUnix with version 1.5 of \fRZip\fP (a beta version).  Since it comes
Xfrom Unix, the file
Xpermissions at the beginning of the line are printed in Unix format.
XThe uncompressed file-size (2802 in this example) is the fourth field.
X.PP
XThe fifth field consists of two characters, either of which may take
Xon several values.  The first character may be either `60t' or `60b', indica
Vting
Xthat \fRZip\fP believes the file to be text or binary, respectively;
Xbut if the file is encrypted, \fIZipInfo\fP
Xnotes this fact by capitalizing the character (`60T' or `60B').  The second
Xcharacter may also take on four values, depending on whether there is
Xan extended local header and/or an `60`60extra field'' associated with the
Xfile (explained in PKWare's APPNOTE.TXT).  If neither exists, the character
Xwill be a hyphen (`60\-'); if there is an extended local header but no extra
Xfield, `60l'; if the reverse, `60x'; and if both exist, `60X'.  Thus the
Xfile in this example is (apparently) a text file, is not encrypted, and
Xhas neither an extra field nor an extended local header associated with it.
XThe example below, on the other hand, is an encrypted binary file with an`20
Xextra field:
X.PP
X.X "RWD,R,R     0.9 vms     168 Bx shrk  9-Aug-91 19:15 perms.0644"
X.PP
XExtra fields are used by PKWare for authenticity verification(?) and
Xpossibly other purposes, and by Info-ZIP's \fRZip\fP
X1.6 and later to store OS/2, Macintosh and VMS file attributes.
XThis example presumably falls into
Xthe latter class, then.  Note that the file attributes are listed in
XVMS format.  Other possibilities for the host operating system include
XOS/2 with High Performance File System (HPFS), DOS or OS/2 with File`20
XAllocation Table (FAT) file system, and Macintosh, denoted
Xas follows:
X.PP
X.X "arc,,rw,    1.0 os2    5358 Tl i4:3  4-Dec-91 11:33 longfilename.hpfs"
X.X "arc,hid,rdo,sys dos    4096 b- i4:2 14-Jul-91 12:58 EA DATA. SF"
X.X "--w-------  1.0 mac   17357 bx i8:2  4-May-92 04:02 unzip.macr"
X.PP
XFile attributes in the first two cases are indicated in a DOS-like format,
Xwhere the file may or may not have its archive bit set; may be hidden or not
V;
Xmay be read-write or read-only; and may be a system file or not.  If the
Xattributes are too long, the version number of the encoding software is
Xomitted.  (The information is still available in the verbose listing,`20
Xhowever.)  Interpretation of Macintosh file attributes needs some work yet.
X.PP
XFinally, the sixth field indicates
Xthe compression method and possible sub-method used.  There are six methods
Xknown at present:  storing (no compression), reducing, shrinking, imploding,
Xtokenizing, and deflating.  In addition, there are four levels of reducing
X(1 through 4); four types of imploding (4K or 8K sliding dictionary, and
X2 or 3 Shannon-Fano trees); and three levels of deflating (fast, normal,
Xmaximum compression).  \fIZipInfo\fP represents these methods and their
Xsub-methods as follows:  `60`60stor''; `60`60re:1,'' `60`60re:2,'' etc.; `60
V`60shrk'';
X`60`60i4:2,'' `60`60i8:3,'' etc.; `60`60tokn''; and `60`60defF,'' `60`60defN
V,'' and `60`60defX.''
X.PP
XThe medium and long listings are almost identical to the
Xshort format except that they add information on the file's
Xcompression.  The medium format indicates the file's
Xcompression factor as a percentage:
X.PP
X.X "-rw-rwl---  1.5 unx    2802 t- 81% defX 11-Aug-91 13:48 perms.2660"
X.PP
XIn this example, the file has been compressed by more than a factor of
Xfive; the compressed data are only 19% of the original size.  The long
Xformat gives the compressed file's size in bytes, instead:
X.PP
X.X "-rw-rwl---  1.5 unx    2802 t-     538 defX 11-Aug-91 13:48 perms.2660"
X.PP
XIn addition to individual file information, a default zipfile listing
Xalso includes header and trailer lines:
X.PP
X.X "Archive:  OS2.zip   5453 bytes   5 files"
X.X ",,rw,       1.0 os2     730 b- i4:3 26-Jun-92 23:40 Contents"
X.X ",,rw,       1.0 os2    3710 b- i4:3 26-Jun-92 23:33 makefile.os2"
X.X ",,rw,       1.0 os2    8753 b- i8:3 26-Jun-92 15:29 os2unzip.c"
X.X ",,rw,       1.0 os2      98 b- stor 21-Aug-91 15:34 unzip.def"
X.X ",,rw,       1.0 os2      95 b- stor 21-Aug-91 17:51 zipinfo.def"
X.X "5 files, 13386 bytes uncompressed, 4951 bytes compressed:  63%"
X.PP
XThe header line gives the name of the archive, its total size, and the
Xtotal number of files; the trailer gives the number of files listed,
Xtheir total uncompressed size, and their total compressed size (not
Xincluding any of \fRZip\fP's internal overhead).  If, however, one or`20
Xmore \fIfilespec\fPs are provided, the header and trailer lines are
Xnot listed.  This behavior is also similar to that of Unix's `60`60ls \-l'';
Xit may be overridden by specifying the \-h and \-t options explicitly.
XIn such a case the listing format must also be specified explicitly,
Xsince \-h or \-t (or both) in the absence of other options implies
Xthat ONLY the header or trailer line (or both) is listed.  See the
XEXAMPLES section below for a semi-intelligible translation of this
Xnonsense.
X.PP
XThe verbose listing is self-explanatory.  It also lists file
Xcomments and the zipfile comment, if any, and the number of
Xbytes of OS/2 extended attributes stored.  Note that the
Xlatter number will in general NOT match the number given by
XOS/2's `60`60dir'' command; OS/2 always reports the number of
Xbytes required in 16-bit format, whereas \fIZipInfo\fP
Xalways reports the 32-bit storage.
X.PD
X.SH ENVIRONMENT OPTIONS
XModifying \fIZipInfo\fP's default behavior via options placed in
Xan environment variable can be a bit complicated to explain, due to
X\fIZipInfo\fP's attempts to handle various defaults in an intuitive,
Xyet Unix-like, manner.  Nevertheless, there is some underlying logic.
XIn brief,`20
Xthere are three `60`60priority levels'' of options:  the default options;
Xenvironment options, which can override or add to the defaults; and`20
Xexplicit options given by the user, which can override or add to`20
Xeither of the above.
X.PP
XThe default listing format, as noted above, corresponds roughly
Xto the "zipinfo \-hst" command (except when individual zipfile members
Xare specified).
XA user who prefers the long-listing format (\-l) can make use of the
X\fIZIPINFO\fP environment variable to change this default:
X.ta \w'tabset'u +\w'ZIPINFO=\-l; export ZIPINFO'u+3m
X.PP
X.IP "\tsetenv ZIPINFO \-l\tUnix C shell"
X.br
X.IP "\tZIPINFO=\-l; export ZIPINFO\tUnix Bourne shell"
X.PP
X.IP "\tset ZIPINFO=\-l\tOS/2 or MS-DOS"
X.PP
X.IP "\tdefine ZIPINFO_OPTS ""\-l""\tVMS (quotes for LOWERCASE)"
X.PP
XIf, in addition, the user dislikes the trailer line, \fIZipInfo\fP's
Xconcept of `60`60negative options'' may be used to override the default
Xinclusion of the line.  This is accomplished by preceding the undesired
Xoption with one or more minuses:  e.g., `60`60\-l\-t'' or `60`60\-\-tl'', in
V this
Xexample.  The first hyphen is the regular switch character, but the one
Xbefore the `60t' is a minus sign.  The dual use of hyphens may seem a little
Xawkward, but it's reasonably intuitive nonetheless:  simply ignore the
+-+-+-+-+-+-+-+-  END  OF PART 13 +-+-+-+-+-+-+-+-
Technical Details
Message-ID: <8009670@MVB.SAIC.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!network.ucsd.edu!mvb.saic.com!vmsnet-sources

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!network.ucsd.edu!mvb.saic.com!vmsnet-sources
From: goathunter@wkuvx1.bitnet
Newsgroups: vmsnet.sources
Subject: Zip v1.9 & UnZip v5.0, part 13/22
Message-ID: <8009670@MVB.SAIC.COM>
Date: Tue, 01 Sep 1992 22:52:43 GMT
Organization: Western Kentucky University, Bowling Green, KY
Lines: 1422
Approved: Mark.Berryman@Mvb.Saic.Com