Initial commit
This commit is contained in:
28
gen-signal-names.awk
Normal file
28
gen-signal-names.awk
Normal file
@ -0,0 +1,28 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print "};"
|
||||
print "#define MIN_SIGNUM " min
|
||||
print "#define MAX_SIGNUM " max
|
||||
}
|
||||
Reference in New Issue
Block a user