Google
 

Trailing-Edge - PDP-10 Archives - custsupcuspmar86_bb-x130b-sb - exist.mac
There are 5 other files named exist.mac in the archive. Click here to see a list.
00100		TITLE	EXIST
00200	
00300	T1=1
00400	T2=2
00500	T3=3
00600	T4=4
00700	T5=5
00800	ARG=16
00900	P=17
01000	CL.ACS==1B32	;INHIBIT UPDATING ACCESS DATE
01100	
01200	EXIST::	MOVEI	T4,@0(ARG)	;POINT TO FILENAME
01300		MOVEI	T5,^D10		;MAX LENGTH
01400		HRLI	T4,(POINT 7,)	;MAKE BYTE POINTER
01500		MOVEI	T2,6		;MAX LENGTH OF FILE NAME
01600		MOVE	T3,FNMPTR	;POINTER TO NAME IN LKP BLOCK
01700	LOOP:	PUSHJ	P,GETC		;GET USER ARGUEMENT CHARACTER
01800		  JRST	EXSTST		;END OF STRING
01900		CAIN	T1,'.'		;LOOK FOR START OF EXTENSION
02000		JRST	EXSDOT		;YES, GO HANDLE
02100		IDPB	T1,T3		;STORE FILE NAME CHARACTER
02200		SOJG	T2,LOOP		;LOOP OVER WHOLE NAME
02300	EXSLOK:	PUSHJ	P,GETC		;END OF NAME, SCAN FOR DOT OR END
02400		  JRST	EXSTST		;DONE, GO TEST FOR FILE
02500		CAIN	T1,'.'		;FOUND DOT?
02600		JRST	EXSDOT		;GET EXTENSION
02700		JRST	EXSLOK		;KEEP SCANNING
02800	
02900	EXSDOT:	MOVEI	T2,3		;MAXIMUM LENGTH OF EXTENSION
03000		MOVE	T3,EXTPTR	;POINT TO EXTENSION IN LKP BLOCK
03100	EXSDO1:	PUSHJ	P,GETC		;GET A CHARACTER
03200		  JRST	EXSTST		;END OF INPUT STRING
03300		IDPB	T1,T3		;SAVE EXTENSION CHARACTER
03400		SOJG	T2,EXSDO1	;LOOP OVER WHOLE NAME
03500	EXSTST:	MOVEI	T1,17		;MODE
03600		MOVSI	T2,'DSK'	;DEVICE
03700		SETZ	T3,		;NO BUFFERS
03800		OPEN	0,T1		;OPEN DSK
03900		  JRST	EXSERR		;CAN'T, QUIT
04000		SETZM	LKPBLK+2	;CLEAR LOOKUP PPN 
04100		SETZM	LKPBLK+3	;AND DATE
04200		LOOKUP	0,LKPBLK	;LOOK FOR FILE
04300		  JRST	EXSERR		;NOT THERE, TELL HIM
04400		CLOSE	0,CL.ACS	;CLOSE, DON'T COUNT AS ACCESS
04500		SETZM	@1(ARG)		;INDICATE GOODNESS
04600		POPJ	P,		;AND RETURN
04700	
04800	EXSERR:	SETOM	@1(ARG)		;INDICATE BADNESS
04900		POPJ	P,		;AND RETURN
05000	
05100	GETC:	SOJL	T5,CPOPJ	;IF RAN OUT OF DATA
05200		ILDB	T1,T4		;GET NEXT
05300		CAIG	T1,140		;CONVERT
05400		ADDI	T1,40		; TO
05500		ANDI	T1,77		; SIXBIT
05600		CAIE	T1,' '		; BLANK INDICATES END
05700		CAIN	T1,0		; AS DOES ZERO
05800		POPJ	P,		; 
05900		AOS	(P)		; ELSE RETURN
06000	CPOPJ:	POPJ	P,		; THE CHARACTER
06100	
06200	FNMPTR:	POINT	6,LKPFNM
06300	EXTPTR:	POINT	6,LKPEXT
06400	
06500	LKPBLK:
06600	LKPFNM:	BLOCK	1
06700	LKPEXT:	BLOCK	3
06800	
06900		END