2 # sigmsg.awk -- awk/nawk/gawk script to generate sigmsg.h
4 # provided by Geoff Wing <mason@werple.apana.org.au>
6 # On SunOS 4.1.3 - user-functions don't work properly, also \" problems
7 # Without 0 + hacks some nawks compare numbers as strings
9 /^[\t ]*#[\t ]*define[\t _]*SIG[A-Z][A-Z0-9]*[\t ]*[1-9][0-9]*/ {
10 sigindex = index($0, "SIG")
11 sigtail = substr($0, sigindex, 80)
13 signam = substr(tmp[1], 4, 20)
15 if (sig[signum] == "") {
17 if (0 + max < 0 + signum && signum < 60)
19 if (signam == "ABRT") { msg[signum] = "abort" }
20 if (signam == "ALRM") { msg[signum] = "alarm" }
21 if (signam == "BUS") { msg[signum] = "bus error" }
22 if (signam == "CHLD") { msg[signum] = "death of child" }
23 if (signam == "CLD") { msg[signum] = "death of child" }
24 if (signam == "CONT") { msg[signum] = "continued" }
25 if (signam == "EMT") { msg[signum] = "EMT instruction" }
26 if (signam == "FPE") { msg[signum] = "floating point exception" }
27 if (signam == "HUP") { msg[signum] = "hangup" }
28 if (signam == "ILL") { msg[signum] = "illegal hardware instruction" }
29 if (signam == "INFO") { msg[signum] = "status request from keyboard" }
30 if (signam == "INT") { msg[signum] = "interrupt" }
31 if (signam == "IO") { msg[signum] = "i/o ready" }
32 if (signam == "IOT") { msg[signum] = "IOT instruction" }
33 if (signam == "KILL") { msg[signum] = "killed" }
34 if (signam == "LOST") { msg[signum] = "resource lost" }
35 if (signam == "PIPE") { msg[signum] = "broken pipe" }
36 if (signam == "POLL") { msg[signum] = "pollable event occurred" }
37 if (signam == "PROF") { msg[signum] = "profile signal" }
38 if (signam == "PWR") { msg[signum] = "power fail" }
39 if (signam == "QUIT") { msg[signum] = "quit" }
40 if (signam == "SEGV") { msg[signum] = "segmentation fault" }
41 if (signam == "SYS") { msg[signum] = "invalid system call" }
42 if (signam == "TERM") { msg[signum] = "terminated" }
43 if (signam == "TRAP") { msg[signum] = "trace trap" }
44 if (signam == "URG") { msg[signum] = "urgent condition" }
45 if (signam == "USR1") { msg[signum] = "user-defined signal 1" }
46 if (signam == "USR2") { msg[signum] = "user-defined signal 2" }
47 if (signam == "VTALRM") { msg[signum] = "virtual time alarm" }
48 if (signam == "WINCH") { msg[signum] = "window size changed" }
49 if (signam == "XCPU") { msg[signum] = "cpu limit exceeded" }
50 if (signam == "XFSZ") { msg[signum] = "file size limit exceeded" }
56 ifdstr = sprintf("\t%cstopped%s%c,\n", 34, ps, 34)
59 print " * sigmsg.h -- architecture-customized signal messages for nmh"
61 print " * automatically generated by sigmsg.awk"
63 printf("%s %d\n\n", "#define SIGCOUNT", max)
64 print "char *sigmsg[SIGCOUNT+2] = {"
67 for (i = 1; i <= 0 + max; i++)
71 else if (sig[i] == "STOP")
72 printf ifdstr, " (signal)", " (signal)"
73 else if (sig[i] == "TSTP")
75 else if (sig[i] == "TTIN")
76 printf ifdstr, " (tty input)", " (tty input)"
77 else if (sig[i] == "TTOU")
78 printf ifdstr, " (tty output)", " (tty output)"
80 printf("\t%cSIG%s%c,\n", 34, sig[i], 34)
82 printf("\t%c%s%c,\n", 34, msg[i], 34)