NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/56622: Improve libedit compatibility with readline related to rl_readline_state
>Number: 56622
>Category: lib
>Synopsis: Improve libedit compatibility with readline related to rl_readline_state
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Jan 13 19:10:00 +0000 2022
>Originator: Walter Lozano
>Release:
>Organization:
Collabora
>Environment:
>Description:
To add better compatibility some additional symbols should added related to rl_readline_state.
>How-To-Repeat:
>Fix:
I prepared the following patch. It only add support of RL_STATE_DONE, which is the most commonly used (at least in the utilities I use).
cvs diff: Diffing .
Index: readline.c
===================================================================
RCS file: /cvsroot/src/lib/libedit/readline.c,v
retrieving revision 1.169
diff -u -r1.169 readline.c
--- readline.c 11 Jan 2022 18:30:15 -0000 1.169
+++ readline.c 13 Jan 2022 19:02:28 -0000
@@ -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);
cvs diff: Diffing TEST
cvs diff: Diffing readline
Index: readline/readline.h
===================================================================
RCS file: /cvsroot/src/lib/libedit/readline/readline.h,v
retrieving revision 1.48
diff -u -r1.48 readline.h
--- readline/readline.h 11 Jan 2022 18:30:15 -0000 1.48
+++ readline/readline.h 13 Jan 2022 19:02:28 -0000
@@ -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