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/include/__errno.h | 16 ++++++++++++++++ src/user/lib/include/__errno.h.awk | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/user/lib/include/__errno.h create mode 100644 src/user/lib/include/__errno.h.awk (limited to 'src/user/lib/include') diff --git a/src/user/lib/include/__errno.h b/src/user/lib/include/__errno.h new file mode 100644 index 0000000..d6d5e6a --- /dev/null +++ b/src/user/lib/include/__errno.h @@ -0,0 +1,16 @@ +/* generated by awk */ +#ifdef E +E( 1, "EGENERIC unknown error") +E( 2, "EFAULT") +E( 3, "EBADF bad file descriptor") +E( 4, "EINVAL") +E( 5, "ENOSYS unsupported") +E( 6, "ERANGE") +E( 7, "ENOMEM") +E( 8, "ENOENT") +E( 9, "ENOTEMPTY") +E( 10, "EACCES") +E( 11, "EMFILE all file descriptors taken") +E( 12, "ECONNRESET") +E(200, "EISDIR") +#endif diff --git a/src/user/lib/include/__errno.h.awk b/src/user/lib/include/__errno.h.awk new file mode 100644 index 0000000..6232835 --- /dev/null +++ b/src/user/lib/include/__errno.h.awk @@ -0,0 +1,20 @@ +BEGIN { + print "/* generated by awk */"; + print "#ifdef E"; +} + +END { + print "#endif"; +} + +/#define/ { + comment = $2; + num = $3; + # extract the comment, if present + if (index($0, "/*")) { + sub(/[^/]*\/\*/, ""); + sub(/ *\*\//, ""); + comment = comment $0; + } + printf "E(%3s, \"%s\")\n", num, comment; +} -- cgit v1.2.3