summaryrefslogtreecommitdiff
path: root/com32/lib/strerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/strerror.c')
-rw-r--r--com32/lib/strerror.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/com32/lib/strerror.c b/com32/lib/strerror.c
new file mode 100644
index 00000000..62705553
--- /dev/null
+++ b/com32/lib/strerror.c
@@ -0,0 +1,24 @@
+/*
+ * strerror.c
+ */
+
+#include <string.h>
+
+char *strerror(int errnum)
+{
+ static char message[32] = "error "; /* enough for error 2^63-1 */
+
+ char numbuf[32];
+ char *p;
+
+ p = numbuf+sizeof numbuf;
+ *--p = '\0';
+
+ do {
+ *--p = (errnum % 10) + '0';
+ errnum /= 10;
+ } while ( errnum );
+
+ return (char *)memcpy(message+6, p, (numbuf+sizeof numbuf)-p);
+}
+