scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

mkerrstr (372B)


      1 trap 'rm -f $$.tmp' EXIT HUP INT QUIT TERM
      2 
      3 awk '
      4 /^#define[ \t]*E/{
      5 	str = ""
      6 	for (i = 5; i < NF; i++)
      7 		str = str " " $i
      8 	sub(/^ /, "", str)
      9 	errstr[$2] = str
     10 }
     11 
     12 END {
     13 	print "#include <errno.h>\n"
     14 	print "char *const _sys_errlist[] = {"
     15 	for (i in errstr)
     16 		printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i]
     17 
     18 	print "};"
     19 }' $@ > $$.tmp && mv $$.tmp _sys_errlist.c