[mod.computers.vax] Problems with broadcast trapping

mark@NTSC-74.ARPA ("Mark Layton") (11/06/86)

   I've finally given up trying to find an answer to this problem on
my own. I got tired of having my edit sessions interrupted by users
sending messages to my terminal (via a program installed with privilege
to broadcast to other terminals). So I wrote a program , largely lifted
from the FORTRAN programmer's reference manual, to trap these messages
and log them to a file. I $SPAWNED a subprocess in my login.com file
to run this program. So far, so good. It worked just fine. However, some
very strange side effects have resulted. If I do a HELP command which
requires more than one screen to display (FORTRAN for example) HELP
prints the message "Press return to continue". When I do, I get the
fatal error message "%RMS-F-USZ, invalid user buffer size" . Also, If
I attempt to spawn a subprocess, I get the message "%DCL-E-TRMMBX, terminal
has associated mailbox - terminate image and then spawn".  And finally,
when I try a SET HOST, I get the message "%SYSTEM-F-DEVACTIVE, device is
active". If I stop the process which is running the broadcast trapper,
everything returns to normal.

As far as I can determine, this is all the fault of the SMG routine
SMG$SET_BROADCAST_TRAPPING. If I remove the call to this routine from my 
program, everything is fine. Of course,  then there's no point to having
the program. My guess is that SMG$SET_BROADCAST_TRAPPING somehow sets up a 
mailbox which is attached to the terminal and that VMS uses SYS$BRDCST to
do lots of stuff which expects to be going to a terminal, not a mailbox.
Hence the problems. I'm running on a VAX-11/785 under VMS 4.2. I talked
to three VMS developers about this at the Spring DECUS in Dallas and they
just pointed fingers at each other (RMS -->  RTL,  EXECUTIVE <-- RTL, etc. ).

Any help will be greatly appreciated. Thanks in advance.

Mark Layton
Computer Scientist
Naval Training Systems Center
Code 741
Orlando, FL 32792
Phone: 305-646-4491
Autovon: 791-4491
ARPA: mark@ntsc-74

P.S. For the heck of it, I'm including my program below.

	implicit none
	integer*4 status,
	2	pbid,
	2	smg$create_pasteboard,
	2	smg$set_broadcast_trapping,
	2	sys$hiber

	common /id/ pbid
	external brkthru_routine

	status=smg$create_pasteboard(pbid,,,,1)
	if (.not. status) call lib$signal(%val(status))

	status= smg$set_broadcast_trapping(pbid,brkthru_routine)
	if (.not. status) call lib$signal(%val(status))

	status=sys$hiber()
	call exit
	end

	subroutine brkthru_routine()
	implicit none
	integer*4 status,pbid,smg$get_broadcast_message
	character*256 message
	integer*2 message_size

	common /id/ pbid

	status=smg$get_broadcast_message(pbid, message, message_size)
	if(.not. status) call lib$signal(%val(status))

	if( index(message,char(13)//char(10)) .ne. 0 ) then

20	   open(unit=2,file='send.log',status='unknown',access='append',
	1       recl=256,err=20)
           write(2,'(1x,a/)') message(1:message_size)
	   close(2)
	end if
	end
------
------