BSD 4_3_Net_2 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 10 May 1991 05:58:19 +0000 (21:58 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Fri, 10 May 1991 05:58:19 +0000 (21:58 -0800)
Work on file usr/src/sys/i386/floppy/cat/errfunction.in

Synthesized-from: CSRG/cd2/net.2

usr/src/sys/i386/floppy/cat/errfunction.in [new file with mode: 0644]

diff --git a/usr/src/sys/i386/floppy/cat/errfunction.in b/usr/src/sys/i386/floppy/cat/errfunction.in
new file mode 100644 (file)
index 0000000..1ef7d26
--- /dev/null
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     %W% (Berkeley) %G%
+ */
+
+err(s, syserr)
+       register char *s;
+       int syserr;
+{
+       extern int errno, sys_nerr;
+        extern char *sys_errlist[];
+       register char *e;
+
+       (void)write(2, PROGNAME, sizeof(PROGNAME) - 1);
+       if (s) {
+               for (e = s; *e; ++e);
+               (void)write(2, s, e - s);
+       }
+#define        BADERR  "unknown error"
+       if (syserr) {
+               if (s)
+                       (void)write(2, ": ", 2);
+               if (errno > sys_nerr)
+                       (void)write(2, BADERR, sizeof(BADERR) - 1);
+               else {
+                       for (e = s = sys_errlist[errno]; *e; ++e);
+                       (void)write(2, s, e - s);
+               }
+       }
+       (void)write(2, "\n", 1);
+       eval = 1;
+}