1 
2 /**
3  * \file strsignal.c
4  *
5  *  This file is part of AutoGen.
6  *
7  *  AutoGen Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
8  *
9  *  AutoGen is free software: you can redistribute it and/or modify it
10  *  under the terms of the GNU General Public License as published by the
11  *  Free Software Foundation, either version 3 of the License, or
12  *  (at your option) any later version.
13  *
14  *  AutoGen is distributed in the hope that it will be useful, but
15  *  WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17  *  See the GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License along
20  *  with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  *  As a special exception, Bruce Korb gives permission for additional
23  *  uses of the text contained in the release of strsignal.
24  *
25  *  The exception is that, if you link the strsignal library with other
26  *  files to produce an executable, this does not by itself cause the
27  *  resulting executable to be covered by the GNU General Public License.
28  *  Your use of that executable is in no way restricted on account of
29  *  linking the strsignal library code into it.
30  *
31  *  This exception does not however invalidate any other reasons why
32  *  the executable file might be covered by the GNU General Public License.
33  *
34  *  This exception applies only to the code released by Bruce Korb under
35  *  the name strsignal.  If you copy code from other sources under the
36  *  General Public License into a copy of strsignal, as the General Public
37  *  License permits, the exception does not apply to the code that you add
38  *  in this way.  To avoid misleading anyone as to the status of such
39  *  modified files, you must delete this exception notice from them.
40  *
41  *  If you write modifications of your own for strsignal, it is your choice
42  *  whether to permit this exception to apply to your modifications.
43  *  If you do not wish that, delete this exception notice.
44  */
45 
46 #include "compat.h"
47 
48 /*  Routines imported from standard C runtime libraries. */
49 
50 #if ! defined(HAVE_STRSIGNAL)
51 
52 #ifdef __STDC__
53 # include <stddef.h>
54 #else   /* !__STDC__ */
55 #  ifndef const
56 #    define const
57 #  endif
58 #endif  /* __STDC__ */
59 
60 #ifdef HAVE_SYS_SIGLIST
61 #  include <signal.h>
62 #endif
63 
64 /*
65  *  Import the generated tables
66  */
67 #include "strsignal.h"
68 #endif
69 
70 #ifndef HAVE_STRSIGNAL
71 
72 /*
73 
74 NAME
75 
76     strsignal -- map a signal number to a signal message string
77 
78 SYNOPSIS
79 
80     char *strsignal (int signo)
81 
82 DESCRIPTION
83 
84     Maps an signal number to an signal message string, the contents of
85     which are implementation defined.  On systems which have the external
86     variable sys_siglist, these strings will be the same as the ones used
87     by psignal().
88 
89     If the supplied signal number is within the valid range of indices
90     for the sys_siglist, but no message is available for the particular
91     signal number, then returns the string "Signal NUM", where NUM is the
92     signal number.
93 
94     If the supplied signal number is not a valid index into sys_siglist,
95     returns NULL.
96 
97     The returned string is only guaranteed to be valid only until the
98     next call to strsignal.
99 
100     Also, though not declared "const", it is.
101 */
102 
103 char *
strsignal(int signo)104 strsignal( int signo )
105 {
106     if (SIGNAL_IN_RANGE( signo ))
107         return (char *)SIGNAL_INFO( signo );
108 
109     return NULL;
110 }
111 #endif  /* HAVE_STRSIGNAL */
112 
113 /*
114  * Local Variables:
115  * mode: C
116  * c-file-style: "stroustrup"
117  * indent-tabs-mode: nil
118  * End:
119  * end of compat/strsignal.c */
120