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 | .\" | |
5 | .\" @(#)strerror.3 4.1 (Berkeley) %G% | |
6 | .\" | |
7 | .TH PERROR 3 | |
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 | |
21 | produces a short error message | |
22 | on the standard error file | |
23 | describing the last error encountered during a call | |
24 | to the system from a C program. | |
25 | First the argument string | |
26 | .I s | |
27 | is printed, then a colon, then the message and a new-line. | |
28 | Most usefully, the argument string is the name | |
29 | of the program which incurred the error. | |
30 | The error number is taken from the external variable | |
31 | .I errno | |
32 | (see | |
33 | .IR intro (2)), | |
34 | which is set when errors occur but not cleared when | |
35 | non-erroneous calls are made. | |
36 | .PP | |
37 | To simplify variant formatting | |
38 | of messages, the vector of message strings | |
39 | .I sys_errlist | |
40 | is provided; | |
41 | .I errno | |
42 | can be used as an index in this table to get the | |
43 | message string without the newline. | |
44 | .I Sys_nerr | |
45 | is the number of messages provided for in the table; | |
46 | it should be checked because new | |
47 | error codes may be added to the system before | |
48 | they are added to the table. | |
49 | .SH "SEE ALSO" | |
50 | intro(2) |