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