/* lists an Zip file's contents */
BOOL
ListZip(ULONG type,UBYTE *infile)
{
  int ct, time, date, done;
  ULONG uncomp, comp, i, extra, tfiles = 0, tcomp = 0, tuncomp = 0;
  UBYTE b[200],time_str[25];
  FILE *fp;

  fp = OpenFile(type,infile);
  ct = fread(b, 30, 1, fp);

  /* check ZIP signature and fread status */
  if ((strnicmp(ZIP_SIG,b,4) != 0) || ct != 1)
   {
    fclose(fp);
    return (WRONG_ARCHIVE);
    }

  /* start listing */
  InitList(ZIP,infile);

  /* parse each header block until done */
  done= FALSE;
  while ( ! done) {
    comp = GetLong(b,21);
    uncomp = GetLong(b,25);
    date = b[13] * 256 + b[12];
    time = b[11] * 256 + b[10];
    if (MSDog(time,date,time_str) == ABORT) break;
    i = (ULONG) ( b[26] + b[27] * 256);
    extra = (ULONG) ( b[28] + b[29] * 256);

    /* get variable length filename */
    fread(b, i, 1, fp);
    b[(int) i] = '\0';
    PrintList(b, uncomp, comp,&tfiles,&tcomp,&tuncomp,time_str);

    /* get variable length 'extra' bytes */
    if (extra != 0) fread(b, extra, 1, fp);
    fseek(fp,comp,SEEK_CUR);
    ct = fread(b, 30, 1, fp);

    /* check ZIP signature */
    if ((strnicmp(ZIP_SIG,b,4) != 0) || ct != 1) done = TRUE;
    }

  fclose(fp);
  EndStats(tfiles,tcomp,tuncomp);
  return(TRUE);
}
