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 last 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. Be aware that errno is not cleared when a valid call is made.
To simplify the message formats, the vector of message strings sys_errlist is provided; errno can be used as an index in 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.