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