t_error Subroutine for Transport Layer Interface

Purpose

Produces an error message.

Library

Transport Layer Interface Library (libtli.a)

Syntax

#include <tiuser.h>

void t_error(errmsg)
char * errmsg;
extern int  t_errno;
extern char *t_errno;
extern int  t_nerr;

Description

The t_error subroutine produces a message on the standard error output that describes the last error encountered during a call to a transport function.

The t_error subroutine prints the user-supplied error message, followed by a colon and the standard transport-function error message for the current value contained in the t_errno variable.

Parameter

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

External Variables

Item Description
t_errno Specifies which standard transport-function error message to print. If the value of the t_errno variable is TSYSERR, the t_error subroutine also prints the standard error message for the current value contained in the errno global variable.

The t_errno variable is set when an error occurs and is not cleared on subsequent successful calls.

t_nerr Specifies the maximum index value for the t_errlist array. The t_errlist array is the array of message strings allowing user-message formatting. The t_errno variable can be used as an index into this array to retrieve the error message string (without a terminating new-line character).

Examples

A t_connect subroutine is unsuccessful on transport end point fd2 because a bad address was given, and the following call follows the failure:

t_error("t_connect failed on fd2")

The diagnostic message would print as:

t_connect failed on fd2: Incorrect transport address format

In this example, t_connect failed on fd2 tells the user which function was unsuccessful on which transport end point, and Incorrect transport address format identifies the specific error that occurred.