Deleted Added
full compact
sig.c (237448) sig.c (238173)
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Christos Zoulas of Cornell University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 15 unchanged lines hidden (view full) ---

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
1/*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Christos Zoulas of Cornell University.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 15 unchanged lines hidden (view full) ---

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $NetBSD: sig.c,v 1.15 2009/02/19 15:20:22 christos Exp $
32 * $NetBSD: sig.c,v 1.14 2009/02/18 15:04:40 christos Exp $
33 */
34
35#if !defined(lint) && !defined(SCCSID)
36static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
37#endif /* not lint && not SCCSID */
38#include <sys/cdefs.h>
33 */
34
35#if !defined(lint) && !defined(SCCSID)
36static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
37#endif /* not lint && not SCCSID */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/lib/libedit/sig.c 237448 2012-06-22 18:01:22Z pfg $");
39__FBSDID("$FreeBSD: head/lib/libedit/sig.c 238173 2012-07-06 16:43:56Z pfg $");
40
41/*
42 * sig.c: Signal handling stuff.
43 * our policy is to trap all signals, set a good state
44 * and pass the ball to our caller.
45 */
46#include "sys.h"
47#include "el.h"

--- 20 unchanged lines hidden (view full) ---

68{
69 int i;
70 sigset_t nset, oset;
71
72 (void) sigemptyset(&nset);
73 (void) sigaddset(&nset, signo);
74 (void) sigprocmask(SIG_BLOCK, &nset, &oset);
75
40
41/*
42 * sig.c: Signal handling stuff.
43 * our policy is to trap all signals, set a good state
44 * and pass the ball to our caller.
45 */
46#include "sys.h"
47#include "el.h"

--- 20 unchanged lines hidden (view full) ---

68{
69 int i;
70 sigset_t nset, oset;
71
72 (void) sigemptyset(&nset);
73 (void) sigaddset(&nset, signo);
74 (void) sigprocmask(SIG_BLOCK, &nset, &oset);
75
76 sel->el_signal->sig_no = signo;
77
78 switch (signo) {
79 case SIGCONT:
80 tty_rawmode(sel);
81 if (ed_redisplay(sel, 0) == CC_REFRESH)
82 re_refresh(sel);
83 term__flush(sel);
84 break;
85

--- 69 unchanged lines hidden (view full) ---

155protected void
156sig_set(EditLine *el)
157{
158 size_t i;
159 sigset_t oset;
160 struct sigaction osa, nsa;
161
162 nsa.sa_handler = sig_handler;
76 switch (signo) {
77 case SIGCONT:
78 tty_rawmode(sel);
79 if (ed_redisplay(sel, 0) == CC_REFRESH)
80 re_refresh(sel);
81 term__flush(sel);
82 break;
83

--- 69 unchanged lines hidden (view full) ---

153protected void
154sig_set(EditLine *el)
155{
156 size_t i;
157 sigset_t oset;
158 struct sigaction osa, nsa;
159
160 nsa.sa_handler = sig_handler;
163 nsa.sa_flags = 0;
164 sigemptyset(&nsa.sa_mask);
165
166 (void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
167
168 for (i = 0; sighdl[i] != -1; i++) {
161 sigemptyset(&nsa.sa_mask);
162
163 (void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset);
164
165 for (i = 0; sighdl[i] != -1; i++) {
166 nsa.sa_flags = SIGINT ? 0 : SA_RESTART;
169 /* This could happen if we get interrupted */
170 if (sigaction(sighdl[i], &nsa, &osa) != -1 &&
171 osa.sa_handler != sig_handler)
172 el->el_signal->sig_action[i] = osa;
173 }
174 sel = el;
175 (void) sigprocmask(SIG_SETMASK, &oset, NULL);
176}

--- 22 unchanged lines hidden ---
167 /* This could happen if we get interrupted */
168 if (sigaction(sighdl[i], &nsa, &osa) != -1 &&
169 osa.sa_handler != sig_handler)
170 el->el_signal->sig_action[i] = osa;
171 }
172 sel = el;
173 (void) sigprocmask(SIG_SETMASK, &oset, NULL);
174}

--- 22 unchanged lines hidden ---