/* List an ARJ file's contents */
BOOL
ListArj(ULONG type,UBYTE *infile)
{
  int time, date, header_size;
  ULONG uncomp, comp, tfiles = 0, tcomp = 0, tuncomp = 0;
  UBYTE name[132],b[200], time_str[25];
  FILE *fp;

  fp = OpenFile(type,infile);

  /* Read in my bytes */
  ReadBuf (4,fp,b);

  /* Determine if it is an ARJ file */
  if (strncmp(ARJ_SIG,b,2))
    {
      fclose (fp);
      return (WRONG_ARCHIVE);
    }

  header_size = b[3] * 256 + b[2];
  while (header_size != 0)
   {
     ReadBuf(header_size,fp,b);
     ReadBuf (6,fp,b);
     header_size = b[5] * 256 + b[4];
   }
  ReadBuf (4,fp,b);
  header_size = b[3] * 256 + b[2];
  ReadBuf(header_size,fp,b);

  /* Print out header info to standard output */
  InitList(ARJ,infile);

  while (TRUE)
   {
     /* Calculate Compressed, Uncompressed, Date,Time, and print it out */
     comp = GetLong(b,15);
     uncomp = GetLong(b,19);
     date = b[11] * 256 + b[10];
     time = b [9] * 256 + b[8];
     if (MSDog (time,date,time_str) == ABORT) break;
     PrintList(b+30, uncomp, comp,&tfiles,&tcomp,&tuncomp,time_str);

     while (header_size != 0)
      {
        ReadBuf (6,fp,b);
        header_size = b[5] * 256 + b[4];
        if (header_size != 0) ReadBuf(header_size,fp,b);
      }

     /* Read in more bytes */
     fseek(fp,comp,SEEK_CUR);
     ReadBuf (4,fp,b);

     header_size = b[3] * 256 + b[2];

     if (header_size == 0) break;
     ReadBuf(header_size,fp,b);
   }

  fclose (fp);
  /* Print ending stats */
  EndStats(tfiles,tcomp,tuncomp);
  return (TRUE);
}
