Warning: That file was not part of the compilation database. It may have many parsing errors.

1#include <signal.h>
2#include <stdio.h>
3#include <stdlib.h>
4#include <string.h>
5
6int win = 0;
7
8static void
9handler (int sig)
10{
11 printf ("Received signal %d (%s).\n", sig, strsignal(sig));
12 win = 1;
13}
14
15int
16main (void)
17{
18 if (signal (SIGTERM, handler) == SIG_ERR)
19 {
20 perror ("signal: SIGTERM");
21 exit (EXIT_FAILURE);
22 }
23
24 puts ("Set handler.");
25
26 printf ("Sending myself signal %d.\n", SIGTERM);
27 fflush (stdout);
28
29 if (raise (SIGTERM) < 0)
30 {
31 perror ("raise: SIGTERM");
32 exit (EXIT_FAILURE);
33 }
34
35 if (!win)
36 {
37 puts ("Didn't get any signal. Test FAILED!");
38 exit (EXIT_FAILURE);
39 }
40
41 puts ("Got a signal. Test succeeded.");
42
43 return EXIT_SUCCESS;
44}
45

Warning: That file was not part of the compilation database. It may have many parsing errors.