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