summaryrefslogtreecommitdiff
path: root/shells/rc/patches/patch-aa
blob: 89cfbd1663f9d2319ccba1aae4aabfaf1bdb3f88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$NetBSD: patch-aa,v 1.9 1999/08/03 15:00:58 agc Exp $

Use the strerror(3) function - it's much better at this than we are,
and hides the internals of the error list.

--- utils.c.orig	Thu Oct 29 08:26:08 1998
+++ utils.c	Sun Jun 20 16:35:35 1999
@@ -2,6 +2,7 @@
 
 #include <errno.h>
 #include <setjmp.h>
+#include <string.h>
 #include "rc.h"
 #include "jbwrap.h"
 
@@ -19,6 +20,7 @@
 /* our perror */
 
 extern void uerror(char *s) {
+#if 0
 	extern int sys_nerr;
 	extern char *sys_errlist[];
 	if (errno > sys_nerr)
@@ -27,6 +29,12 @@
 		fprint(2, "%s: %s\n", s, sys_errlist[errno]);
 	else
 		fprint(2, "%s\n", sys_errlist[errno]);
+#else
+	if (s != (char *) NULL) {
+		fprint(2, "%s: ", s);
+	}
+	fprint(2, "%s\n", strerror(errno));
+#endif
 }
 
 /* Die horribly. This should never get called. Please let me know if it does. */