diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index 4bbff0569c38..522ba0e84ae6 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.146 2018/01/01 22:32:46 christos Exp $ */ +/* $NetBSD: readline.c,v 1.147 2018/06/09 17:41:55 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.146 2018/01/01 22:32:46 christos Exp $"); +__RCSID("$NetBSD: readline.c,v 1.147 2018/06/09 17:41:55 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -80,7 +80,7 @@ int rl_end = 0; char *rl_line_buffer = NULL; rl_vcpfunc_t *rl_linefunc = NULL; int rl_done = 0; -VFunction *rl_event_hook = NULL; +rl_hook_func_t *rl_event_hook = NULL; KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap; @@ -429,7 +429,7 @@ readline(const char *p) if (rl_pre_input_hook) (*rl_pre_input_hook)(NULL, 0); - if (rl_event_hook && !(e->el_flags&NO_TTY)) { + if (rl_event_hook && !(e->el_flags & NO_TTY)) { el_set(e, EL_GETCFN, _rl_event_read_char); used_event_hook = 1; } @@ -2074,15 +2074,12 @@ rl_callback_read_char(void) if (done && rl_linefunc != NULL) { el_set(e, EL_UNBUFFERED, 0); if (done == 2) { - if ((wbuf = strdup(buf)) != NULL) - wbuf[count] = '\0'; + if ((wbuf = strdup(buf)) != NULL) + wbuf[count] = '\0'; } else wbuf = NULL; (*(void (*)(const char *))rl_linefunc)(wbuf); - if (!rl_already_prompted) { - el_set(e, EL_UNBUFFERED, 1); - rl_already_prompted = 1; - } + el_set(e, EL_UNBUFFERED, 1); } } diff --git a/lib/libedit/readline/readline.h b/lib/libedit/readline/readline.h index a2a6c15f74df..20f3d35ca600 100644 --- a/lib/libedit/readline/readline.h +++ b/lib/libedit/readline/readline.h @@ -1,4 +1,4 @@ -/* $NetBSD: readline.h,v 1.42 2017/09/01 10:19:10 christos Exp $ */ +/* $NetBSD: readline.h,v 1.43 2018/06/09 17:41:55 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -38,11 +38,13 @@ /* typedefs */ typedef int Function(const char *, int); +typedef char *CPFunction(const char *, int); typedef void VFunction(void); typedef void rl_vcpfunc_t(char *); typedef char **rl_completion_func_t(const char *, int, int); typedef char *rl_compentry_func_t(const char *, int); typedef int rl_command_func_t(int, int); +typedef int rl_hook_func_t(void); /* only supports length */ typedef struct { @@ -137,6 +139,7 @@ extern VFunction *rl_redisplay_function; extern VFunction *rl_completion_display_matches_hook; extern VFunction *rl_prep_term_function; extern VFunction *rl_deprep_term_function; +extern rl_hook_func_t *rl_event_hook; extern int readline_echoing_p; extern int _rl_print_completions_horizontally; @@ -177,7 +180,7 @@ char *filename_completion_function(const char *, int); char *username_completion_function(const char *, int); int rl_complete(int, int); int rl_read_key(void); -char **completion_matches(const char *, rl_compentry_func_t *); +char **completion_matches(/* const */ char *, rl_compentry_func_t *); void rl_display_match_list(char **, int, int); int rl_insert(int, int);