ACC Programmer's Reference Guide

Chapter 4 273
ZCOM C I/F Library Routines
ZREAD (3X)
RETURN VALUE Routine zread returns 0 if the call is successful. In addition, for a
response message, a non-zero return status rstat indicates there was a
problem with the previous zsend(3X) call. A non-zero return status with
a terminal message or response indicates there was a problem with the
terminal. For other message types, the return status is always 0.
If the zread call itself failed, a non-zero error code is returned, and the
other return parameters do not contain valid values. See
/opt/acc/include/zcom/zcomsys.h forthelistofZCOMerrorcodesand
their meanings.
EXAMPLE
#include <zcom/zcomsys.h>
#include <zcom/zcomcall.h>
int32 ierr;
zaddr_type zaddr;
uint32 mode;
zmhd_type zmhd;
char ibuf[size]; /* where size is user-determined; must be >= len */
int32 len;
int32 rlen;
int32 rstat;
if (ierr = zread(&zaddr, mode, &zmhd, ibuf, len, &rlen, &rstat)) {
/* error return code */
}
else {
/* good return code */
}
NOTE Check zmhd.mid.mstype todeterminethemessagetype.Forresponseor
terminal messages, check for non-zero rstat to see if there was any
problem with the previous zsend(3X) or with the terminal.