summaryrefslogtreecommitdiff
path: root/src/user/lib/string/strerror.c
diff options
context:
space:
mode:
authordzwdz2022-09-03 23:41:17 +0200
committerdzwdz2022-09-03 23:41:17 +0200
commitd73c5ac9891ea3a88fa6a5ec1339df1f5cdf1a49 (patch)
treed7a6ea63772d9bcf2c27e9a6eaa4989f2ea1c175 /src/user/lib/string/strerror.c
parentecc54f4be44fa1fd1ce79b0458a04eef2667cba8 (diff)
user/libc: generate strerror from camellia/errno.h
Diffstat (limited to 'src/user/lib/string/strerror.c')
-rw-r--r--src/user/lib/string/strerror.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/user/lib/string/strerror.c b/src/user/lib/string/strerror.c
new file mode 100644
index 0000000..1f5fc29
--- /dev/null
+++ b/src/user/lib/string/strerror.c
@@ -0,0 +1,11 @@
+#include <string.h>
+
+static const char *errstr[] = {
+# define E(n, str) [n] = str,
+# include <__errno.h>
+# undef E
+};
+
+char *strerror(int n) {
+ return (char*)(errstr[n] ? errstr[n] : "unknown error");
+}