2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 static char copyright
[] =
39 "@(#) Copyright (c) 1991, 1993\n\
40 The Regents of the University of California. All rights reserved.\n";
44 static char sccsid
[] = "@(#)mksignames.c 8.1 (Berkeley) 5/31/93";
48 * This program generates the signames.h and signames.c files.
54 int main(int argc
, char *argv
[]);
57 int signo
; /* signal number */
58 char *name
; /* signal name (without leading "SIG") */
59 char *mesg
; /* description */
63 struct sig sigtab
[] = {
64 SIGHUP
, "HUP", "Hangup",
65 SIGINT
, "INT", "Interrupt", /* normally don't print message */
66 SIGQUIT
, "QUIT", "Quit",
67 SIGILL
, "ILL", "Illegal instruction",
68 SIGTRAP
, "TRAP", "Trace/BPT trap",
70 SIGABRT
, "ABRT", "abort",
72 #if defined(SIGIOT) && (! defined(SIGABRT) || SIGABRT != SIGIOT)
73 SIGIOT
, "IOT", "abort",
76 SIGEMT
, "EMT", "EMT trap",
78 SIGFPE
, "FPE", "Floating exception",
79 SIGKILL
, "KILL", "Killed",
80 SIGBUS
, "BUS", "Bus error",
81 SIGSEGV
, "SEGV", "Memory fault",
83 SIGSYS
, "SYS", "Bad system call",
85 SIGPIPE
, "PIPE", "Broken pipe", /* normally don't print message */
86 SIGALRM
, "ALRM", "Alarm call",
87 SIGTERM
, "TERM", "Terminated",
89 SIGUSR1
, "USR1", "User signal 1",
92 SIGUSR2
, "USR2", "User signal 2",
97 #if defined(SIGCHLD) && ! defined(SIGCLD)
101 SIGPWR
, "PWR", "Power fail",
104 SIGPOLL
, "POLL", "Poll",
106 /* Now for the BSD signals */
111 SIGSTOP
, "STOP", "Stopped",
114 SIGTSTP
, "TSTP", "Stopped",
117 SIGCONT
, "CONT", NULL
,
120 SIGTTIN
, "TTIN", "Stopped (input)",
123 SIGTTOU
, "TTOU", "Stopped (output)",
129 SIGXCPU
, "XCPU", "Time limit exceeded",
132 SIGXFSZ
, "XFSZ", NULL
,
135 SIGVTALRM
, "VTALARM", "Virtual alarm",
138 SIGPROF
, "PROF", "Profiling alarm",
141 SIGWINCH
, "WINCH", NULL
,
150 char *sigmesg
[MAXSIG
+ 1];
155 * This file was generated by the mksignames program.\n\
161 main(argc
, argv
) char **argv
; {
167 if ((cfile
= fopen("signames.c", "w")) == NULL
) {
168 fputs("Can't create signames.c\n", stderr
);
171 if ((hfile
= fopen("signames.h", "w")) == NULL
) {
172 fputs("Can't create signames.h\n", stderr
);
176 for (sigp
= sigtab
; sigp
->signo
!= 0 ; sigp
++) {
177 if (sigp
->signo
< 0 || sigp
->signo
> MAXSIG
)
179 sigmesg
[sigp
->signo
] = sigp
->mesg
;
180 if (maxsig
< sigp
->signo
)
181 maxsig
= sigp
->signo
;
184 fputs(writer
, hfile
);
185 fprintf(hfile
, "#define MAXSIG %d\n\n", maxsig
);
186 fprintf(hfile
, "extern char *const sigmesg[MAXSIG+1];\n");
188 fputs(writer
, cfile
);
189 fprintf(cfile
, "#include \"shell.h\"\n\n");
190 fprintf(cfile
, "char *const sigmesg[%d] = {\n", maxsig
+ 1);
191 for (i
= 0 ; i
<= maxsig
; i
++) {
192 if (sigmesg
[i
] == NULL
) {
193 fprintf(cfile
, " 0,\n");
195 fprintf(cfile
, " \"%s\",\n", sigmesg
[i
]);
198 fprintf(cfile
, "};\n");
203 * $PchId: mksignames.c,v 1.2 2001/05/14 19:22:26 philip Exp $