10 ! PROGRAM DIRLOG.BAS
	! TO BE RUN DAILY FOR ACCOUNTING OF DISK USAGE
20 DIM N$[40]V,L$[80]V,L1$[80]V,L2$[80]V,L3$[80]V,AC$[9]V,US$[9]V
30 S=0 : US=0 : AL=0 : FI=0
40 CALL "SPAWNB"("SDV DP1:",S)
50 OPEN #3,"DIRLOG.DAT/RO/EN:360"
60 ON ERROR GOTO 320
70 OPEN #4,"TEMP.DIR/RO"
80 ON ERROR GOTO 0 : CLOSE 4
90 CALL "SPAWNB"("PIP TEMP.DIR;*/DE",S)
100 INPUT LINE #3,L$
110 AC$=PIECE$(L$,";",1)	: ! GET ACCOUNT #
120 US$=PIECE$(L$,";",2)	: ! GET USER NAME
130 L2$="PIP TEMP.DIR="+AC$+"/TB"
140 CALL "SPAWNB"(L2$,S) : IF S<>1 THEN 100
150 OPEN #4,"TEMP.DIR/RO"
160 INPUT LINE #4,L$ : INPUT LINE #4,L$
170 L$=SBS$(L$,14) : ! TRIM OFF LEADING GARBAGE
180 L1$=PIECE$(L$," blocks in ",1)
190 L3$=PIECE$(L$," blocks in ",2)
200 L3$=PIECE$(L3$," file",1)
210 L2$=PIECE$(L1$,"/",2)	! BLOCKS ALLOCATED
220 L1$=PIECE$(L1$,"/",1)	! BLOCKS USED
230 CLOSE 4
240 ON ERROR GOTO 600
250 OPEN #5,US$+".STO/FX/AP/LN:52"
260 ON ERROR GOTO 0
270 PRINT #5,RJS$(DDAT$(0),9)+RJS$(TIM$(0),9)+RJS$(L1$,8)+RJS$(L2$,8)+RJS$(L3$,8)+RJS$(AC$,10)
280 CLOSE 5
290	US=US+VAL(L1$):
	AL=AL+VAL(L2$):
	FI=FI+VAL(L3$)
300 CALL "SPAWNB"("PIP TEMP.DIR;*/DE",S)
310 GOTO 100
320 ! ROUTINE FOR HANDLING OF OPEN FAILURE
330 ON ERROR GOTO 0
340 IF FCS(0)=-26 THEN 100
350 ! STOP
360 CLOSE
370 !     ********* DO DISK BACKUP, LOG TOTALS, ETC *********     !
380 PRINT CHR$(12)
390 PRINT "TOTAL OF";US;"/";AL;"BLOCKS IN";FI;"FILES"
400 CALL "SPAWNB"("TIM",S)
410 CALL "SPAWNB"("BA2 LB:[1,100]NEWTTYLOG/RN",S)
420 CALL "SPAWNB"("BA2 LB:[1,1]BACKBOTH/RN",S)
430 CALL "SPAWNB"("BA2 LB:[1,1]VERIFY/RN",S)
440 CALL "SPAWNB"("BA2 DP1:[1,1]HELLOSTUF/RN",S)
450 CALL "SPAWNB"("TIM",S)
460 ! CALL "SPAWNB"("BA2 DP1:[1,100]DSM/RN",S)
470 ! CALL "SPAWNB"("TIM",S)
480 CALL "SPAWNB"("BA2 DP1:[1,100]PURGE/RN",S)
490 CALL "SPAWNB"("BA2 DP1:[202,200]SPELLY/RN",S)
500 CALL "SPAWNB"("BA2 DP1:[102,7]STAND/RN",S)
580 PRINT CHR$(12)
590 EXIT
600	! ROUTINE TO CREATE NEW STORAGE LOG FILE (EXTENSION .STO)
	! IF ONE DOES NOT EXIST. THUS ALL ONE NEEDS TO DO IN ORDER
	! TO START A NEW USER IS TO ENTER HIS INFO IN DIRLOG.DAT
610 ON ERROR GOTO 0
620 IF FCS(0) <> -26 THEN STOP
	ELSE OPEN #5,US$+".STO/FX/WR/LN:52" :
		GOTO 270
