]> git.sur5r.net Git - cc65/blob - testcode/lib/signal-test.c
Merge pull request #577 from polluks/master
[cc65] / testcode / lib / signal-test.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <errno.h>
4 #include <signal.h>
5
6
7 void __fastcall__ sighandler (int sig)
8 {
9     printf ("Got signal #%d\n", sig);
10 }
11
12
13
14 int main (void)
15 {
16     if (signal (SIGSEGV, sighandler) == SIG_ERR) {
17         printf ("signal failure %d: %s\n", errno, strerror (errno));
18         return 1;
19     }
20     printf ("About to raise SIGSEGV...\n");
21     raise (SIGSEGV);
22     printf ("Back from signal handler\n");
23     printf ("About to raise SIGILL...\n");
24     raise (SIGILL);
25     printf ("Back from signal handler\n");
26     return 0;
27 }
28
29