|
|
1.1 root 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: .\" @(#)perror.3 6.4 (Berkeley) 6/24/90
6: .\"
7: .TH PERROR 3 "June 24, 1990"
8: .UC 4
9: .SH NAME
10: perror, strerror, sys_errlist, sys_nerr \- system error messages
11: .SH SYNOPSIS
12: .nf
13: .B perror(string)
14: .B char *string;
15: .PP
16: .B char *
17: .B strerror(errnum)
18: .B int errnum;
19: .PP
20: .B extern int errno, sys_nerr;
21: .B extern char *sys_errlist[];
22: .fi
23: .SH DESCRIPTION
24: .I Perror
25: produces a short error message on the standard error file
26: describing the last error encountered during a call
27: to the system from a C program. If
28: .I string
29: is non-NULL, it is printed, followed by a colon, followed by a space,
30: followed by the message and a new-line. Otherwise, just the
31: message and the new-line are printed. Most usefully, the argument
32: string is the name of the program which incurred the error.
33: The error number is taken from the external variable
34: .I errno
35: (see
36: .IR intro (2)),
37: which is set when errors occur but not cleared when
38: non-erroneous calls are made.
39: .PP
40: To simplify variant formatting of messages, the
41: .I strerror
42: function returns a pointer to the error message string mapped
43: to the error number
44: .IR errnum .
45: .PP
46: The message strings can be accessed directly using the external
47: character array
48: .IR sys_errlist .
49: .I Sys_nerr
50: is the total number of messages in the array. The use of these
51: variables is deprecated;
52: .I strerror
53: should be used instead.
54: .SH "SEE ALSO"
55: intro(2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.