

!	DIRECT PROGRAM:
!
!	.DIR <DISK>	NORMAL WIDE MODE
!
!	.DIR <DISK>/OPTIONS	PRINT OUT OTHER DATA...
!
!	/H[CN]	PRINT OUT THE HEADER CLUSTER NUMBER
!	/N[LCNS]	PRINT OUT THE NUMBER OF CLUSTERS
!	/I[NIT]	PRINT OUT THE HCSIC
!	/S[IZE]	PRINT OUT THE FILE SIZE IN BYTES
!	/P[ROT]	PRINT OUT THE PROTECTION
!	/D[ATE]	PRINT OUT THE CREATION DATE
!	/A[LL]	PRINT OUT ALL OF THE ABOVE
!
!	3/9/79 CJM
!
	DIM	ENTRY$[32],READB$/:B,:E,1,0/,I/0/,TOTENTS/0/,TOTLCNS/0/
	DIM	HCN/0/,NLCNS/0/,INIT/0/,BYTES/0/,PROT/0/,DATE/0/,WIDE/1/
	DIM	COMMAND$[100],OPTIONS$[100],J

	INPUT	"" COMMAND$
	COMMAND$=UPPERCASE$(COMMAND$)

	ENTRY$=COMMAND$
	IF 0=FIND(COMMAND$,"/") THEN 1
	OPTIONS$=RIGHT$(COMMAND$,FIND(COMMAND$,"/"))
	ENTRY$=LEFT$(COMMAND$,FIND(COMMAND$,"/")-1)

	WIDE=0

5	IF	OPTIONS$="" THEN 1
	IF	OPTIONS$[1,1]<>"/" THEN ...
&		LET OPTIONS$=OPTIONS$[2,LEN(OPTIONS$)-1]\GOTO 5

	OPTIONS$=OPTIONS$[2,LEN(OPTIONS$)-1]
	IF	OPTIONS$[1]="H" THEN LET HCN=1\GOTO 5
	IF	OPTIONS$[1]="N" THEN LET NLCNS=1\GOTO 5
	IF	OPTIONS$[1]="I" THEN LET INIT=1\GOTO 5
	IF	OPTIONS$[1]="S" THEN LET BYTES=1\GOTO 5
	IF	OPTIONS$[1]="P" THEN LET PROT=1\GOTO 5
	IF	OPTIONS$[1]="D" THEN LET DATE=1\GOTO 5
	IF	OPTIONS$[1]="A" THEN ...
&	HCN=1\NLCNS=1\INIT=1\BYTES=1\PROT=1\DATE=1\GOTO 5
	PRINT	"ILLEGAL OPTION:"
	PRINT	COMMAND$
	OPTIONS$="/" CAT OPTIONS$
	PRINT	TAB(FIND(COMMAND$,OPTIONS$));"^"
	STOP

1	OPEN	#1, ENTRY$ CAT 'DIRECTORY.SYS'

	IF WIDE THEN 10
	PRINT "File name";TAB(18);
	IF HCN THEN PRINT "hcn    ";
	IF NLCNS THEN PRINT "  nlcns ";
	IF INIT THEN PRINT " hcsic ";
	IF BYTES THEN PRINT "file size ";
	IF PROT THEN PRINT "protection ";
	IF DATE THEN PRINT "  date";
	PRINT
10	ON ERROR GOTO 100
	CALL	SYSCALL(READB$,"",ENTRY$)
	IF	ENTRY$[16+3]=0 THEN 10
	PRINT	ENTRY$[1,16];' ';
	TOTENTS=TOTENTS+1
	TOTLCNS=TOTLCNS+ENTRY$[20]*256+ENTRY$[21]
	IF NOT(WIDE) THEN 50
	I=I+1
	IF	I=4 THEN PRINT\LET I=0
	GOTO	10
50	IF NOT(HCN) THEN 51
	PRINT HEX$(ENTRY$[17]**8+ENTRY$[18]);"  ";

51	IF NOT(NLCNS) THEN 52
	J=ENTRY$[20]*256+ENTRY$[21]
	PRINT USING "####### ",J;

52	IF NOT(INIT) THEN 53
	PRINT USING "###### ",ENTRY$[19];

53	IF NOT(BYTES) THEN 54
	PRINT USING "######### ",(ENTRY$[22]*256^3)+(ENTRY$[23]*65536)+ ...
&		(ENTRY$[24]*256)+ENTRY$[25];

54	IF NOT(PROT) THEN 55
	IF ENTRY$[26]&:40 THEN PRINT "wrt "; ELSE PRINT "    ";
	IF ENTRY$[26]&:80 THEN PRINT "delete "; ELSE PRINT "       ";

55	IF NOT(DATE) THEN 56

	COMMAND$=HEX$(ENTRY$[28])
	OPTIONS$=COMMAND$[4,2] CAT "/"
	COMMAND$=HEX$(ENTRY$[27])
	OPTIONS$=OPTIONS$ CAT COMMAND$[4,2] CAT "/"
	COMMAND$=HEX$(ENTRY$[29])
	PRINT OPTIONS$;COMMAND$[4,2];

56	PRINT
	GOTO 10


100	ON ERROR GOTO 0
	PRINT
	PRINT	"A total of";TOTLCNS;"clusters in";TOTENTS;"files"
	STOP
	END
