3 # $NetBSD: makeerrnos.sh,v 1.4 2005/07/17 09:45:50 he Exp $
6 echo "usage: makeerrnos.sh errno.h signal.h output"
19 cat <<__EOF__ > $CFILE
22 struct systab errnos[] = {
24 cat ${ERRNOH} | ${CPP} ${CPPFLAGS} -dM |
26 /^#[ ]*define[ ]*E[A-Z0-9]*[ ]*[0-9-][0-9]*[ ]*.*/ {
27 for (i = 1; i <= NF; i++)
33 printf("\t{ \"%s\", %s },\n", $i, $j);
36 print " { \"0\", 0 },\n";
38 ' |
sort -n +2 >> $CFILE
41 lines
=`wc -l $CFILE | ${AWK} ' { print $1; } ' -`
42 lines
=`expr $lines - 4`
44 cat <<__EOF__ >> $CFILE
46 struct systab signals[] = {
48 cat ${SIGNALH} | ${CPP} ${CPPFLAGS} -dM |
50 /^#[ ]*define[ ]*S[A-Z0-9]*[ ]*[0-9-][0-9]*[ ]*.*/ {
51 for (i = 1; i <= NF; i++)
57 printf("\t{ \"%s\", %s },\n", $i, $j);
60 print " { \"0\", 0 },\n";
62 ' |
sort -n +2 >> $CFILE
65 elines
=`grep '{ "SIG' $CFILE | wc -l`
66 elines
=`expr $elines + 1`
74 extern struct systab errnos[$lines + 1];
75 extern struct systab signals[$elines + 1];
77 #define MAXERRNOS $lines
78 #define MAXSIGNALS $elines