PERROR(3C) SysV PERROR(3C)
NAME
perror, strerror, errno, sys_errlist, sys_nerr - system error messages
SYNOPSIS
#include <stdio.h>
void perror(s)
const char *s;
#include <string.h>
char *strerror(errnum)
int errnum;
extern int errno;
extern char *sys_errlist[ ];
extern int sys_nerr;
DESCRIPTION
The perror function generates a short error message on the standard error
file, describing the error encountered by a C program during its most
recent call to the system. If s is not null, and does not point to the
null character, perror prints s, followed by a colon and a blank. The
error message, terminated with a newline, is then printed, regardless of
the value of s. To be of most use, s should include the name of the
program that incurred the error.
The error message is selected from sys_errlist, using the value of the
external variable errno, which is set when errors occur but not cleared
by successful calls.
To simplify creation of variant formats, the vector of message strings
sys_errlist is provided. sys_nerr is the number of messages provided for
in the table. If errnum is less than sys_nerr, strerror returns an
address from sys_errlist pointing to a message string without the
newline. Otherwise, strerror returns a pointer to the string "Unknown
error". You should check sys_nerr because new error codes may be added to
the system before they are added to the table. Typically, the value
passed to strerror should be errno.
NOTES
More verbose, Domain/OS-specific error messages may be obtained by
setting the environment variable APOLLO_STATUS to "true".
SEE ALSO
intro(2).