Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 76
Sample Command-Interface Program
!------------------------------------------------------------
! Procedure to generate an RT^logon^message. This procedure
! prompts the operator for the logon display text, creates
! the RT^logon^message and sends it to the $CMON process.
!------------------------------------------------------------
PROC CHANGE^LOGON^MESSAGE;
BEGIN
STRUCT .RT^LOGON^MESSAGE; !structure to send to $CMON
BEGIN
INT MSGCODE;
STRING DISPLAYTEXT[0:63];
END;
INT BYTES^READ;
! Set code for changing logon message in message data
! structure:
RT^LOGON^MESSAGE.MSGCODE := 50;
! Blank the display text buffer:
RT^LOGON^MESSAGE.DISPLAYTEXT[0] ':=' " ";
RT^LOGON^MESSAGE.DISPLAYTEXT[1] ':='
RT^LOGON^MESSAGE.DISPLAYTEXT[0] FOR 63;
! Prompt operator for new logon text:
SBUFFER ':=' "Enter logon message: " -> @S^PTR;
CALL WRITEREADX(TERMNUM,SBUFFER,@S^PTR '-' @SBUFFER,
BUFSIZE,BYTES^READ);
IF <> THEN CALL FILE^ERRORS(TERMNUM);
! Put new logon text in message structure:
RT^LOGON^MESSAGE.DISPLAYTEXT ':=' SBUFFER FOR BYTES^READ;
! Send message to $CMON:
CALL WRITEREADX(CMONNUM,RT^LOGON^MESSAGE,
$LEN(RT^LOGON^MESSAGE),2,BYTES^READ);
IF <> THEN CALL FILE^ERRORS(CMONNUM);
END;