diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-13 07:54:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-13 07:54:12 +0000 |
commit | 4754ed45b607e82450a5e31fea1da3ba61433b04 (patch) | |
tree | 3554490bdc003e6004f605abe41929cdf98b0651 /src/gen-errno.sh | |
parent | Initial commit. (diff) | |
download | dnsjit-4754ed45b607e82450a5e31fea1da3ba61433b04.tar.xz dnsjit-4754ed45b607e82450a5e31fea1da3ba61433b04.zip |
Adding upstream version 1.1.0+debian.upstream/1.1.0+debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | src/gen-errno.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gen-errno.sh b/src/gen-errno.sh new file mode 100755 index 0000000..f9a81da --- /dev/null +++ b/src/gen-errno.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +includes="/usr/include/errno.h" +if [ -f /usr/include/sys/errno.h ]; then + includes="$includes /usr/include/sys/errno.h" +fi +if [ -f /usr/include/asm-generic/errno.h ]; then + includes="$includes /usr/include/asm-generic/errno.h" +fi +if [ -f /usr/include/asm-generic/errno-base.h ]; then + includes="$includes /usr/include/asm-generic/errno-base.h" +fi + +echo 'const char* core_log_errstr(int err) +{ + switch (err) {' + +egrep -Eh '^#define[ ]+E\w+[ ]+[0-9]+' $includes | + grep -v ELAST | + awk '{print $2}' | + sort -u | + awk '{print "#ifdef " $1 "\n case " $1 ":\n return \"" $1 "\";\n#endif"}' + +echo ' default: + break; + } + return "UNKNOWN"; +}' |