|
|
1.1 root 1: /*-
2: * Copyright (c) 1991 The Regents of the University of California.
3: * All rights reserved.
4: *
5: * %sccs.include.redist.c%
6: *
7: * %W% (Berkeley) %G%
8: */
9:
10: err(s, syserr)
11: register char *s;
12: int syserr;
13: {
14: extern int errno, sys_nerr;
15: extern char *sys_errlist[];
16: register char *e;
17:
18: (void)write(2, PROGNAME, sizeof(PROGNAME) - 1);
19: if (s) {
20: for (e = s; *e; ++e);
21: (void)write(2, s, e - s);
22: }
23: #define BADERR "unknown error"
24: if (syserr) {
25: if (s)
26: (void)write(2, ": ", 2);
27: if (errno > sys_nerr)
28: (void)write(2, BADERR, sizeof(BADERR) - 1);
29: else {
30: for (e = s = sys_errlist[errno]; *e; ++e);
31: (void)write(2, s, e - s);
32: }
33: }
34: (void)write(2, "\n", 1);
35: eval = 1;
36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.