Guardian Programmer's Guide

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