shithub: scc

ref: 19f4d62e77c2b66116a48c6605f2cc9f239e53b0
dir: /src/libc/arch/mkerrstr/

View raw version
trap 'rm -f $$.tmp' EXIT HUP INT QUIT TERM

awk '
/^#define[ \t]*E/{
	str = ""
	for (i = 5; i < NF; i++)
		str = str " " $i
	sub(/^ /, "", str)
	errstr[$2] = str
}

END {
	print "#include <errno.h>\n"
	print "char *const _sys_errlist[] = {"
	for (i in errstr)
		printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i]

	print "};"
}' $@ > $$.tmp && mv $$.tmp _sys_errlist.c