[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TOPS-20 file server

At SPAR we often want to do something to the 20 that isn't as drastic as
taking the system down, but still the users who are using the 20 as their file
server should know about it.  So I've piggybacked a routine to notify lispm
users of any random fact onto the downtime-checker.  It checks for the
existance of a file SYSTEM:LISPM-NOTICE.TXT on the 20, and if this file exists
and is less than a day old, its contents (truncated to one packet if
necessary) are shipped to the LISPM as a notification.  If a new version of
the file is written it will be noticed.  While doing this, I also fixed a bug
in the routine that outputs a string to the control connection.

						Judy Anderson

The code, which goes in FILE.MID, and I don't know how long out of date our
version is, or your version might be, so you'll have to worry about debugging
it, is as follows:

>>At COMST1+8, change the instruction CAIE A,12 into CAIE BYTE,12 to fix
>>long-standing error where it did not translate CRLF into <newline>.

>>These two go in random impure storage, I put them after DWNTIM:
FILTIM:	BLOCK 1			;This is the time the file SYSTEM:LISPM-NOTICE.TXT was written
FILFIL:	BLOCK %CPMXC/5		;This is the string that we will report to the user from that file

>>At DWNCHK: insert
	PUSHJ P,FILDWN		;Call special routine to check for broadcast message to LISPMs

>>Somewhere random after the end of DWNCHK (maybe before SETTIM:)
>>put the following block of code:

;;This routine checks for the existance of a file SYSTEM:LISPM-NOTICE.TXT, reports its contents
;;to the user.  Note that this message must fit inside a packet, which is 488. (%CPMXC) chars.
FILDWN: MOVSI 1,(GJ%SHT\GJ%OLD)	;short form, existing file
	 ERJMP [POPJ P,]	;No such file or other error, give up.
	PUSH P,1		;Save JFN on top of stack for later
	MOVE 2,[1,,.FBCRE]	;One word from the FDB, write date
	MOVEI 3,3		;Store info in AC3, clobbering this datum
	 ERJMP FILQIT		;Give up on error
	CAMN 3,FILTIM		;Check if same as last time we did this
	 JRST FILQIT		;Yup, he's seen this
	MOVEM 3,FILTIM		;Nope, let's do our stuff
	GTAD			;Now get current time
	SUB 1,FILTIM		;Subtract file time from current time
	HLLZS 1			;Flush right half of time-difference
	SKIPE 1			;If LH zero, less than a day old
	 JRST FILQIT		;Older, forget it.
	MOVE 1,(P)		;Younger, get back JFN.
	MOVE 2,[070000,,OF%RD]	;Read 7-bit-bytes from file
	 ERJMP FILQIT		;Ignore errors
	HRROI 2,FILFIL		;Pointer to file buffer
	MOVNI 3,%CPMXC-50	;Max number of characters in a packet (minus fudge)
	ERJMP .+1		;Ignore errors here, just EOF.
	SETZ 3,			;make sure terminated with 0 byte
	IDPB 3,2		;Into byte pointer returned by SIN
	CLOSF			;close file (jfn still in 1)
	 ERJMP FILQIT		;give up if failure
	PUSHJ P,DWNIN1		;Set up to return notification
	HRROI A,FILFIL		;Where COMSTO should find text
	PUSHJ P,COMSTO		;string out to LISPM ctrl conn.
	MOVEI T,CO%NOT		;as notification
FILQIT:	POP P,			;Pop JFN off stack
	POPJ P,			;And return from FILDWN