NetBSD/usr.bin/top/sigconv.awk

54 lines
1.1 KiB
Awk
Raw Normal View History

1999-02-15 02:54:06 +03:00
BEGIN {
nsig = 0;
j = 0;
print "/* This file was automatically generated */"
print "/* by the awk script \"sigconv.awk\". */\n"
print "struct sigdesc {"
print " char *name;"
print " int number;"
print "};\n"
print "struct sigdesc sigdesc[] = {"
}
/^#define[ \t][ \t]*SIG[A-Z]/ {
j = sprintf("%d", $3);
str = $2;
if (nsig < j)
nsig = j;
1999-03-24 14:57:08 +03:00
siglist[j] = sprintf(" { \"%s\",\t%2d },", \
1999-02-15 02:54:06 +03:00
substr(str, 4), j);
}
/^#[ \t]*define[ \t][ \t]*SIG[A-Z]/ {
j = sprintf("%d", $4);
str = $3;
if (nsig < j)
nsig = j;
1999-03-24 14:57:08 +03:00
siglist[j] = sprintf(" { \"%s\",\t%2d },", \
1999-02-15 02:54:06 +03:00
substr(str, 4), j);
}
/^#[ \t]*define[ \t][ \t]*_SIG[A-Z]/ {
j = sprintf("%d", $4);
str = $3;
if (nsig < j)
nsig = j;
1999-03-24 14:57:08 +03:00
siglist[j] = sprintf(" { \"%s\",\t%2d },", \
1999-02-15 02:54:06 +03:00
substr(str, 5), j);
}
END {
for (n = 1; n <= nsig; n++)
if (siglist[n] != "")
printf(" %s\n", siglist[n]);
1999-03-24 14:57:08 +03:00
printf(" { NULL,\t 0 }\n};\n");
1999-02-15 02:54:06 +03:00
}