Revision 12459,
1.1 KB
checked in by danw, 26 years ago
(diff) |
comment out text after #else and #endif
|
Line | |
---|
1 | /* |
---|
2 | * |
---|
3 | * Copyright (C) 1989 by the Massachusetts Institute of Technology |
---|
4 | * Developed by the MIT Student Information Processing Board (SIPB). |
---|
5 | * For copying information, see the file mit-copyright.h in this release. |
---|
6 | * |
---|
7 | */ |
---|
8 | /* |
---|
9 | * Routines for dealing with ^C while running program. |
---|
10 | * |
---|
11 | * Stan picked the names, not me.. |
---|
12 | */ |
---|
13 | #ifndef lint |
---|
14 | static char *rcsid_discuss_c = "$Id: interrupt.c,v 1.8 1999-02-08 14:46:48 danw Exp $"; |
---|
15 | #endif /* lint */ |
---|
16 | |
---|
17 | #include <signal.h> |
---|
18 | #if HAVE_SIGACTION |
---|
19 | struct sigaction act, oact; |
---|
20 | #endif |
---|
21 | |
---|
22 | int interrupt = 0; |
---|
23 | #if !HAVE_SIGACTION |
---|
24 | static RETSIGTYPE (*old_interrupt_handler)() = SIG_DFL; |
---|
25 | #endif |
---|
26 | static void |
---|
27 | interrupt_handler(dummy) |
---|
28 | int dummy; |
---|
29 | { |
---|
30 | interrupt = 1; |
---|
31 | } |
---|
32 | |
---|
33 | void |
---|
34 | flag_interrupts() |
---|
35 | { |
---|
36 | interrupt = 0; |
---|
37 | #if HAVE_SIGACTION |
---|
38 | sigemptyset(&act.sa_mask); |
---|
39 | act.sa_flags = 0; |
---|
40 | act.sa_handler= (void (*)()) interrupt_handler; |
---|
41 | (void) sigaction(SIGINT, &act, &oact); |
---|
42 | #else |
---|
43 | old_interrupt_handler = signal (SIGINT, interrupt_handler); |
---|
44 | #endif |
---|
45 | } |
---|
46 | |
---|
47 | void |
---|
48 | dont_flag_interrupts() |
---|
49 | { |
---|
50 | #if HAVE_SIGACTION |
---|
51 | (void) sigaction (SIGINT, &oact, (struct sigaction *)0); |
---|
52 | #else |
---|
53 | (void) signal (SIGINT, old_interrupt_handler); |
---|
54 | #endif |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.