Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libedit Add a couple more readline compat functions.
details: https://anonhg.NetBSD.org/src/rev/442007f3b5d1
branches: trunk
changeset: 446365:442007f3b5d1
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 02 16:58:13 2018 +0000
description:
Add a couple more readline compat functions.
diffstat:
lib/libedit/readline.c | 20 ++++++++++++++++++--
lib/libedit/readline/readline.h | 4 +++-
lib/libedit/tty.c | 34 ++++++++++++++++++++++++++++++++--
lib/libedit/tty.h | 3 ++-
4 files changed, 55 insertions(+), 6 deletions(-)
diffs (125 lines):
diff -r b44ee265f739 -r 442007f3b5d1 lib/libedit/readline.c
--- a/lib/libedit/readline.c Sun Dec 02 16:49:24 2018 +0000
+++ b/lib/libedit/readline.c Sun Dec 02 16:58:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.c,v 1.147 2018/06/09 17:41:55 christos Exp $ */
+/* $NetBSD: readline.c,v 1.148 2018/12/02 16:58:13 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.147 2018/06/09 17:41:55 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.148 2018/12/02 16:58:13 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -2415,3 +2415,19 @@
{
el_resize(e);
}
+
+void
+rl_reset_after_signal(void)
+{
+ if (rl_prep_term_function)
+ (*rl_prep_term_function)();
+}
+
+void
+rl_echo_signal_char(int sig)
+{
+ int c = tty_get_signal_character(e, sig);
+ if (c == -1)
+ return;
+ re_putc(e, c, 0);
+}
diff -r b44ee265f739 -r 442007f3b5d1 lib/libedit/readline/readline.h
--- a/lib/libedit/readline/readline.h Sun Dec 02 16:49:24 2018 +0000
+++ b/lib/libedit/readline/readline.h Sun Dec 02 16:58:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.h,v 1.43 2018/06/09 17:41:55 christos Exp $ */
+/* $NetBSD: readline.h,v 1.44 2018/12/02 16:58:13 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -211,6 +211,8 @@
void rl_forced_update_display(void);
int rl_set_prompt(const char *);
int rl_on_new_line(void);
+void rl_reset_after_signal(void);
+void rl_echo_signal_char(int);
/*
* The following are not implemented
diff -r b44ee265f739 -r 442007f3b5d1 lib/libedit/tty.c
--- a/lib/libedit/tty.c Sun Dec 02 16:49:24 2018 +0000
+++ b/lib/libedit/tty.c Sun Dec 02 16:58:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.67 2018/01/01 22:32:46 christos Exp $ */
+/* $NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: tty.c,v 1.67 2018/01/01 22:32:46 christos Exp $");
+__RCSID("$NetBSD: tty.c,v 1.68 2018/12/02 16:58:13 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -1341,3 +1341,33 @@
*f = tty_update_flag(el, *f, mode, kind);
}
}
+
+libedit_private int
+tty_get_signal_character(EditLine *el, int sig)
+{
+#ifdef ECHOCTL
+ tcflag_t *ed = tty__get_flag(&el->el_tty.t_ed, MD_INP);
+ if ((*ed & ECHOCTL) == 0)
+ return -1;
+#endif
+ switch (sig) {
+#ifdef SIGINT
+ case SIGINT:
+ return el->el_tty.t_c[ED_IO][VINTR];
+#endif
+#ifdef SIGQUIT
+ case SIGQUIT:
+ return el->el_tty.t_c[ED_IO][VQUIT];
+#endif
+#ifdef SIGINFO
+ case SIGINFO:
+ return el->el_tty.t_c[ED_IO][VSTATUS];
+#endif
+#ifdef SIGTSTP
+ case SIGTSTP:
+ return el->el_tty.t_c[ED_IO][VSUSP];
+#endif
+ default:
+ return -1;
+ }
+}
diff -r b44ee265f739 -r 442007f3b5d1 lib/libedit/tty.h
--- a/lib/libedit/tty.h Sun Dec 02 16:49:24 2018 +0000
+++ b/lib/libedit/tty.h Sun Dec 02 16:58:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.h,v 1.22 2018/01/01 22:32:46 christos Exp $ */
+/* $NetBSD: tty.h,v 1.23 2018/12/02 16:58:13 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -464,6 +464,7 @@
libedit_private int tty_quotemode(EditLine *);
libedit_private int tty_noquotemode(EditLine *);
libedit_private void tty_bind_char(EditLine *, int);
+libedit_private int tty_get_signal_character(EditLine *, int);
typedef struct {
ttyperm_t t_t;
Home |
Main Index |
Thread Index |
Old Index