select: Fix "warning: no previous prototype for function".
[gnulib.git] / lib / sigabbrev_np.c
blobf1c45aa806744c9ae9fc11c39c99470a2741b0b4
1 /* Abbreviated name of signals.
2 Copyright (C) 2020 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2020. */
19 #include <config.h>
21 /* Specification. */
22 #include <string.h>
24 #include <signal.h>
26 const char *
27 sigabbrev_np (int sig)
29 switch (sig)
31 /* Signals specified by ISO C. */
32 case SIGABRT: return "ABRT";
33 case SIGFPE: return "FPE";
34 case SIGILL: return "ILL";
35 case SIGINT: return "INT";
36 case SIGSEGV: return "SEGV";
37 case SIGTERM: return "TERM";
39 /* Signals specified by POSIX.
40 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html> */
41 #if defined SIGALRM
42 case SIGALRM: return "ALRM";
43 #endif
44 #if defined SIGBUS
45 case SIGBUS: return "BUS";
46 #endif
47 #if defined SIGCHLD
48 case SIGCHLD: return "CHLD";
49 #endif
50 #if defined SIGCONT
51 case SIGCONT: return "CONT";
52 #endif
53 #if defined SIGHUP
54 case SIGHUP: return "HUP";
55 #endif
56 #if defined SIGKILL
57 case SIGKILL: return "KILL";
58 #endif
59 #if defined SIGPIPE
60 case SIGPIPE: return "PIPE";
61 #endif
62 #if defined SIGQUIT
63 case SIGQUIT: return "QUIT";
64 #endif
65 #if defined SIGSTOP
66 case SIGSTOP: return "STOP";
67 #endif
68 #if defined SIGTSTP
69 case SIGTSTP: return "TSTP";
70 #endif
71 #if defined SIGTTIN
72 case SIGTTIN: return "TTIN";
73 #endif
74 #if defined SIGTTOU
75 case SIGTTOU: return "TTOU";
76 #endif
77 #if defined SIGUSR1
78 case SIGUSR1: return "USR1";
79 #endif
80 #if defined SIGUSR2
81 case SIGUSR2: return "USR2";
82 #endif
83 #if defined SIGPOLL
84 case SIGPOLL: return "POLL";
85 #endif
86 #if defined SIGPROF
87 case SIGPROF: return "PROF";
88 #endif
89 #if defined SIGSYS
90 case SIGSYS: return "SYS";
91 #endif
92 #if defined SIGTRAP
93 case SIGTRAP: return "TRAP";
94 #endif
95 #if defined SIGURG
96 case SIGURG: return "URG";
97 #endif
98 #if defined SIGVTALRM
99 case SIGVTALRM: return "VTALRM";
100 #endif
101 #if defined SIGXCPU
102 case SIGXCPU: return "XCPU";
103 #endif
104 #if defined SIGXFSZ
105 case SIGXFSZ: return "XFSZ";
106 #endif
108 /* Other signals on other systems. */
109 /* native Windows */
110 #if defined SIGBREAK
111 case SIGBREAK: return "BREAK";
112 #endif
113 /* IRIX */
114 #if defined SIGCKPT
115 case SIGCKPT: return "CKPT";
116 #endif
117 /* Linux, IRIX, Cygwin */
118 #if defined SIGCLD && SIGCLD != SIGCHLD
119 case SIGCLD: return "CLD";
120 #endif
121 /* AIX */
122 #if defined SIGCPUFAIL
123 case SIGCPUFAIL: return "CPUFAIL";
124 #endif
125 /* AIX */
126 #if defined SIGDANGER
127 case SIGDANGER: return "DANGER";
128 #endif
129 /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin, mingw */
130 #if defined SIGEMT
131 case SIGEMT: return "EMT";
132 #endif
133 /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix */
134 #if defined SIGINFO
135 case SIGINFO: return "INFO";
136 #endif
137 /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin */
138 #if defined SIGIO && SIGIO != SIGPOLL
139 case SIGIO: return "IO";
140 #endif
141 /* Linux, IRIX, Cygwin, mingw */
142 #if defined SIGIOT && SIGIOT != SIGABRT
143 case SIGIOT: return "IOT";
144 #endif
145 /* AIX */
146 #if defined SIGKAP
147 case SIGKAP: return "KAP";
148 #endif
149 /* Haiku */
150 #if defined SIGKILLTHR
151 case SIGKILLTHR: return "KILLTHR";
152 #endif
153 /* Minix */
154 #if defined SIGKMEM
155 case SIGKMEM: return "KMEM";
156 #endif
157 /* Minix */
158 #if defined SIGKMESS
159 case SIGKMESS: return "KMESS";
160 #endif
161 /* Minix */
162 #if defined SIGKSIG
163 case SIGKSIG: return "KSIG";
164 #endif
165 /* Minix */
166 #if defined SIGKSIGSM
167 case SIGKSIGSM: return "KSIGSM";
168 #endif
169 /* FreeBSD */
170 #if defined SIGLIBRT
171 case SIGLIBRT: return "LIBRT";
172 #endif
173 /* Cygwin */
174 #if defined SIGLOST && SIGLOST != SIGABRT && SIGLOST != SIGPWR
175 case SIGLOST: return "LOST";
176 #endif
177 /* AIX */
178 #if defined SIGMIGRATE
179 case SIGMIGRATE: return "MIGRATE";
180 #endif
181 /* AIX */
182 #if defined SIGMSG
183 case SIGMSG: return "MSG";
184 #endif
185 /* AIX */
186 #if defined SIGPRE
187 case SIGPRE: return "PRE";
188 #endif
189 /* IRIX */
190 #if defined SIGPTINTR
191 case SIGPTINTR: return "PTINTR";
192 #endif
193 /* IRIX */
194 #if defined SIGPTRESCHED
195 case SIGPTRESCHED:return "PTRESCHED";
196 #endif
197 /* Linux, NetBSD, Minix, AIX, IRIX, Cygwin */
198 #if defined SIGPWR
199 case SIGPWR: return "PWR";
200 #endif
201 /* AIX */
202 #if defined SIGRECONFIG
203 case SIGRECONFIG: return "RECONFIG";
204 #endif
205 /* AIX */
206 #if defined SIGRECOVERY
207 case SIGRECOVERY: return "RECOVERY";
208 #endif
209 /* IRIX */
210 #if defined SIGRESTART
211 case SIGRESTART: return "RESTART";
212 #endif
213 /* AIX */
214 #if defined SIGRETRACT
215 case SIGRETRACT: return "RETRACT";
216 #endif
217 /* AIX */
218 #if defined SIGSAK
219 case SIGSAK: return "SAK";
220 #endif
221 /* Minix */
222 #if defined SIGSNDELAY
223 case SIGSNDELAY: return "SNDELAY";
224 #endif
225 /* AIX */
226 #if defined SIGSOUND
227 case SIGSOUND: return "SOUND";
228 #endif
229 /* Linux */
230 #if defined SIGSTKFLT
231 case SIGSTKFLT: return "STKFLT";
232 #endif
233 /* AIX */
234 #if defined SIGSYSERROR
235 case SIGSYSERROR: return "SYSERROR";
236 #endif
237 /* AIX */
238 #if defined SIGTALRM
239 case SIGTALRM: return "TALRM";
240 #endif
241 /* FreeBSD, OpenBSD */
242 #if defined SIGTHR
243 case SIGTHR: return "THR";
244 #endif
245 /* IRIX */
246 #if defined SIGUME
247 case SIGUME: return "UME";
248 #endif
249 /* AIX */
250 #if defined SIGVIRT
251 case SIGVIRT: return "VIRT";
252 #endif
253 /* AIX */
254 #if defined SIGWAITING
255 case SIGWAITING: return "WAITING";
256 #endif
257 /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin, Haiku */
258 #if defined SIGWINCH
259 case SIGWINCH: return "WINCH";
260 #endif
262 default:
263 return NULL;