source: trunk/athena/bin/discuss/client/interrupt.c @ 24177

Revision 24177, 1.1 KB checked in by broder, 15 years ago (diff)
In discuss: * Stop using the obsolete AC_TYPE_SIGNAL. (Trac: #347)
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
14static 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
19struct sigaction act, oact;
20#endif
21
22int interrupt = 0;
23#if !HAVE_SIGACTION
24static void (*old_interrupt_handler)() = SIG_DFL;
25#endif
26static void
27interrupt_handler(dummy)
28int dummy;
29{
30        interrupt = 1;
31}
32
33void
34flag_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
47void
48dont_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.