Line | |
---|
1 | #include "sysincludes.h"
|
---|
2 | #include "mtools.h"
|
---|
3 |
|
---|
4 | #undef got_signal
|
---|
5 |
|
---|
6 | int got_signal = 0;
|
---|
7 |
|
---|
8 | void signal_handler(int dummy)
|
---|
9 | {
|
---|
10 | got_signal = 1;
|
---|
11 | #if 0
|
---|
12 | signal(SIGHUP, SIG_IGN);
|
---|
13 | signal(SIGINT, SIG_IGN);
|
---|
14 | signal(SIGTERM, SIG_IGN);
|
---|
15 | signal(SIGQUIT, SIG_IGN);
|
---|
16 | #endif
|
---|
17 | }
|
---|
18 |
|
---|
19 | #if 0
|
---|
20 | int do_gotsignal(char *f, int n)
|
---|
21 | {
|
---|
22 | if(got_signal)
|
---|
23 | fprintf(stderr, "file=%s line=%d\n", f, n);
|
---|
24 | return got_signal;
|
---|
25 | }
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | void setup_signal(void)
|
---|
29 | {
|
---|
30 | /* catch signals */
|
---|
31 | signal(SIGHUP, (SIG_CAST)signal_handler);
|
---|
32 | signal(SIGINT, (SIG_CAST)signal_handler);
|
---|
33 | signal(SIGTERM, (SIG_CAST)signal_handler);
|
---|
34 | signal(SIGQUIT, (SIG_CAST)signal_handler);
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.