BSD 4_2 development
[unix-history] / usr / man / man3 / perror.3
CommitLineData
0164e195
C
1.TH PERROR 3 "19 January 1983"
2.UC 4
3.SH NAME
4perror, 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
15produces a short error message on the standard error file
16describing the last error encountered during a call
17to the system from a C program.
18First the argument string
19.I s
20is printed, then a colon, then the message and a new-line.
21Most usefully, the argument string is the name
22of the program which incurred the error.
23The error number is taken from the external variable
24.I errno
25(see
26.IR intro (2)),
27which is set when errors occur but not cleared when
28non-erroneous calls are made.
29.PP
30To simplify variant formatting of messages, the vector of message strings
31.I sys_errlist
32is provided;
33.I errno
34can be used as an index in this table to get the
35message string without the newline.
36.I Sys_nerr
37is the number of messages provided for in the table;
38it should be checked because new error codes may be added to the system before
39they are added to the table.
40.SH "SEE ALSO"
41intro(2),
42psignal(3)