1# This is an awk script which finds out what the possibilities for 2# the signal names are, and dumps them out so that cpp can turn them 3# into numbers. Since we don't need to decide here what the 4# real signals are, we can afford to be generous about definitions, 5# in case the definitions are in terms of other definitions. 6# However, we need to avoid definitions with parentheses, which will 7# mess up the syntax. 8BEGIN { printf "#include <signal.h>\n\n" } 9 10/^[\t ]*#[\t ]*define[\t _]*SIG[A-Z][A-Z0-9]*[\t ][\t ]*[^(\t ]/ { 11 sigindex = index($0, "SIG") 12 sigtail = substr($0, sigindex, 80) 13 split(sigtail, tmp) 14 signam = substr(tmp[1], 4, 20) 15 if (substr($0, sigindex-1, 1) == "_") 16 printf("XXNAMES XXSIG%s _SIG%s\n", signam, signam) 17 else 18 printf("XXNAMES XXSIG%s SIG%s\n", signam, signam) 19} 20