| Juan Cespedes | e3eb9aa | 1999-04-03 03:21:52 +0200 | [diff] [blame] | 1 | #!/usr/bin/awk -f |
| 2 | |
| 3 | # hack expression to generate arch/signalent.h from <asm/signal.h> |
| 4 | # It reads from stdin and writes to stdout |
| 5 | |
| 6 | BEGIN { |
| 7 | max=0; |
| 8 | } |
| 9 | |
| 10 | { |
| 11 | if (($1 ~ /^#define$/) && (!SIGNAL[$3]) && ($2 ~ /^SIG[A-Z]/) \ |
| 12 | && ($2 !~ /^SIGRTMIN$/) && ($2 !~ /^SIGRTMAX$/) && ($2 !~ /^SIGSTKSZ$/) \ |
| 13 | && ($3>=0) && ($3<=1000)) { |
| 14 | SIGNAL[$3]=$2; |
| 15 | if ($3 > max) { |
| 16 | max=$3; |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | END { |
| 22 | for(i=0; i<=max; i++) { |
| 23 | if (!SIGNAL[i]) { |
| 24 | SIGNAL[i] = "SIG_" i; |
| 25 | } |
| 26 | pad = 16 - length(SIGNAL[i]); |
| 27 | if (pad<1) { |
| 28 | pad=1; |
| 29 | } |
| 30 | printf("\t\"%s\",%*s/* %d */\n", SIGNAL[i], pad, "", i); |
| 31 | } |
| 32 | } |
| 33 | |