Guardian Programmer's Guide

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