From:	CSBVAX::MRGATE!@KL.SRI.Com:CHAA006%vaxb.rhbnc.ac.uk@Cs.Ucl.AC.UK@SMTP  7-AUG-1987 05:43
To:	EVERHART
Subj:		Dynamic "Sys$Announce" (or Sys$Welcome) display.

Received: from Cs.Ucl.AC.UK (TUNNEL.CS.UCL.AC.UK.#Internet) by KL.SRI.COM with TCP; Thu 6 Aug 87 11:24:21-PDT
Received: from vaxb.rhbnc.ac.uk by nss.Cs.Ucl.AC.UK   via Janet with NIFTP
           id aa11501; 6 Aug 87 19:16 BST
Date:		 6-AUG-1987 19:16:07
From:		CHAA006%vaxb.rhbnc.ac.uk@Cs.Ucl.AC.UK
To:		INFO-VAX <@Cs.Ucl.AC.UK:INFO-VAX@kl.sri.com>
Subject:	Dynamic "Sys$Announce" (or Sys$Welcome) display.

There's been a lot of discussion recently concerning Sys$Announce and
Sys$Welcome, started (I think) by Zar's comment re. maximum text length.
I have been surprised that no-one has suggested the possibility of
having a dynamic Sys$xxx display, automatically generated whenever a
user logs-in. The following (Fortran) code provides that possibility. 
To use it, compile and link in the normal way, run it /detached (so that
it lurks somewhere in your system), and then re-define Sys$Announce as
follows :- 

    $ Define /System Sys$Announce "@''f$logical(""Sys$Announce_Mbx"")'"

Of course, you'll want to modify the actual text it produces.  ** Phil.

Philip Taylor (Royal Holloway & Bedford New College;  University of London; U.K)

       Janet	    :	chaa006@uk.ac.rhbnc.vaxa (or) chaa006@uk.ac.rhbnc.vaxb
			([+Janet.000005181000] or [+Janet.000005181100])

       Arpa	    :	chaa006%vaxa.rhbnc.ac.uk@cs.ucl.ac.uk
       (or) 	    :	chaa006%vaxb.rhbnc.ac.uk@cs.ucl.ac.uk

Bitnet/NetNorth/Earn:	chaa006@vaxa.rhbnc.ac.uk (or) chaa006%rhbnc.vaxa@ac.uk
       (or)	    :	chaa006@vaxb.rhbnc.ac.uk (or) chaa006%rhbnc.vaxb@ac.uk

============================== C U T   H E R E ==============================

	program sys$announce
C
C --- Creates & services a mailbox, defined as the translation of Sys$Announce
C
	implicit none
	integer * 2 channel
	integer sys$crembx, sys$hiber
	call function (
     &		sys$crembx 
     &			(%val (1), 
     &				channel, , , 
     &					%val ('1131'X), , 
     &						'SYS$ANNOUNCE_MBX'))
	call enable (channel)
	call function (sys$hiber ())
	end

	subroutine enable (channel)
C
C --- Enables routine AST to deal with ASTs on CHANNEL
C
	implicit none
	include '($iodef)'
	integer * 2 channel
	integer ast, sys$qiow
	external ast
	call function (sys$qiow
     &		(, %val (channel),%val (io$_setmode .or. io$m_readattn),
     &			, , , ast, channel, , , ,))
	return
	end
	
	subroutine ast (channel)
C
C --- Gets a few useful things, and writes them to the mailbox;
C --- also re-declares itself as AST handler
C
	implicit none
	include '($iodef)'
	include '($syidef)'
	integer * 2 channel
	integer max, n, lib$day_of_week
	integer sys$asctim, lib$getsyi, str$trim, sys$qiow
	character cr, lf
	character * 6 nodename	
	character * 23 datime
	character * 132 buffer
	character * (9) days (7)
	integer length
	data days /'Monday', 'Tuesday', 'Wednesday', 'Thursday',
     &			'Friday', 'Saturday', 'Sunday'/
	cr = char (13)
	lf = char (10)
	call function (lib$day_of_week (, n))
	call function (sys$asctim (, datime, , ))
	call function (lib$getsyi (syi$_nodename, ,nodename, length))
	write (buffer, 9000) nodename (1:length), 
     &			days (n), datime, cr, lf
	call function (str$trim (buffer, buffer, length))
	call function (sys$qiow
     &		(, %val (channel),%val (io$_writevblk),
     &			, , , %ref (buffer), %val (length) , , , ,))
	call function (sys$qiow
     &		(, %val (channel),%val (io$_writeof .or. io$m_now),
     &			, , , , , , , ,))
	call enable (channel)
	return
C
C --- Change the following line as necessary !!! SYSDEP !!!
C
 9000	format ('	RHBNC VAX-Cluster on node ', 
     &			A, ' at ', A, X, A, A, A)
	end

	subroutine function (status)
C
C --- Signals errors if they occur
C
	implicit none
	integer status
	if (.not. status) call lib$signal (%val (status))
	return
	end	
