All functions return -1 if an error occurs. Typically, the functions
will return 0 on success, but the data exchange functions
(cs_get
, cs_put
,
cs_more
) follow special rules. Consult their
descriptions.
When a function (including the data exchange functions) reports an
error condition, use the function
cs_errno()
to determine the cause of the
problem. The function
void cs_perror(COMSTACK handle char *message);
works like perror(2)
and prints the
message argument, along with a system message, to
stderr. Use the character array
extern const char *cs_errlist[];
to get hold of the message, if you want to process it differently. The function
const char *cs_stackerr(COMSTACK handle);
Returns an error message from the lower layer, if one has been provided.