xref: /minix3/lib/libedit/sig.h (revision 3e1db26a5a6252fcff0898d4cb0c3fa16ccf561d)
1*3e1db26aSLionel Sambuc /*	$NetBSD: sig.h,v 1.8 2009/02/19 15:20:22 christos Exp $	*/
2*3e1db26aSLionel Sambuc 
3*3e1db26aSLionel Sambuc /*-
4*3e1db26aSLionel Sambuc  * Copyright (c) 1992, 1993
5*3e1db26aSLionel Sambuc  *	The Regents of the University of California.  All rights reserved.
6*3e1db26aSLionel Sambuc  *
7*3e1db26aSLionel Sambuc  * This code is derived from software contributed to Berkeley by
8*3e1db26aSLionel Sambuc  * Christos Zoulas of Cornell University.
9*3e1db26aSLionel Sambuc  *
10*3e1db26aSLionel Sambuc  * Redistribution and use in source and binary forms, with or without
11*3e1db26aSLionel Sambuc  * modification, are permitted provided that the following conditions
12*3e1db26aSLionel Sambuc  * are met:
13*3e1db26aSLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14*3e1db26aSLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15*3e1db26aSLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16*3e1db26aSLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17*3e1db26aSLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18*3e1db26aSLionel Sambuc  * 3. Neither the name of the University nor the names of its contributors
19*3e1db26aSLionel Sambuc  *    may be used to endorse or promote products derived from this software
20*3e1db26aSLionel Sambuc  *    without specific prior written permission.
21*3e1db26aSLionel Sambuc  *
22*3e1db26aSLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*3e1db26aSLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*3e1db26aSLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*3e1db26aSLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*3e1db26aSLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*3e1db26aSLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*3e1db26aSLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*3e1db26aSLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*3e1db26aSLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*3e1db26aSLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*3e1db26aSLionel Sambuc  * SUCH DAMAGE.
33*3e1db26aSLionel Sambuc  *
34*3e1db26aSLionel Sambuc  *	@(#)sig.h	8.1 (Berkeley) 6/4/93
35*3e1db26aSLionel Sambuc  */
36*3e1db26aSLionel Sambuc 
37*3e1db26aSLionel Sambuc /*
38*3e1db26aSLionel Sambuc  * el.sig.h: Signal handling functions
39*3e1db26aSLionel Sambuc  */
40*3e1db26aSLionel Sambuc #ifndef _h_el_sig
41*3e1db26aSLionel Sambuc #define	_h_el_sig
42*3e1db26aSLionel Sambuc 
43*3e1db26aSLionel Sambuc #include <signal.h>
44*3e1db26aSLionel Sambuc 
45*3e1db26aSLionel Sambuc #include "histedit.h"
46*3e1db26aSLionel Sambuc 
47*3e1db26aSLionel Sambuc /*
48*3e1db26aSLionel Sambuc  * Define here all the signals we are going to handle
49*3e1db26aSLionel Sambuc  * The _DO macro is used to iterate in the source code
50*3e1db26aSLionel Sambuc  */
51*3e1db26aSLionel Sambuc #define	ALLSIGS		\
52*3e1db26aSLionel Sambuc 	_DO(SIGINT)	\
53*3e1db26aSLionel Sambuc 	_DO(SIGTSTP)	\
54*3e1db26aSLionel Sambuc 	_DO(SIGQUIT)	\
55*3e1db26aSLionel Sambuc 	_DO(SIGHUP)	\
56*3e1db26aSLionel Sambuc 	_DO(SIGTERM)	\
57*3e1db26aSLionel Sambuc 	_DO(SIGCONT)	\
58*3e1db26aSLionel Sambuc 	_DO(SIGWINCH)
59*3e1db26aSLionel Sambuc #define ALLSIGSNO	7
60*3e1db26aSLionel Sambuc 
61*3e1db26aSLionel Sambuc typedef struct {
62*3e1db26aSLionel Sambuc 	struct sigaction sig_action[ALLSIGSNO];
63*3e1db26aSLionel Sambuc 	sigset_t sig_set;
64*3e1db26aSLionel Sambuc 	volatile sig_atomic_t sig_no;
65*3e1db26aSLionel Sambuc } *el_signal_t;
66*3e1db26aSLionel Sambuc 
67*3e1db26aSLionel Sambuc protected void	sig_end(EditLine*);
68*3e1db26aSLionel Sambuc protected int	sig_init(EditLine*);
69*3e1db26aSLionel Sambuc protected void	sig_set(EditLine*);
70*3e1db26aSLionel Sambuc protected void	sig_clr(EditLine*);
71*3e1db26aSLionel Sambuc 
72*3e1db26aSLionel Sambuc #endif /* _h_el_sig */
73