summaryrefslogtreecommitdiff
path: root/libc/stdio/perror.c
blob: d6274c0562cb9f4488f0822251824385673ad652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <unistd.h>
#include <string.h>
#include <errno.h>

void perror(str)
__const char *str;
{
	register char *ptr;

	if (str) {
		write(2, str, strlen(str));
		write(2, ": ", 2);
	} else
		write(2, "perror: ", 8);

	ptr = strerror(errno);
	write(2, ptr, strlen(ptr));
	write(2, "\n", 1);
}