4.3BSD beta release manual page
[unix-history] / usr / src / lib / libc / string / strerror.3
CommitLineData
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
10perror, 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 21produces a short error message on the standard error file
b65a3479
KM
22describing the last error encountered during a call
23to the system from a C program.
24First the argument string
25.I s
26is printed, then a colon, then the message and a new-line.
27Most usefully, the argument string is the name
28of the program which incurred the error.
29The error number is taken from the external variable
30.I errno
31(see
32.IR intro (2)),
33which is set when errors occur but not cleared when
34non-erroneous calls are made.
35.PP
bd7fd9b1 36To simplify variant formatting of messages, the vector of message strings
b65a3479
KM
37.I sys_errlist
38is provided;
39.I errno
40can be used as an index in this table to get the
41message string without the newline.
42.I Sys_nerr
43is the number of messages provided for in the table;
bd7fd9b1 44it should be checked because new error codes may be added to the system before
b65a3479
KM
45they are added to the table.
46.SH "SEE ALSO"
bd7fd9b1
KM
47intro(2),
48psignal(3)