adelman@LBL-CSA2.ARPA (Kenneth Adelman) (08/07/87)
I've been using the trick of redirectly SYS$ANNOUNCE to
a mailbox with an attention AST for some time. Some comments:
1) Have your program set up an exit handler to restore the
logical SYS$ANNOUNCE to something NOT pointing at a mailbox.
Otherwise if the program dies no one can log in because LOGINOUT
blocks reading the mailbox.
2) Be aware that it is best to write everything to the mailbox in
one $QIO and include your own carriage-control. If there are two
simultaneous readers the output can become somewhat garbled. Even
using one $QIO to write the mailbox, the IO$_WRITEOF is not atomic
with the IO$_WRITEVBLK and it possible that one user gets the banner
displayed twice and the other gets none at all. (DEC; are you
listening? How about an IO$M_WRITEOF modifier for IO$_WRITEVBLK to
make this operation atmoic?).
Kenneth Adelman
LBLCHAA006@vaxb.rhbnc.ac.UK (08/08/87)
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