; ; NAME: BRDCST ; ; FUNCTION: This program is used to "broadcast" a message to every ; terminal on the system. The restraints it uses in terminal ; selection are: 1) the terminal must be attached to a job, and ; 2) it must not be a PSEUDO terminal. The actual sending is done ; by opening the terminal as a file using the TRM: driver. ; ; AUTHOR: Tom Dahlquist ; ; HISTORY: ;VERS DATE WHO SUBSTANCE ;[1.0] 09/19/83 TAD Written. ; 07/16/84 TAD Was moving a blank into low memory, causing random ; failures. ; 06/85 John Baima ; Eisenbrauns ; PO Box 275 ; Winona Lake, IN 46590 ; Don't send messages to jobs running LPTSPL--they are printers. ;[1.1] 03/85/86 DFP Make BRDCST reentrant. (UltraSoft - ULTR/AM). ;[1.2] 05/05/86 DAE Ignore FLIP terminals for AlphaBase systems. SEARCH SYS SEARCH SYSSYM VMAJOR=1 VMINOR=2 ;[1.2] .OFINI .OFDEF DDB,D.DDB ; DDB for output to terminals [1.1] .OFDEF JOB,8. ; job work area [1.1] .OFSIZ CLRLEN ; size of impure area [1.1] BRDCST: PHDR -2,PV$RSM,PH$REU!PH$REE ; program header [1.1] LIN ; anything to send? JEQ EXIT ; leave if not... ;[1.1] LEA A4,DDB ; let A4 -> to DDB throughout... ;[1.1] CLEAR @A4,CLRLEN ; clear it, GETIMP CLRLEN,A4 ; Allocate local work memory [1.1] MOVW #[TRM],D.DEV(A4) ; move in device name, INIT @A4 ; and initialize. JOBIDX A0 ; A0 -> out JCB... LEA A1,JOBNAM(A0) ; A1 -> job name field... PUSH A2 ; save A2... ;[1.1] LEA A2,JOB ; A2 -> job name work area... LEA A2,JOB(A4) ; A2 -> job name work area... [1.1] UNPACK ; unpack name into work area... UNPACK MOVB #' ,@A2 POP A2 MOV JOBTBL,A0 ; -> first JCB pointer... LOOP: MOV (A0)+,D7 ; -> JCB... BEQ LOOP ; if not allocated... CMP D7,#-1 ; test for end of table... JEQ EXIT ; leave if so... MOV D7,A1 CMM JOBPRG(A1),#[LPT]_16.+[SPL] ; JKB-Running Spooler BEQ LOOP ; br if this is a printer MOV JOBTRM(A1),D7 ; D7 -> TCB... BEQ LOOP ; br if no terminal... MOV D7,A5 ; A5 -> TCB... MOV 2(A5),A3 ; A3 -> interface driver... SUB #4,A3 ; A3 -> I.D. name... CMM @A3,#[PSE]_16.+[UDO] ; PSEUDO? [1.2] BEQ LOOP ; br if so... CMM @A3,#[FLP]_16.+[IDV] ; or FLIP [1.2] BEQ LOOP ; If so, ignore. [1.2] MOV -4(A5),D.FIL(A4) ; move in terminal name... OPENO @A4 ; open for output MOVB #';,D1 ; make it look like SEND... FILOTB @A4 ;[1.1] LEA A1,JOB ; A1 -> job name work area... LEA A1,JOB(A4) ; A1 -> job name work area... [1.1] NLOOP: MOVB (A1)+,D1 FILOTB @A4 CMPB D1,#' BNE NLOOP MOVB #'-,D1 FILOTB @A4 MOVB #' ,D1 FILOTB @A4 PUSH A2 ; save -> text line... OLOOP: MOVB (A2)+,D1 ; get next byte of text and FILOTB @A4 ; output... LIN ; end of input line? BNE OLOOP ; br if not, else POP A2 ; restore A2 and MOVB #7,D1 FILOTB @A4 ; give him a BELL and MOVB #15,D1 ; a CR and a LF. FILOTB @A4 MOVB #12,D1 FILOTB @A4 CLOSE @A4 ; close output file. JMP LOOP ; and back. EXIT: EXIT END