From d73c5ac9891ea3a88fa6a5ec1339df1f5cdf1a49 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 3 Sep 2022 23:41:17 +0200 Subject: user/libc: generate strerror from camellia/errno.h --- src/user/lib/string/strerror.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/user/lib/string/strerror.c (limited to 'src/user/lib/string/strerror.c') 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 + +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"); +} -- cgit v1.2.3