PERROR(3)
NAME
perror, sys_errlist, sys_nerr − system error messages
USAGE
perror(s) char *s;
int sys_nerr; char *sys_errlist[];
DESCRIPTION
Perror produces a short error message on the standard error file that describes the error that a C program encountered during its most recent call to the system. The argument string s is printed first, followed by a colon, the message, and a new-line. The argument string is the name of the program that caused the error. The error number is taken from the external variable errno, which is set when errors occur.
The vector of message strings, sys_errlist, is provided to simplify the message formats. Use errno as an index into this table to get the message string without the newline. Sys_nerr is the number of messages provided for in the table; it should be checked, because new error codes may be added to the system before they are added to the table.
NOTES
Errno is only set when an error occurs. It is not cleared when a valid call is made.