check against the correct class. cast the value to bool before setting.
[AROS.git] / test / clib / raise.c
blobbca2118d2aa28b69e673dd2b66f2f8def2d6bad3
1 /*
2 Copyright © 2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Test program for the arosc's raise() and signal() functions.
6 */
7 #include <signal.h>
8 #include <stdio.h>
10 void sigill(int sig)
12 (void)sig;
14 puts("Catched illegal instruction signal");
17 void sigsegv(int sig)
19 static int call = 0;
21 (void)sig;
23 call++;
24 printf("sigsegv call %d\n", call);
26 if (call == 1)
27 raise(SIGSEGV);
30 int main(void)
32 puts("Setting signals");
33 signal(SIGFPE, SIG_IGN);
34 signal(SIGILL, sigill);
35 signal(SIGSEGV, sigsegv);
37 puts("\nRaising SIGFPE (ignored)");
38 raise(SIGFPE);
40 puts("\nRaising SIGILL (catched)");
41 raise(SIGILL);
43 puts("\nRaising SIGSEGV (nested 2 times)");
44 raise(SIGSEGV);
46 puts("\nRaising SIGABRT (not catched)");
47 raise(SIGABRT);
49 return 0;