1 /*   -*- buffer-read-only: t -*- vi: set ro:
2  *
3  *  DO NOT EDIT THIS FILE   (strsignal.h)
4  *
5  *  It has been AutoGen-ed
6  *  From the definitions    strsignal.def
7  *  and the template file   strsignal
8  *
9  *  Generated for a 4.15.0-20-generic Linux platform
10  *
11  *  strsignal Copyright (C) 1992-2017 by Bruce Korb - all rights reserved
12  *
13  *  AutoGen is free software: you can redistribute it and/or modify it
14  *  under the terms of the GNU General Public License as published by the
15  *  Free Software Foundation, either version 3 of the License, or
16  *  (at your option) any later version.
17  *
18  *  AutoGen is distributed in the hope that it will be useful, but
19  *  WITHOUT ANY WARRANTY; without even the implied warranty of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21  *  See the GNU General Public License for more details.
22  *
23  *  You should have received a copy of the GNU General Public License along
24  *  with this program.  If not, see <http://www.gnu.org/licenses/>.
25  */
26 #ifndef MAX_SIGNAL_NUMBER
27 #define MAX_SIGNAL_NUMBER   22
28 #define SIGNAL_IN_RANGE(s)  (((unsigned)s) <= MAX_SIGNAL_NUMBER)
29 #define SIGNAL_NAME(s)      (zSigNames + sigNameOffset[s])
30 #define SIGNAL_INFO(s)      (zSigInfo  + sigInfoOffset[s])
31 
32 static char const zSigNames[] =
33     "INVALID\0"    "SIGSIGHUP\0"  "SIGSIGINT\0"  "SIGSIGQUIT\0" "SIGSIGILL\0"
34     "SIGSIGTRAP\0" "SIGSIGABRT\0" "SIGSIGFPE\0"  "SIGSIGKILL\0" "SIGSIGUSR1\0"
35     "SIGSIGSEGV\0" "SIGSIGUSR2\0" "SIGSIGPIPE\0" "SIGSIGALRM\0" "SIGSIGTERM\0"
36     "SIGSIGCHLD\0" "SIGSIGCONT\0" "SIGSIGSTOP\0" "SIGSIGTSTP\0" "SIGSIGTTIN\0"
37     "SIGSIGTTOU\0";
38 
39 static const unsigned int sigNameOffset[] = {
40     0,   8,   18,  28,  39,  49,  60,  0,   71,  81,  92,  103, 114, 125, 136,
41     147, 0,   158, 169, 180, 191, 202, 213 };
42 
43 #ifndef HAVE_SYS_SIGLIST
44 static char const zSigInfo[] =
45     /*   0 */ "Signal 0 invalid\0"
46     /*   1 */ "Hangup (POSIX).\0"
47     /*   2 */ "Interrupt (ANSI).\0"
48     /*   3 */ "Quit (POSIX).\0"
49     /*   4 */ "Illegal instruction (ANSI).\0"
50     /*   5 */ "Trace trap (POSIX).\0"
51     /*   6 */ "Abort (ANSI).\0"
52     /*   7 */ "Signal 7 invalid\0"
53     /*   8 */ "Floating-point exception (ANSI).\0"
54     /*   9 */ "Kill, unblockable (POSIX).\0"
55     /*  10 */ "User-defined signal 1 (POSIX).\0"
56     /*  11 */ "Segmentation violation (ANSI).\0"
57     /*  12 */ "User-defined signal 2 (POSIX).\0"
58     /*  13 */ "Broken pipe (POSIX).\0"
59     /*  14 */ "Alarm clock (POSIX).\0"
60     /*  15 */ "Termination (ANSI).\0"
61     /*  16 */ "Signal 16 invalid\0"
62     /*  17 */ "Child status has changed (POSIX).\0"
63     /*  18 */ "Continue (POSIX).\0"
64     /*  19 */ "Stop, unblockable (POSIX).\0"
65     /*  20 */ "Keyboard stop (POSIX).\0"
66     /*  21 */ "Background read from tty (POSIX).\0"
67     /*  22 */ "Background write to tty (POSIX).\0";
68 
69 static const unsigned int sigInfoOffset[] = {
70     0,   17,  33,  51,  65,  93,  113, 127, 144, 177, 204, 235, 266, 297, 318,
71     339, 359, 377, 411, 429, 456, 479, 513 };
72 
73 #endif /* MAX_SIGNAL_NUMBER */
74 
75 #ifndef HAVE_STRSIGNAL
76 extern char * strsignal( int signo );
77 #endif
78 
79 #ifdef DEBUG_STRSIGNAL
80 #include <stdio.h>
81 
82 int
main(int argc,char ** argv)83 main(int argc, char ** argv)
84 {
85     int sig = 0;
86     fputs( "Sig  Sig-Name    Description\n"
87            "===  ========    ===========\n", stdout );
88     do {
89         printf( "%3d  %-10s  %s\n", sig, SIGNAL_NAME(sig),
90                 SIGNAL_INFO(sig) );
91         ++sig;
92     } while (SIGNAL_IN_RANGE(sig));
93     return 0;
94 }
95 #endif /* DEBUG */
96 #endif /* MAX_SIGNAL_NUMBER */
97