Envoy Application Programming Manual

Table Of Contents
BISYNC Centralized Multipoint Supervisor Protocol
Envoy Application Programming Manual427159-001
4-51
Programming Examples
Example 4-20. Program Code for Poll and Select Procedures (Page 3 of 7)
! This procedure checks the home terminal for a completion.
! The following values are returned:
!
! 0 = no completion.
! 1 = completion.
! 2 = end of file.
! 3 = recoverable error occurred.
! 4 = nonrecoverable error occurred.
INT PROC check^term;
BEGIN
INT error;
CALL AWAITIO (termfnum,,termlen,,0D);
! check for completion.
IF = THEN RETURN 1; ! completion.
IF > THEN RETURN 2; ! end of file.
! else error.
CALL FILEINFO (termfnum,error);
IF error = 40 THEN RETURN 0; ! no
! completion.
RETURN IF FILEERROR (termfnum) THEN 3 ! retry.
ELSE 4; ! fatal error.
END; ! check^term.
! This procedure writes the incoming message on the home
! terminal. The message is displayed in the following form:
!
! FROM <s>: <text>
PROC write^term (source, array, length);
INT source, length;
STRING .array;
BEGIN
INT done,
.buf[0:66];
STRING .s,
.sbuf := @buf '<<' 1;