Server message callback example

Following is an example of a server message callback:

          /*
           ** ex_servermsg_cb()
           **
           ** Type of function:
           **      Example program server message handler
           **
           ** Purpose:
           **      Installed as a callback into Open Client.
           ** 
           ** Returns:
           **      CS_SUCCEED
           **
           ** Side Effects:
           **      None
           */
           CS_RETCODE CS_PUBLIC
           ex_servermsg_cb(context, connection, srvmsg)
           CS_CONTEXT        *connection;
           CS_CONNECTION     *cmd;
           CS_SERVERMSG      *srvmsg;
           {
                fprintf(EX_ERROR_OUT, "\nServer message:\n");
                fprintf(EX_ERROR_OUT, "Message number: %ld, \ 
                     Severity %ld, ", srvmsg->msgnumber, 
                     srvmsg->severity);
                fprintf(EX_ERROR_OUT, "State %ld, Line %ld",
                     srvmsg->state, srvmsg->line);
               if (srvmsg->svrnlen > 0)
                {
                     fprintf(EX_ERROR_OUT, "\nServer '%s'", 
                          srvmsg->svrname);
                }
               if (srvmsg->proclen > 0)
                {
                     fprintf(EX_ERROR_OUT, " Procedure '%s'", 
                          srvmsg->proc);
                }
               fprintf(EX_ERROR_OUT, "\nMessage String: %s",
                     srvmsg->text);
               return CS_SUCCEED;
           }