HPlogo HP-UX Reference Volume 4 of 5 > t

t_error(3)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

t_error() — produce error message

SYNOPSIS

#include <xti.h> /* for X/OPEN Transport Interface - XTI */ /* or */ #include <tiuser.h> /* for Transport Layer Interface - TLI */ void t_error (errmsg); char *errmsg; extern int t_errno; extern char *t_errlist[]; extern int t_nerr;

DESCRIPTION

The t_error() function 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 be errmsg is not the null character, the string pointed to by errmsg is written followed by a colon and a space.

  • Then a standard error message string for the current error defined in t_errno is written. 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.

The language for error message strings written by t_error() 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 <xti.h>. The contents of the error message strings describing the value in errno are the same as those returned by the strerror() function with an argument of errno.

To simplify variant formatting of messages, the array of message strings t_errlist is provided; t_errno can be used as an index in this table to get the message string without the newline. The variable t_nerr is the largest message number provided for in the t_errlist table.

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

Thread-Safeness

The t_error() function is safe to be called by multithreaded applications, and it is thread-safe for both POSIX Threads and DCE User Threads. It has a cancellation point. It is neither async-cancel safe nor async-signal safe. Finally, it is not fork-safe.

Valid States

All - apart from T_UNINIT

RETURN VALUE

For XTI, upon completion, a value of 0 is returned. TLI does not return a value.

ERRORS

No errors are defined for the t_error() function.

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 printer would look like:

t_connect failed on fd2: Incorrect address format

where Incorrect address format identifies the specific error that occurred, and t_connect failed on fd2 tells the user which function failed on which transport endpoint.

FILES

/usr/lib/nls/msg/C/libnsl_s.cat

NLS message catalog for TLI

STANDARDS CONFORMANCE

t_error(): SVID2, XPG3, XPG4

© Hewlett-Packard Development Company, L.P.