| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $ */ | | 1 | /* $NetBSD: tty.c,v 1.70 2021/07/14 07:47:23 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1992, 1993 | | 4 | * Copyright (c) 1992, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Christos Zoulas of Cornell University. | | 8 | * Christos Zoulas of Cornell University. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include "config.h" | | 35 | #include "config.h" |
36 | #if !defined(lint) && !defined(SCCSID) | | 36 | #if !defined(lint) && !defined(SCCSID) |
37 | #if 0 | | 37 | #if 0 |
38 | static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; | | 38 | static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; |
39 | #else | | 39 | #else |
40 | __RCSID("$NetBSD: tty.c,v 1.69 2020/05/31 23:24:23 christos Exp $"); | | 40 | __RCSID("$NetBSD: tty.c,v 1.70 2021/07/14 07:47:23 christos Exp $"); |
41 | #endif | | 41 | #endif |
42 | #endif /* not lint && not SCCSID */ | | 42 | #endif /* not lint && not SCCSID */ |
43 | | | 43 | |
44 | /* | | 44 | /* |
45 | * tty.c: tty interface stuff | | 45 | * tty.c: tty interface stuff |
46 | */ | | 46 | */ |
47 | #include <assert.h> | | 47 | #include <assert.h> |
48 | #include <errno.h> | | 48 | #include <errno.h> |
49 | #include <stdlib.h> /* for abort */ | | 49 | #include <stdlib.h> /* for abort */ |
50 | #include <string.h> | | 50 | #include <string.h> |
51 | #include <strings.h> /* for ffs */ | | 51 | #include <strings.h> /* for ffs */ |
52 | #include <unistd.h> /* for isatty */ | | 52 | #include <unistd.h> /* for isatty */ |
53 | | | 53 | |
| @@ -1340,33 +1340,33 @@ tty_setup_flags(EditLine *el, struct ter | | | @@ -1340,33 +1340,33 @@ tty_setup_flags(EditLine *el, struct ter |
1340 | *f = tty_update_flag(el, *f, mode, kind); | | 1340 | *f = tty_update_flag(el, *f, mode, kind); |
1341 | } | | 1341 | } |
1342 | } | | 1342 | } |
1343 | | | 1343 | |
1344 | libedit_private int | | 1344 | libedit_private int |
1345 | tty_get_signal_character(EditLine *el, int sig) | | 1345 | tty_get_signal_character(EditLine *el, int sig) |
1346 | { | | 1346 | { |
1347 | #ifdef ECHOCTL | | 1347 | #ifdef ECHOCTL |
1348 | tcflag_t *ed = tty__get_flag(&el->el_tty.t_ed, MD_INP); | | 1348 | tcflag_t *ed = tty__get_flag(&el->el_tty.t_ed, MD_INP); |
1349 | if ((*ed & ECHOCTL) == 0) | | 1349 | if ((*ed & ECHOCTL) == 0) |
1350 | return -1; | | 1350 | return -1; |
1351 | #endif | | 1351 | #endif |
1352 | switch (sig) { | | 1352 | switch (sig) { |
1353 | #ifdef SIGINT | | 1353 | #if defined(SIGINT) && defined(VINTR) |
1354 | case SIGINT: | | 1354 | case SIGINT: |
1355 | return el->el_tty.t_c[ED_IO][VINTR]; | | 1355 | return el->el_tty.t_c[ED_IO][VINTR]; |
1356 | #endif | | 1356 | #endif |
1357 | #ifdef SIGQUIT | | 1357 | #if defined(SIGQUIT) && defined(VQUIT) |
1358 | case SIGQUIT: | | 1358 | case SIGQUIT: |
1359 | return el->el_tty.t_c[ED_IO][VQUIT]; | | 1359 | return el->el_tty.t_c[ED_IO][VQUIT]; |
1360 | #endif | | 1360 | #endif |
1361 | #ifdef SIGINFO | | 1361 | #if defined(SIGINFO) && defined(VSTATUS) |
1362 | case SIGINFO: | | 1362 | case SIGINFO: |
1363 | return el->el_tty.t_c[ED_IO][VSTATUS]; | | 1363 | return el->el_tty.t_c[ED_IO][VSTATUS]; |
1364 | #endif | | 1364 | #endif |
1365 | #ifdef SIGTSTP | | 1365 | #if defined(SIGTSTP) && defined(VSUSP) |
1366 | case SIGTSTP: | | 1366 | case SIGTSTP: |
1367 | return el->el_tty.t_c[ED_IO][VSUSP]; | | 1367 | return el->el_tty.t_c[ED_IO][VSUSP]; |
1368 | #endif | | 1368 | #endif |
1369 | default: | | 1369 | default: |
1370 | return -1; | | 1370 | return -1; |
1371 | } | | 1371 | } |
1372 | } | | 1372 | } |