secondary cache feature in vm.
[minix.git] / lib / libc / stdio / perror.c
blob1d929da93b97476ca01256975a5bb3365d7f494b
1 /*
2 * perror.c - print an error message on the standard error output
3 */
4 /* $Header$ */
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"
15 ssize_t _write(int d, const char *buf, size_t nbytes);
17 void
18 perror(const char *s)
20 char *p;
21 int fd;
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);
31 _write(fd, p, strlen(p));
32 _write(fd, "\n", 1);