t_error() — Produce error message

Standards

Standards / Extensions C or C++ Dependencies
XPG4.2 both  

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>

int t_error(char *errmsg);

General description

Produces a language-dependent message on the standard error output which describes the last error encountered during a call to a transport function. The argument string errmsg is a user-supplied error message that gives context to the error.

The error message is written as follows: first (if errmsg is not a NULL pointer and the character pointed to by errmsg is not the NULL character) the string pointed to by errmsg followed by a colon and a space; then a standard error message string for the current error defined in t_errno. If t_errno has a value different from TSYSERR, the standard error message string is followed by a newline character. If, however, t_errno is equal to TSYSERR, the t_errno string is followed by the standard error message string for the current error defined in errno followed by a newline.

If the calling program is running in any one of the SAA, S370, C or POSIX locales, the error message string describing the value in t_errno is identical to the comments following the t_errno codes defined in xti.h. It is noteworthy that message numbers are not produced in this situation. The contents of the error message strings describing the value in errno are the same as those returned by the strerror(3C) function with an argument of errno.

The error number, t_errno, is only set when an error occurs and it is not cleared on successful calls.

Valid states: All - except for T_UNINIT

Returned value

No errors are defined for t_error().

Example

If a t_connect() function fails on transport endpoint fd2 because a bad address was given, the following call might follow the failure:
        t_error("t_connect failed on fd2");
The diagnostic message to be printed would look like:
        t_connect failed on fd2: incorrect addr format
where incorrect addr format identifies the specific error that occurred, and t_connect failed on fd2 tells the user which function failed on which transport endpoint.

Related information