Commit | Line | Data |
---|---|---|
716337de BJ |
1 | /* @(#)perror.c 4.1 (Berkeley) %G% */ |
2 | /* | |
3 | * Print the error indicated | |
4 | * in the cerror cell. | |
5 | */ | |
6 | ||
7 | int errno; | |
8 | int sys_nerr; | |
9 | char *sys_errlist[]; | |
10 | perror(s) | |
11 | char *s; | |
12 | { | |
13 | register char *c; | |
14 | register n; | |
15 | ||
16 | c = "Unknown error"; | |
17 | if(errno < sys_nerr) | |
18 | c = sys_errlist[errno]; | |
19 | n = strlen(s); | |
20 | if(n) { | |
21 | write(2, s, n); | |
22 | write(2, ": ", 2); | |
23 | } | |
24 | write(2, c, strlen(c)); | |
25 | write(2, "\n", 1); | |
26 | } |