summaryrefslogtreecommitdiff
path: root/libc/error/perror.c
blob: f9b09656465e550d018d29c4bf5a48900f8ee2d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

#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);
}