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

  fp = OpenFile(type,infile);
  ct = ReadBuf(29,fp,b);

  /* check ARC signature */
  if ( (b[0] != 0x1A) || (ct != 1)) {
    fclose(fp);
    return(WRONG_ARCHIVE);
    }

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

  /* parse each header block until ARC signature check fails or EOF */
  done= FALSE;
  while ( ! done) {
    comp = GetLong(b,18);
    uncomp = GetLong(b,28);
    date = b[20] * 256 + b[19];
    time = b[22] * 256 + b[21];
    if (MSDog(time,date,time_str) == ABORT) break;
    PrintList(b+2, uncomp, comp,&tfiles,&tcomp,&tuncomp,time_str);
    fseek(fp,comp,SEEK_CUR);

    /* get next block and check */
    ct = fread(b, 29, 1, fp);
    if ( (b[0] != 0x1A) || (ct != 1) || (b[1] == 0)) done = TRUE;
    }

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