QP_error_message()

Synopsis

     #include <quintus/quintus.h>
     
     int QP_error_message(errno, is_qp_error, error_string)
     int    errno;
     int   *is_qp_error;
     char **error_string;
     

Arguments

errno
the error number in question
is_qp_error
set to:

0
if it is not an error number created by Quintus.
1
if it is an error number created by Quintus.

error_string
the text of the error message.

Description

This function supplies the text corresponding to the error number errno. The output parameter is_qp_error can be used to determine if the error number was one created by Quintus or is a system error number.

Typically, the error number of interest is the one in the global variable QP_errno. This variable is discussed in the man pages for QP_perror().

Return Value

QP_SUCCESS

Examples

The following fragment takes the status value returned by some function that returns C calling Prolog style status values and prints out the corresponding error.

     #include <quintus/quintus.h>
         ...
     int is_qp_error;
     char *error_message;
         ...
     status = some_function();
     switch(status) {
     case QP_ERROR:
         (void) QP_error_message(QP_errno, &is_qp_error,
             &error_message);
         if(is_qp_error)
             (void) QP_fputs("prolog error: ", QP_stderr);
         else (void) QP_fputs("UNIX error: ", QP_stderr);
         (void) QP_fputs(error_message, QP_stderr);
         (void) QP_fnewln(QP_stderr);
         ...
     

See Also

QP_perror()