]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Add own strerror() implementation
authorAlexander Barton <alex@barton.de>
Sun, 29 Jan 2017 21:54:03 +0000 (22:54 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 25 Feb 2018 02:17:21 +0000 (03:17 +0100)
This is required for SunOS 4.1.4 aka Solaris 1.1.
Thanks to Götz Hoffart for testing!

configure.ng
src/portab/Makefile.ng
src/portab/strerror.c [new file with mode: 0644]

index da1c7c2f102947b8254405c72a77ce03f7109517..616b24190bc496484f9ea4ce97daa109eea1abfd 100644 (file)
@@ -239,7 +239,6 @@ AC_CHECK_FUNCS([ \
                strcasecmp \
                strchr \
                strcspn \
-               strerror \
                strncasecmp \
                strrchr \
                strspn \
@@ -260,6 +259,7 @@ AC_CHECK_FUNCS_ONCE([
        sigprocmask \
        snprintf \
        strdup \
+       strerror \
        strlcat \
        strlcpy \
        strndup \
index 206cc774645d40e4e2578a862cb8165718887761..730413e17d4d4381fd52a512ead824c7887910dc 100644 (file)
@@ -18,6 +18,7 @@ noinst_LIBRARIES = libngportab.a
 libngportab_a_SOURCES = \
        memmove.c \
        strdup.c \
+       strerror.c \
        strlcpy.c \
        strndup.c \
        strtok_r.c \
diff --git a/src/portab/strerror.c b/src/portab/strerror.c
new file mode 100644 (file)
index 0000000..e07a34b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ */
+
+#include "portab.h"
+
+/**
+ * @file
+ * strerr() implementation
+ * https://lists.mindrot.org/pipermail/openssh-unix-dev/2000-February/000759.html
+ */
+
+#ifndef HAVE_STRERROR
+
+extern int   sys_nerr;
+extern char *sys_errlist[];
+
+GLOBAL char *
+strerror(int e)
+{
+       return (e >= 0 && e < sys_nerr)
+               ? sys_errlist[e]
+               : "unlisted error";
+}
+
+#endif