Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strerror_r(3c) [hpux man page]

perror(3C)																perror(3C)

NAME
perror(), strerror(), strerror_r() - write system error messages SYNOPSIS
DESCRIPTION
writes a language-dependent message to the standard error output, describing the last error encountered during a call to a system or library function. The argument string s is printed first, followed by a colon, a blank, the message, and a newline character. To be most useful, the argument string should include the name of the program that incurred the error. The error number is taken from the symbol which is set when errors occur but not cleared when non-erroneous calls are made. The contents of the message is identical to those returned by the function with as the argument. If given a NULL string, the function prints only the message and a newline character. To simplify variant formatting of messages, the function and the array of message strings are provided. The function maps the error number in errnum to a language-dependent error message string and returns a pointer to the string. The message string is returned without a new- line character. can be used as an index into to get an untranslated message string without the newline character. is the largest message number provided for in the table; it should be checked because new error codes might be added to the system before they are added to the table. must be used to retrieve messages when translations are desired. The function maps the error number in errnum to a locale-dependent error message string and returns the string in the buffer pointed to by buffer, which has length buflen. EXTERNAL INFLUENCES
Environment Variables The language of the message returned by and printed by is specified by the environment variable. If the language-dependent message is not available, or if is not set or is set to the empty string, the default version of the message associated with the "C" language (see lang(5)) is used. International Code Set Support Single and multi-byte character code sets are supported. RETURN VALUE
returns no value. If the errnum message number is valid, returns a pointer to a language-dependent message string. The array pointed to should not be modi- fied by the program, and might be overwritten by a subsequent call to the function. If a valid errnum message number does not have a cor- responding language-dependent message, uses errnum as an index into to get the message string. If the errnum message number is invalid, returns a pointer to a NULL string. Upon successful completion, returns 0. Otherwise, an error number is returned to indicate the error. ERRORS
If the function fails, it will return one of the following errors: The value of errnum is not a valid error number. Insufficient storage was supplied via buffer and buflen to contain the generated message string. WARNINGS
The return value for points to data whose content is overwritten by subsequent calls to from the same thread. SEE ALSO
errno(2), lang(5), environ(5), thread_safety(5). STANDARDS CONFORMANCE
perror(3C)

Check Out this Related Man Page

strerror(3C)															      strerror(3C)

NAME
strerror, strerror_r - get error message string SYNOPSIS
#include <string.h> char *strerror(int errnum); int strerror_r(int errnum, char *strerrbuf, size_t buflen); The strerror() function maps the error number in errnum to an error message string, and returns a pointer to that string. It uses the same set of error messages as perror(3C). The returned string should not be overwritten. The strerror_r() function maps the error number in errnum to anerror message string and returns the string in the buffer pointed to by str- errbuf with length buflen. Upon successful completion, strerror() returns a pointer to the generated message string. Otherwise, it sets errno and returns a pointer to an error message string. It returns the string "Unknown error" if errnum is not a valid error number. Upon successful completion, strerror_r() returns 0. Otherwise it sets errno and returns the value of errno to indicate the error. It returns the string "Unknown error" in the buffer pointed to by strerrbuf if errnum is not a valid error number. These functions may fail if: EINVAL The value of errnum is not a valid error number. The strerror_r() function may fail if: ERANGE The buflen argument specifies insufficient storage to contain the generated message string. Messages returned from these functions are in the native language specified by the LC_MESSAGES locale category. See setlocale(3C). See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ gettext(3C), perror(3C), setlocale(3C), attributes(5), standards(5) 31 Mar 2005 strerror(3C)
Man Page