Path: blob/main/tools/build/make_libc_exterr_cat_filenames.sh
96280 views
#!/bin/sh1set -e23check="lib/libc/gen/uexterr_format.c"4target="lib/libc/gen/exterr_cat_filenames.h"56if [ \! -f "${check}" ] ; then7echo "Script must be run from the top of the full source tree"8exit 19fi1011echo "/*" >"${target}"12printf " * Automatically %sgenerated, use\\n" \@ >>"${target}"13echo " * tools/build/make_libc_exterr_cat_filenames.sh" >>"${target}"14echo " */" >>"${target}"1516(find -s sys -type f -name '*.c' | \17xargs grep -E '^#define[[:space:]]+EXTERR_CATEGORY[[:space:]]+EXTERR_CAT_' | \18sed -E 's/[[:space:]]+/:/g' | \19awk -F ':' '{filename = $1; sub(/^sys\//, "", filename);20printf("\t[%s] = \"%s\",\n", $4, filename)}') \21>>"${target}"222324