1 /* mksignames.c -- Create and write `signames.h', which contains an array of
4 /* Copyright (C) 1992-2020 Free Software Foundation, Inc.
6 This file is part of GNU Bush, the Bourne Again SHell.
8 Bush is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 Bush is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Bush. If not, see <http://www.gnu.org/licenses/>.
24 #include <sys/types.h>
28 #if defined (HAVE_STDLIB_H)
31 # include "ansi_stdlib.h"
32 #endif /* HAVE_STDLIB_H */
34 /* Duplicated from signames.c */
39 #define LASTSIG NSIG+2
41 /* Imported from signames.c */
42 extern void initialize_signames ();
43 extern char *signal_names
[];
48 write_signames (stream
)
53 fprintf (stream
, "/* This file was automatically created by %s.\n",
55 fprintf (stream
, " Do not edit. Edit support/mksignames.c instead. */\n\n");
57 "/* A translation list so we can be polite to our users. */\n");
58 #if defined (CROSS_COMPILING)
59 fprintf (stream
, "extern char *signal_names[];\n\n");
60 fprintf (stream
, "extern void initialize_signames PARAMS((void));\n\n");
62 fprintf (stream
, "char *signal_names[NSIG + 4] = {\n");
64 for (i
= 0; i
<= LASTSIG
; i
++)
65 fprintf (stream
, " \"%s\",\n", signal_names
[i
]);
67 fprintf (stream
, " (char *)0x0\n");
68 fprintf (stream
, "};\n\n");
69 fprintf (stream
, "#define initialize_signames()\n\n");
85 stream_name
= "stdout";
90 stream_name
= argv
[1];
91 stream
= fopen (stream_name
, "w");
95 fprintf (stderr
, "Usage: %s [output-file]\n", progname
);
101 fprintf (stderr
, "%s: %s: cannot open for writing\n",
102 progname
, stream_name
);
106 #if !defined (CROSS_COMPILING)
107 initialize_signames ();
109 write_signames (stream
);