summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/port/Makefile.in4
-rw-r--r--src/backend/port/strerror.c30
2 files changed, 32 insertions, 2 deletions
diff --git a/src/backend/port/Makefile.in b/src/backend/port/Makefile.in
index a0f281a538..a2d23188ce 100644
--- a/src/backend/port/Makefile.in
+++ b/src/backend/port/Makefile.in
@@ -19,7 +19,7 @@
# be converted to Method 2.
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.2 1997/02/28 10:57:47 momjian Exp $
+# $Header: /cvsroot/pgsql/src/backend/port/Attic/Makefile.in,v 1.3 1997/03/19 02:33:29 scrappy Exp $
#
#-------------------------------------------------------------------------
@@ -31,7 +31,7 @@ ifndef PORTNAME
@false
else
-OBJS = $(PORTNAME)/SUBSYS.o @INET_ATON@
+OBJS = $(PORTNAME)/SUBSYS.o @INET_ATON@ @STRERROR@
all: submake SUBSYS.o
diff --git a/src/backend/port/strerror.c b/src/backend/port/strerror.c
new file mode 100644
index 0000000000..7ec842e366
--- /dev/null
+++ b/src/backend/port/strerror.c
@@ -0,0 +1,30 @@
+/*
+ * strerror - map error number to descriptive string
+ *
+ * This version is obviously somewhat Unix-specific.
+ *
+ * based on code by Henry Spencer
+ * modified for ANSI by D'Arcy J.M. Cain
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+extern const char * const sys_errlist[];
+extern int sys_nerr;
+
+const char *
+strerror(int errnum)
+{
+ static char buf[24];
+
+ if (errnum < 0 || errnum > sys_nerr)
+ {
+ sprintf(buf, "unknown error %d", errnum);
+ return(buf);
+ }
+
+ return(sys_errlist[errnum]);
+}
+