#include <jaz.h>
main()
{
  TDISKBLK wdisk;
  int wstart;			/* starting sector for directory */
  int w,i;
  TDIR *wdir;			/* pointer to sector buffer	 */

  diskinfo(2,&wdisk);		/* get disk information */

  /* directory starts immediately after the two copies of the FAT */
  /* which are immediately after the boot sector		  */
  wstart = (wdisk.sectfat << 1) + 1;

  wdir = (TDIR *) malloc(wdisk.numdir * 32);

  dosreads(2,wstart,wdisk.numdir * 32 / wdisk.bytes,wdir);

  for (w = 0 ; w < wdisk.numdir ; w ++) {
    if ((wdir+w)->filename[0] == 0) break;
    printf("\n");
    for (i = 0 ; i < 8 ; i ++) printf("%c",((wdir+w)->filename)[i]);
    printf(".");
    for (i = 0 ; i < 3 ; i ++) printf("%c", ((wdir+w)->ext)[i]);
    printf(" %X",(wdir+w)->attribute);
    printf(" %ld",(wdir+w)->size);
  }
}
