Manual Pages for UNIX Darwin command on man perror
MyWebUniversity

Manual Pages for UNIX Darwin command on man perror

STRERROR(3) BSD Library Functions Manual STRERROR(3)

NAME

ppeerrrroorr, ssttrreerrrroorr, ssttrreerrrroorrrr, ssyysseerrrrlliisstt, ssyyssnneerrrr - system error mes-

sages LLIIBBRRAARRYY

Standard C Library (libc, -lc)

SYNOPSIS

##iinncclluuddee <>

void ppeerrrroorr(const char *string); extern const char * const syserrlist[]; extern const int sysnerr;

##iinncclluuddee <>

char * ssttrreerrrroorr(int errnum); int ssttrreerrrroorrrr(int errnum, char *strerrbuf, sizet buflen);

DESCRIPTION

The ssttrreerrrroorr(), ssttrreerrrroorrrr() and ppeerrrroorr() functions look up the error message string corresponding to an error number. The ssttrreerrrroorr() function accepts an error number argument errnum and returns a pointer to the corresponding message string. The ssttrreerrrroorrrr() function renders the same result into strerrbuf for a maximum of buflen characters and returns 0 upon success.

The ppeerrrroorr() function finds the error message corresponding to the cur-

rent value of the global variable errno (intro(2)) and writes it, fol-

lowed by a newline, to the standard error file descriptor. If the argu-

ment string is non-NULL and does not point to the null character, this

string is prepended to the message string and separated from it by a colon and space (``: ''); otherwise, only the error message string is printed. If the error number is not recognized, these functions return an error

message string containing ``Unknown error: '' followed by the error num-

ber in decimal. The ssttrreerrrroorr() and ssttrreerrrroorrrr() functions return EINVAL as a warning. Error numbers recognized by this implementation fall in the range 0 < errnum < sysnerr. If insufficient storage is provided in strerrbuf (as specified in buflen) to contain the error string, ssttrreerrrroorrrr() returns ERANGE and strerrbuf will contain an error message that has been truncated and NUL terminated to fit the length specified by buflen. The message strings can be accessed directly using the external array

syserrlist. The external value sysnerr contains a count of the mes-

sages in syserrlist. The use of these variables is deprecated; ssttrreerrrroorr() or ssttrreerrrroorrrr() should be used instead.

SEE ALSO

intro(2), psignal(3) STANDARDS The ppeerrrroorr() and ssttrreerrrroorr() functions conform to ISO/IEC 9899:1999 (``ISO C99''). The ssttrreerrrroorrrr() function conforms to IEEE Std

1003.1-2001 (``POSIX.1'').

HISTORY The ssttrreerrrroorr() and ppeerrrroorr() functions first appeared in 4.4BSD. The ssttrreerrrroorrrr() function was implemented in FreeBSD 4.4 by Wes Peters .

BUGS

For unknown error numbers, the ssttrreerrrroorr() function will return its result in a static buffer which may be overwritten by subsequent calls.

The return type for ssttrreerrrroorr() is missing a type-qualifier; it should

actually be const char *.

Programs that use the deprecated syserrlist variable often fail to com-

pile because they declare it inconsistently. BSD October 12, 2004 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™