Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit PR/56622: Walter Lozano: Improve readline compat...



details:   https://anonhg.NetBSD.org/src/rev/eb6b3aed49f8
branches:  trunk
changeset: 359919:eb6b3aed49f8
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 31 14:44:49 2022 +0000

description:
PR/56622: Walter Lozano: Improve readline compatibility by adding
rl_readline_state support.

diffstat:

 lib/libedit/readline.c          |  9 ++++++---
 lib/libedit/readline/readline.h |  9 ++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (67 lines):

diff -r 6e91ea0f0cd2 -r eb6b3aed49f8 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Mon Jan 31 10:14:55 2022 +0000
+++ b/lib/libedit/readline.c    Mon Jan 31 14:44:49 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.170 2022/01/29 20:52:45 christos Exp $  */
+/*     $NetBSD: readline.c,v 1.171 2022/01/31 14:44:49 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.170 2022/01/29 20:52:45 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.171 2022/01/31 14:44:49 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -128,7 +128,7 @@
 VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal;
 VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal;
 KEYMAP_ENTRY_ARRAY emacs_meta_keymap;
-unsigned long rl_readline_state;
+unsigned long rl_readline_state = RL_STATE_NONE;
 int _rl_complete_mark_directories;
 rl_icppfunc_t *rl_directory_completion_hook;
 int rl_completion_suppress_append;
@@ -311,6 +311,8 @@
        if (h != NULL)
                history_end(h);
 
+       RL_UNSETSTATE(RL_STATE_DONE);
+
        if (!rl_instream)
                rl_instream = stdin;
        if (!rl_outstream)
@@ -2145,6 +2147,7 @@
                if (done == 2) {
                        if ((wbuf = strdup(buf)) != NULL)
                                wbuf[count] = '\0';
+                       RL_SETSTATE(RL_STATE_DONE);
                } else
                        wbuf = NULL;
                (*(void (*)(const char *))rl_linefunc)(wbuf);
diff -r 6e91ea0f0cd2 -r eb6b3aed49f8 lib/libedit/readline/readline.h
--- a/lib/libedit/readline/readline.h   Mon Jan 31 10:14:55 2022 +0000
+++ b/lib/libedit/readline/readline.h   Mon Jan 31 14:44:49 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.h,v 1.50 2022/01/14 13:31:05 christos Exp $   */
+/*     $NetBSD: readline.h,v 1.51 2022/01/31 14:44:49 christos Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -94,6 +94,13 @@
 #define RL_PROMPT_START_IGNORE '\1'
 #define RL_PROMPT_END_IGNORE   '\2'
 
+#define RL_STATE_NONE          0x000000
+#define RL_STATE_DONE          0x000001
+
+#define RL_SETSTATE(x)         (rl_readline_state |= ((unsigned long) x))
+#define RL_UNSETSTATE(x)       (rl_readline_state &= ~((unsigned long) x))
+#define RL_ISSTATE(x)          (rl_readline_state & ((unsigned long) x))
+
 /* global variables used by readline enabled applications */
 #ifdef __cplusplus
 extern "C" {



Home | Main Index | Thread Index | Old Index