diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2025-12-28 14:04:28 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2025-12-29 01:16:25 +0000 |
| commit | 3ef25acf3600fb822bdf1487036184b4978d737f (patch) | |
| tree | 3a52d697d098364537c2b20f8c184cf58ed3e5e8 /tools/build | |
| parent | 54b52f655e0fdaef21c3cde85e8bf030efa7b86e (diff) | |
Diffstat (limited to 'tools/build')
| -rwxr-xr-x | tools/build/make_libc_exterr_cat_filenames.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/build/make_libc_exterr_cat_filenames.sh b/tools/build/make_libc_exterr_cat_filenames.sh new file mode 100755 index 000000000000..fbde85891200 --- /dev/null +++ b/tools/build/make_libc_exterr_cat_filenames.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +check="lib/libc/gen/uexterr_format.c" +target="lib/libc/gen/exterr_cat_filenames.h" + +if [ \! -f "${check}" ] ; then + echo "Script must be run from the top of the full source tree" + exit 1 +fi + +echo "/*" >"${target}" +printf " * Automatically %sgenerated, use\\n" \@ >>"${target}" +echo " * tools/build/make_libc_exterr_cat_filenames.sh" >>"${target}" +echo " */" >>"${target}" + +(find sys -type f -name '*.c' | \ + xargs grep -E '^#define[[:space:]]+EXTERR_CATEGORY[[:space:]]+EXTERR_CAT_' | \ + sed -E 's/[[:space:]]+/:/g' | \ + awk -F ':' '{filename = $1; sub(/^sys\//, "", filename); + printf("\t[%s] = \"%s\",\n", $4, filename)}') \ + >>"${target}" |
