source: tools/catchsig.c @ c60ef639

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since c60ef639 was 6f9cc13, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

formatting

  • Property mode set to 100644
File size: 578 bytes
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <signal.h>
4
5void sig_handler(int signo)
6{
7        fprintf(stderr, "received %d\n", signo);
8        exit(0);
9}
10
11void sig(int signo) {
12        if (signal(signo, sig_handler) == SIG_ERR)
13        {
14                fprintf(stderr,"Error\n");
15                exit(1);
16        }
17}
18
19int main(void)
20{
21        printf("Starting...\n");
22        sig(SIGHUP);
23        sig(SIGINT);
24        sig(SIGQUIT);
25        sig(SIGILL);
26        sig(SIGABRT);
27        sig(SIGFPE);
28        sig(SIGSEGV);
29        sig(SIGPIPE);
30        sig(SIGALRM);
31        sig(SIGTERM);
32        sig(SIGUSR1);
33        sig(SIGUSR2);
34        sig(SIGCHLD);
35        sig(SIGCONT);
36        sig(SIGTSTP);
37        sig(SIGTTIN);
38        sig(SIGTTOU);
39        while(1);
40        return 0;
41}
Note: See TracBrowser for help on using the repository browser.