summaryrefslogtreecommitdiff
path: root/missing/strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/strerror.c')
-rw-r--r--missing/strerror.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/missing/strerror.c b/missing/strerror.c
new file mode 100644
index 0000000000..44013b3892
--- /dev/null
+++ b/missing/strerror.c
@@ -0,0 +1,19 @@
+/*
+ * strerror.c --- Map an integer error number into a printable string.
+ */
+
+extern int sys_nerr;
+extern char *sys_errlist[];
+
+static char msg[50];
+
+char *
+strerror(error)
+ int error;
+{
+ if ((error <= sys_nerr) && (error > 0)) {
+ return sys_errlist[error];
+ }
+ sprintf (msg, "Unknown error (%d)", error);
+ return msg;
+}