CS-Library message callback
example
/*
** cslib_err_handler() - CS-Library error handler.
**
** This routine is the CS-Library error handler used by this
** application. It is called by CS-Library whenever an error
** occurs. Here, we simply print the error and return.
**
** Parameters:
** context
** A pointer to the context handle for context
** on which the error occurred.
** error_msg
** The structure containing information about the
** error.
**
** Returns:
** CS_SUCCEED
*/
CS_RETCODE CS_PUBLIC cslib_err_handler(context, errmsg)
CS_CONTEXT *context;
CS_CLIENTMSG *errmsg;
{
/*
** Print the error details.
*/
fprintf(stdout, "CS-Library error: “);
fprintf(stdout, “LAYER = (%ld) ORIGIN = (%ld) ",
CS_LAYER(errmsg->msgnumber),
CS_ORIGIN(errmsg->msgnumber) );
fprintf(stdout, "SEVERITY = (%ld) NUMBER = (%ld)\n",
CS_SEVERITY(errmsg->msgnumber),
CS_NUMBER(errmsg->msgnumber) );
fprintf(stdout, "\t%s\n", errmsg->msgstring);
/*
** Print any operating system error information.
*/
if( errmsg->osstringlen > 0 )
{
fprintf(stdout, "CS-Library OS error %ld - %s.\n",
errmsg->osnumber, errmsg->osstring);
}
/*
** All done.
*/
return (CS_SUCCEED);
}