Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/tools/build/make_libc_exterr_cat_filenames.sh
96280 views
1
#!/bin/sh
2
set -e
3
4
check="lib/libc/gen/uexterr_format.c"
5
target="lib/libc/gen/exterr_cat_filenames.h"
6
7
if [ \! -f "${check}" ] ; then
8
echo "Script must be run from the top of the full source tree"
9
exit 1
10
fi
11
12
echo "/*" >"${target}"
13
printf " * Automatically %sgenerated, use\\n" \@ >>"${target}"
14
echo " * tools/build/make_libc_exterr_cat_filenames.sh" >>"${target}"
15
echo " */" >>"${target}"
16
17
(find -s sys -type f -name '*.c' | \
18
xargs grep -E '^#define[[:space:]]+EXTERR_CATEGORY[[:space:]]+EXTERR_CAT_' | \
19
sed -E 's/[[:space:]]+/:/g' | \
20
awk -F ':' '{filename = $1; sub(/^sys\//, "", filename);
21
printf("\t[%s] = \"%s\",\n", $4, filename)}') \
22
>>"${target}"
23
24