blob: 5476d76a17b9039d49e25c926beaa6df1d19a5f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <unistd.h>
#include <string.h>
extern char *sys_errlist[];
extern int sys_nerr;
extern int errno;
void perror(const char *s) {
register char *message="[unknown error]";
write(2,s,strlen(s));
write(2,": ",2);
if (errno>=0 && errno<sys_nerr)
message=sys_errlist[errno];
write(2,message,strlen(message));
write(2,"\n",1);
}
|