| 1 | .TH PERROR 3 |
| 2 | .SH NAME |
| 3 | perror, sys_errlist, sys_nerr \- system error messages |
| 4 | .SH SYNOPSIS |
| 5 | .B perror(s) |
| 6 | .br |
| 7 | .B char *s; |
| 8 | .PP |
| 9 | .B int sys_nerr; |
| 10 | .br |
| 11 | .B char *sys_errlist[]; |
| 12 | .SH DESCRIPTION |
| 13 | .I Perror |
| 14 | produces a short error message |
| 15 | on the standard error file |
| 16 | describing the last error encountered during a call |
| 17 | to the system from a C program. |
| 18 | First the argument string |
| 19 | .I s |
| 20 | is printed, then a colon, then the message and a new-line. |
| 21 | Most usefully, the argument string is the name |
| 22 | of the program which incurred the error. |
| 23 | The error number is taken from the external variable |
| 24 | .I errno |
| 25 | (see |
| 26 | .IR intro (2)), |
| 27 | which is set when errors occur but not cleared when |
| 28 | non-erroneous calls are made. |
| 29 | .PP |
| 30 | To simplify variant formatting |
| 31 | of messages, the vector of message strings |
| 32 | .I sys_errlist |
| 33 | is provided; |
| 34 | .I errno |
| 35 | can be used as an index in this table to get the |
| 36 | message string without the newline. |
| 37 | .I Sys_nerr |
| 38 | is the number of messages provided for in the table; |
| 39 | it should be checked because new |
| 40 | error codes may be added to the system before |
| 41 | they are added to the table. |
| 42 | .SH "SEE ALSO" |
| 43 | intro(2) |