date and time created 80/12/21 16:51:02 by wnj
[unix-history] / usr / src / lib / libc / stdio / perror.c
CommitLineData
716337de
BJ
1/* @(#)perror.c 4.1 (Berkeley) %G% */
2/*
3 * Print the error indicated
4 * in the cerror cell.
5 */
6
7int errno;
8int sys_nerr;
9char *sys_errlist[];
10perror(s)
11char *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}