blob: e54d99df2f00f21512f2e6ec15452148c585613d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <signal.h>
main()
{
/*
* Declare handler routine so we can use its name.
*/
extern int handler();
/*
* Send signal to handler routine.
*/
signal(SIGINT, handler);
/*
* Loop here.
*/
for (;;)
pause();
}
/*
* handler--handle the signal.
*/
handler()
{
/*
* Users of 4.2 and 4.3BSD systems should un-comment
* this line, which will make this program
* behave as if it were on a non-Berkeley system.
*/
/* signal(SIGINT, SIG_DFL); */
printf("OUCH\n");
}
|