Guardian Programmer's Guide

Table Of Contents
Writing a Command-Interpreter Monitor ($CMON)
Guardian Programmer’s Guide 421922-014
23 - 88
Sample Command-Interface Program
!------------------------------------------------------------
! Main procedure performs initialization, then goes into a
! loop in which it reads the $RECEIVE file and then calls the
! appropriate procedure depending on whether the message read
! was a system message, the message used was a user message,
! or the read generated an error.
!------------------------------------------------------------
PROC CONTROL^MAIN MAIN;
BEGIN
INT I;
STRING CMD;
! Open terminal and $CMON:
CALL INIT;
! Loop forever:
WHILE 1 DO
BEGIN
! Prompt user for function to perform:
CMD := GET^COMMAND;
! Select a procedure depending on value returned from
! GET^COMMAND:
CASE CMD OF
BEGIN
"1" -> CALL CHANGE^LOGON^MESSAGE;
"2" -> CALL CHANGE^LOGOFF^MESSAGE;
"3" -> CALL REJECT^REQUESTS;
"4" -> CALL ACCEPT^REQUESTS;
"5" -> CALL CHANGE^CPU^STATUS;
"x" -> CALL EXIT^PROGRAM;
OTHERWISE -> CALL INVALID^REQUEST;
END;
END;
END;