8. Diagnostics
Prev | Chapter 9. The COMSTACK Module | Next

## 8. Diagnostics

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.

Prev | Up | Next
7. SSL | Home | 9. Summary and Synopsis