repo.or.cz
/
minix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
secondary cache feature in vm.
[minix.git]
/
lib
/
libc
/
stdio
/
perror.c
blob
1d929da93b97476ca01256975a5bb3365d7f494b
1
/*
2
* perror.c - print an error message on the standard error output
3
*/
4
/* $Header$ */
5
6
#if defined(_POSIX_SOURCE)
7
#include <sys/types.h>
8
#endif
9
#include <stdio.h>
10
#include <errno.h>
11
#include <stdio.h>
12
#include <string.h>
13
#include
"loc_incl.h"
14
15
ssize_t
_write
(
int
d
,
const char
*
buf
,
size_t
nbytes
);
16
17
void
18
perror
(
const char
*
s
)
19
{
20
char
*
p
;
21
int
fd
;
22
23
p
=
strerror
(
errno
);
24
fd
=
fileno
(
stderr
);
25
fflush
(
stdout
);
26
fflush
(
stderr
);
27
if
(
s
&& *
s
) {
28
_write
(
fd
,
s
,
strlen
(
s
));
29
_write
(
fd
,
": "
,
2
);
30
}
31
_write
(
fd
,
p
,
strlen
(
p
));
32
_write
(
fd
,
"
\n
"
,
1
);
33
}