summaryrefslogtreecommitdiff
path: root/trunk/missing/strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/missing/strerror.c')
-rw-r--r--trunk/missing/strerror.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/trunk/missing/strerror.c b/trunk/missing/strerror.c
new file mode 100644
index 0000000000..023935a1ff
--- /dev/null
+++ b/trunk/missing/strerror.c
@@ -0,0 +1,16 @@
+/* public domain rewrite of strerror(3) */
+
+extern int sys_nerr;
+extern char *sys_errlist[];
+
+static char msg[50];
+
+char *
+strerror(int error)
+{
+ if (error <= sys_nerr && error > 0) {
+ return sys_errlist[error];
+ }
+ sprintf(msg, "Unknown error (%d)", error);
+ return msg;
+}