summaryrefslogtreecommitdiff
path: root/lang/elk
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>2002-10-21 19:54:41 +0000
committerGarrett Wollman <wollman@FreeBSD.org>2002-10-21 19:54:41 +0000
commite915e951f5c56b7c4d65d5edbb5bf8c4d062c0f7 (patch)
treebc2988e990f1be1c5fcdeb9b4f1554a56ec83f46 /lang/elk
parentAdd information on supported both streams and players (diff)
Use strerror_r() rather than trying to hack our own. This avoids
dealing with the nonstandardized types of sys_nerr and sys_errlst[] and works for both -current and recent (>=4.5) values of -stable. The previous implementation knew too much about sys_nerr for its own good.
Notes
Notes: svn path=/head/; revision=68531
Diffstat (limited to 'lang/elk')
-rw-r--r--lang/elk/files/patch-af42
1 files changed, 32 insertions, 10 deletions
diff --git a/lang/elk/files/patch-af b/lang/elk/files/patch-af
index c4c4411565c9..4fc6b0a353b1 100644
--- a/lang/elk/files/patch-af
+++ b/lang/elk/files/patch-af
@@ -1,19 +1,41 @@
---- src/print.c.orig Thu Apr 4 07:25:04 1996
-+++ src/print.c Sun Dec 12 16:29:07 1999
-@@ -6,6 +6,7 @@
+--- ../../work.orig/elk-3.0/src/print.c Thu Apr 4 08:25:04 1996
++++ src/print.c Mon Oct 21 15:48:05 2002
+@@ -5,6 +5,7 @@
+
#include <errno.h>
#include <ctype.h>
++#include <string.h>
#include <varargs.h>
-+#include <sys/param.h>
#ifdef FLUSH_TIOCFLUSH
- # include <sys/ioctl.h>
-@@ -556,7 +557,7 @@
+@@ -555,10 +556,6 @@
+ char *p;
register c;
char buf[256];
- extern sys_nerr;
+- extern sys_nerr;
-#ifndef __bsdi__
-+#if !(defined(BSD) && (BSD >= 199306))
- extern char *sys_errlist[];
- #endif
+- extern char *sys_errlist[];
+-#endif
GC_Node;
+ Alloca_Begin;
+
+@@ -573,13 +570,13 @@
+ } else if (c == '%') {
+ Print_Char (port, '\n');
+ } else if (c == 'e' || c == 'E') {
+- if (Saved_Errno > 0 && Saved_Errno < sys_nerr) {
+- s = sys_errlist[Saved_Errno];
+- sprintf (buf, "%c%s", isupper (*s) ? tolower (*s) :
+- *s, s+1);
+- } else {
+- sprintf (buf, "error %d", Saved_Errno);
++ if (strerror_r(Saved_Errno, buf, sizeof(buf)) != 0) {
++ snprintf(buf, sizeof(buf) - 1, "unknown error: %d",
++ Saved_Errno);
++ buf[sizeof(buf) - 1] = '\0';
+ }
++ if (isupper(buf[0]))
++ buf[0] = tolower(buf[0]);
+ Print_Object (Make_String (buf, strlen (buf)), port,
+ c == 'E', 0, 0);
+ } else {