Module Name: src Committed By: christos Date: Mon Jan 31 14:44:49 UTC 2022
Modified Files: src/lib/libedit: readline.c src/lib/libedit/readline: readline.h Log Message: PR/56622: Walter Lozano: Improve readline compatibility by adding rl_readline_state support. To generate a diff of this commit: cvs rdiff -u -r1.170 -r1.171 src/lib/libedit/readline.c cvs rdiff -u -r1.50 -r1.51 src/lib/libedit/readline/readline.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/readline.c diff -u src/lib/libedit/readline.c:1.170 src/lib/libedit/readline.c:1.171 --- src/lib/libedit/readline.c:1.170 Sat Jan 29 15:52:45 2022 +++ src/lib/libedit/readline.c Mon Jan 31 09:44:49 2022 @@ -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_completion_display_matches 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 @@ rl_initialize(void) if (h != NULL) history_end(h); + RL_UNSETSTATE(RL_STATE_DONE); + if (!rl_instream) rl_instream = stdin; if (!rl_outstream) @@ -2145,6 +2147,7 @@ rl_callback_read_char(void) 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); Index: src/lib/libedit/readline/readline.h diff -u src/lib/libedit/readline/readline.h:1.50 src/lib/libedit/readline/readline.h:1.51 --- src/lib/libedit/readline/readline.h:1.50 Fri Jan 14 08:31:05 2022 +++ src/lib/libedit/readline/readline.h Mon Jan 31 09:44:49 2022 @@ -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 @@ typedef KEYMAP_ENTRY *Keymap; #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" {