30 lines
818 B
Awk
30 lines
818 B
Awk
BEGIN {
|
|
cmd = "printf '#include <signal.h>\n' | " COMPILER " -E -dM -x c - | sort -nk 3"
|
|
FS=" "
|
|
print "#include <signal.h>"
|
|
print ""
|
|
print "static const char *SIGNAL_NAMES[] = {"
|
|
min = 0
|
|
max = 0
|
|
while ((cmd | getline record)) {
|
|
if (record ~ /^#define\s*SIG[A-Z0-9]+\s*[0-9]+$/) {
|
|
split(record, fields, /\s+/)
|
|
name = fields[2]
|
|
number = fields[3]
|
|
if (name != "SIGSTKSZ") {
|
|
print " [" name "] = \"" name "\","
|
|
if (min == 0) {
|
|
min = number
|
|
}
|
|
if (number > max) {
|
|
max = number
|
|
}
|
|
}
|
|
}
|
|
}
|
|
close(cmd)
|
|
print "};"
|
|
print "#define MIN_SIGNUM " min
|
|
print "#define MAX_SIGNUM " max
|
|
}
|