Commit | Line | Data |
---|---|---|
0164e195 C |
1 | .TH PERROR 3 "19 January 1983" |
2 | .UC 4 | |
3 | .SH NAME | |
4 | perror, sys_errlist, sys_nerr \- system error messages | |
5 | .SH SYNOPSIS | |
6 | .nf | |
7 | .B perror(s) | |
8 | .B char *s; | |
9 | .PP | |
10 | .B int sys_nerr; | |
11 | .B char *sys_errlist[]; | |
12 | .fi | |
13 | .SH DESCRIPTION | |
14 | .I Perror | |
15 | produces a short error message 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 of messages, the vector of message strings | |
31 | .I sys_errlist | |
32 | is provided; | |
33 | .I errno | |
34 | can be used as an index in this table to get the | |
35 | message string without the newline. | |
36 | .I Sys_nerr | |
37 | is the number of messages provided for in the table; | |
38 | it should be checked because new error codes may be added to the system before | |
39 | they are added to the table. | |
40 | .SH "SEE ALSO" | |
41 | intro(2), | |
42 | psignal(3) |