[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


t_error Subroutine for X/Open Transport Interface

Purpose

Produce error message.

Library

X/Open Transport Interface Library (libxti.a)

Syntax

#include <xti.h>
 
int t_error (
    const char *errmsg)

Description

The t_error subroutine produces a language-dependent message on the standard error output which describes the last error encountered during a call to a transport subroutine.

If the errmsg parameter is not a null pointer and the character pointed to be the errmsg parameter is not the null character, the error message is written as follows: the string pointed to by the errmsg parameter followed by a colon and a space and 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 the errno global variable followed by a newline.

The language for error message strings written by the t_error subroutine is implementation-defined. If it is in English, the error message string describing the value in t_errno is identical to the comments following the t_errno codes defined in the xti.h header file. The contents of the error message strings describing the value in the errno global variable are the same as those returned by the strerror subroutine with an parameter of errno.

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

Parameter


errmsg Specifies a user-supplied error message that gives the context to the error.

Valid States

ALL - apart from T_UNINIT.

Return Values

Upon completion, a value of 0 is returned.

Errors Codes

No errors are defined for the t_error subroutine.

Examples

If a t_connect subroutine 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

The strerror subroutine, t_connect subroutine.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]