Revision 12459,
1.1 KB
checked in by danw, 26 years ago
(diff) |
comment out text after #else and #endif
|
Rev | Line | |
---|
[218] | 1 | /* |
---|
[1927] | 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 | /* |
---|
[218] | 9 | * Routines for dealing with ^C while running program. |
---|
| 10 | * |
---|
| 11 | * Stan picked the names, not me.. |
---|
| 12 | */ |
---|
[335] | 13 | #ifndef lint |
---|
[12459] | 14 | static char *rcsid_discuss_c = "$Id: interrupt.c,v 1.8 1999-02-08 14:46:48 danw Exp $"; |
---|
| 15 | #endif /* lint */ |
---|
[218] | 16 | |
---|
| 17 | #include <signal.h> |
---|
[12439] | 18 | #if HAVE_SIGACTION |
---|
[7166] | 19 | struct sigaction act, oact; |
---|
| 20 | #endif |
---|
[218] | 21 | |
---|
| 22 | int interrupt = 0; |
---|
[12439] | 23 | #if !HAVE_SIGACTION |
---|
| 24 | static RETSIGTYPE (*old_interrupt_handler)() = SIG_DFL; |
---|
[7166] | 25 | #endif |
---|
[218] | 26 | static void |
---|
[1884] | 27 | interrupt_handler(dummy) |
---|
| 28 | int dummy; |
---|
[218] | 29 | { |
---|
| 30 | interrupt = 1; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | void |
---|
| 34 | flag_interrupts() |
---|
| 35 | { |
---|
| 36 | interrupt = 0; |
---|
[12439] | 37 | #if HAVE_SIGACTION |
---|
[7166] | 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 |
---|
[218] | 43 | old_interrupt_handler = signal (SIGINT, interrupt_handler); |
---|
[7166] | 44 | #endif |
---|
[218] | 45 | } |
---|
| 46 | |
---|
| 47 | void |
---|
| 48 | dont_flag_interrupts() |
---|
| 49 | { |
---|
[12439] | 50 | #if HAVE_SIGACTION |
---|
[7166] | 51 | (void) sigaction (SIGINT, &oact, (struct sigaction *)0); |
---|
| 52 | #else |
---|
[218] | 53 | (void) signal (SIGINT, old_interrupt_handler); |
---|
[7166] | 54 | #endif |
---|
[218] | 55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.