links/Unicode/gen-ent
2021-08-28 18:37:32 +03:00

21 lines
411 B
Bash
Executable file

#!/bin/sh
set -e
LC_ALL=C
export LC_ALL
echo
echo Generating entity table.
(
cat entities.lnx | sed 's/
$//' | grep '^[ ]*{"' | sort >tmp
N=`cat tmp | wc -l`
echo '/* Automatically generated by gen-ent */'
echo
echo 'static_const struct { const char *s; int c; } entities ['`expr $N + 1`'] = {'
cat tmp
echo ' {NULL, 0}'
echo '};'
echo
echo '#define N_ENTITIES' $N
) > ../entity.inc
rm -f tmp
echo Done.
echo