Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 51
Sample $CMON Program
!------------------------------------------------------------
! Procedure to process a Remotepassword^msg message. This
! request is always accepted, except during the shutdown
! phase.
!------------------------------------------------------------
PROC PROCESS^REMOTEPASSWORD^MSG;
BEGIN
STRUCT MSG(*); !template for
BEGIN ! Remotepassword^msg message
INT MSGCODE;
INT USERID;
INT CIPRI;
INT CIINFILE[0:11];
INT CIOUTFILE[0:11];
INT SYSNAME[0:3];
END;
INT .EXT REMOTEPASSWORD^MSG(MSG) :=
$XADR(BUFFER); !structure pointer to I/O
! buffer
STRUCT .REMOTEPASSWORD^REPLY; !structure for reply
BEGIN
INT REPLYCODE;
STRING REPLYTEXT[0:63];
END;
! Blank the reply text:
REMOTEPASSWORD^REPLY.REPLYTEXT[0] ':=' " ";
REMOTEPASSWORD^REPLY.REPLYTEXT[1] ':='
REMOTEPASSWORD^REPLY.REPLYTEXT[0] FOR 63;
! Extract the group ID of the requesting TACL process:
REQUESTING^GROUPID := REMOTEPASSWORD^MSG.USERID.<0:7>;
! If shutting the system down, allow requests only from the
! operator group:
IF REFUSE^ALL AND (REQUESTING^GROUPID <> 255) THEN
BEGIN
REMOTEPASSWORD^REPLY.REPLYCODE := 1;
REMOTEPASSWORD^REPLY.REPLYTEXT ':='
SHUTDOWN^TEXT FOR 64;
END