Google
 

Trailing-Edge - PDP-10 Archives - cust_sup_cusp_bb-x130c-sb - 10,7/unscsp/lodtst/exist.mac
There are 5 other files named exist.mac in the archive. Click here to see a list.
	TITLE	EXIST

T1=1
T2=2
T3=3
T4=4
T5=5
ARG=16
P=17
CL.ACS==1B32	;INHIBIT UPDATING ACCESS DATE

EXIST::	MOVEI	T4,@0(ARG)	;POINT TO FILENAME
	MOVEI	T5,^D10		;MAX LENGTH
	HRLI	T4,(POINT 7,)	;MAKE BYTE POINTER
	MOVEI	T2,6		;MAX LENGTH OF FILE NAME
	MOVE	T3,FNMPTR	;POINTER TO NAME IN LKP BLOCK
LOOP:	PUSHJ	P,GETC		;GET USER ARGUEMENT CHARACTER
	  JRST	EXSTST		;END OF STRING
	CAIN	T1,'.'		;LOOK FOR START OF EXTENSION
	JRST	EXSDOT		;YES, GO HANDLE
	IDPB	T1,T3		;STORE FILE NAME CHARACTER
	SOJG	T2,LOOP		;LOOP OVER WHOLE NAME
EXSLOK:	PUSHJ	P,GETC		;END OF NAME, SCAN FOR DOT OR END
	  JRST	EXSTST		;DONE, GO TEST FOR FILE
	CAIN	T1,'.'		;FOUND DOT?
	JRST	EXSDOT		;GET EXTENSION
	JRST	EXSLOK		;KEEP SCANNING

EXSDOT:	MOVEI	T2,3		;MAXIMUM LENGTH OF EXTENSION
	MOVE	T3,EXTPTR	;POINT TO EXTENSION IN LKP BLOCK
EXSDO1:	PUSHJ	P,GETC		;GET A CHARACTER
	  JRST	EXSTST		;END OF INPUT STRING
	IDPB	T1,T3		;SAVE EXTENSION CHARACTER
	SOJG	T2,EXSDO1	;LOOP OVER WHOLE NAME
EXSTST:	MOVEI	T1,17		;MODE
	MOVSI	T2,'DSK'	;DEVICE
	SETZ	T3,		;NO BUFFERS
	OPEN	0,T1		;OPEN DSK
	  JRST	EXSERR		;CAN'T, QUIT
	SETZM	LKPBLK+2	;CLEAR LOOKUP PPN 
	SETZM	LKPBLK+3	;AND DATE
	LOOKUP	0,LKPBLK	;LOOK FOR FILE
	  JRST	EXSERR		;NOT THERE, TELL HIM
	CLOSE	0,CL.ACS	;CLOSE, DON'T COUNT AS ACCESS
	SETZM	@1(ARG)		;INDICATE GOODNESS
	POPJ	P,		;AND RETURN

EXSERR:	SETOM	@1(ARG)		;INDICATE BADNESS
	POPJ	P,		;AND RETURN

GETC:	SOJL	T5,CPOPJ	;IF RAN OUT OF DATA
	ILDB	T1,T4		;GET NEXT
	CAIG	T1,140		;CONVERT
	ADDI	T1,40		; TO
	ANDI	T1,77		; SIXBIT
	CAIE	T1,' '		; BLANK INDICATES END
	CAIN	T1,0		; AS DOES ZERO
	POPJ	P,		; 
	AOS	(P)		; ELSE RETURN
CPOPJ:	POPJ	P,		; THE CHARACTER

FNMPTR:	POINT	6,LKPFNM
EXTPTR:	POINT	6,LKPEXT

LKPBLK:
LKPFNM:	BLOCK	1
LKPEXT:	BLOCK	3

	END