version 1, including all changes.
.
| Rev |
Author |
# |
Line |
| 1 |
perry |
1 |
PERROR |
| |
|
2 |
!!!PERROR |
| |
|
3 |
NAME |
| |
|
4 |
SYNOPSIS |
| |
|
5 |
DESCRIPTION |
| |
|
6 |
CONFORMING TO |
| |
|
7 |
SEE ALSO |
| |
|
8 |
---- |
| |
|
9 |
!!NAME |
| |
|
10 |
|
| |
|
11 |
|
| |
|
12 |
perror - print a system error message |
| |
|
13 |
!!SYNOPSIS |
| |
|
14 |
|
| |
|
15 |
|
| |
|
16 |
__#include __ |
| |
|
17 |
|
| |
|
18 |
|
| |
|
19 |
__void perror(const char__ |
| |
|
20 |
''*s''__);__ |
| |
|
21 |
|
| |
|
22 |
|
| |
|
23 |
__#include __ |
| |
|
24 |
|
| |
|
25 |
|
| |
|
26 |
__const char *__''sys_errlist''__[[]; |
| |
|
27 |
int__ ''sys_nerr''__;__ |
| |
|
28 |
!!DESCRIPTION |
| |
|
29 |
|
| |
|
30 |
|
| |
|
31 |
The routine __perror()__ produces a message on the |
| |
|
32 |
standard error output, describing the last error encountered |
| |
|
33 |
during a call to a system or library function. The argument |
| |
|
34 |
string ''s'' is printed first, then a colon and a blank, |
| |
|
35 |
then the message and a new-line. To be of most use, the |
| |
|
36 |
argument string should include the name of the function that |
| |
|
37 |
incurred the error. The error number is taken from the |
| |
|
38 |
external variable ''errno'', which is set when errors |
| |
|
39 |
occur but not cleared when non-erroneous calls are |
| |
|
40 |
made. |
| |
|
41 |
|
| |
|
42 |
|
| |
|
43 |
The global error list ''sys_errlist''[[] indexed by |
| |
|
44 |
''errno'' can be used to obtain the error message without |
| |
|
45 |
the newline. The largest message number provided in the |
| |
|
46 |
table is ''sys_nerr'' -1. Be careful when directly |
| |
|
47 |
accessing this list because new error values may not have |
| |
|
48 |
been added to ''sys_errlist''[[]. |
| |
|
49 |
|
| |
|
50 |
|
| |
|
51 |
When a system call fails, it usually returns -1 and sets the |
| |
|
52 |
variable ''errno'' to a value describing what went wrong. |
| |
|
53 |
(These values can be found in ''''.) Many |
| |
|
54 |
library functions do likewise. The function __perror()__ |
| |
|
55 |
serves to translate this error code into human-readable |
| |
|
56 |
form. Note that ''errno'' is undefined after a successful |
| |
|
57 |
library call: this call may well change this variable, even |
| |
|
58 |
though it succeeds, for example because it internally used |
| |
|
59 |
some other library function that failed. Thus, if a failing |
| |
|
60 |
call is not immediately followed by a call to __perror__, |
| |
|
61 |
the value of ''errno'' should be saved. |
| |
|
62 |
!!CONFORMING TO |
| |
|
63 |
|
| |
|
64 |
|
| |
|
65 |
ANSI C, BSD 4.3, POSIX, X/OPEN |
| |
|
66 |
!!SEE ALSO |
| |
|
67 |
|
| |
|
68 |
|
| |
|
69 |
strerror(3) |
| |
|
70 |
---- |