1: /*
2: * Print the error indicated
3: * in the cerror cell.
4: */
5:
6: int errno;
7: int sys_nerr;
8: char *sys_errlist[];
9: perror(s)
10: char *s;
11: {
12: register char *c;
13: register n;
14:
15: c = "Unknown error";
16: if(errno < sys_nerr)
17: c = sys_errlist[errno];
18: n = strlen(s);
19: if(n) {
20: write(2, s, n);
21: write(2, ": ", 2);
22: }
23: write(2, c, strlen(c));
24: write(2, "\n", 1);
25: }
26:
27: /*
28: * Return the number of bytes in a string
29: */
30:
31: strlen(str)
32: char *str;
33: {
34: register char *s;
35:
36: s = str;
37: while(*s++)
38: ;
39: return(s-str-1);
40: }
Defined functions
perror
defined in line
9; used 7 times
Defined variables
errno
defined in line
6; used 2 times