| 1 | #!/bin/sh |
| 2 | set -e |
| 3 | LC_ALL=C |
| 4 | export LC_ALL |
| 5 | echo |
| 6 | echo Generating entity table. |
| 7 | ( |
| 8 | cat entities.lnx | sed 's/ $//' | grep '^[ ]*{"' | sort >tmp |
| 9 | N=`cat tmp | wc -l` |
| 10 | echo '/* Automatically generated by gen-ent */' |
| 11 | echo |
| 12 | echo 'static_const struct { const char *s; int c; } entities ['`expr $N + 1`'] = {' |
| 13 | cat tmp |
| 14 | echo ' {NULL, 0}' |
| 15 | echo '};' |
| 16 | echo |
| 17 | echo '#define N_ENTITIES' $N |
| 18 | ) > ../entity.inc |
| 19 | rm -f tmp |
| 20 | echo Done. |
| 21 | echo |