summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-06-07 10:01:59 +0000
committerbapt <bapt@FreeBSD.org>2015-06-07 10:01:59 +0000
commit686e2201d54ba887bc370da296890cbb7741f05a (patch)
tree12ff30f767302b9e68c8162079fded9b34e8ea44 /lib
parent630db52ab721469cf98208a4be2dd3e2c9fd5fc2 (diff)
downloadFreeBSD-src-686e2201d54ba887bc370da296890cbb7741f05a.zip
FreeBSD-src-686e2201d54ba887bc370da296890cbb7741f05a.tar.gz
Sync with NetBSD:
- fix types of rl_completion_entry_function and rl_add_defun - call update pos before completion to refresh the screen From Thomas Eriksson Adjust API to a more modern readline (Ryo Onodera) remove duplicate declaration
Diffstat (limited to 'lib')
-rw-r--r--lib/libedit/edit/readline/readline.h17
-rw-r--r--lib/libedit/readline.c22
2 files changed, 20 insertions, 19 deletions
diff --git a/lib/libedit/edit/readline/readline.h b/lib/libedit/edit/readline/readline.h
index 4371457..e25781b 100644
--- a/lib/libedit/edit/readline/readline.h
+++ b/lib/libedit/edit/readline/readline.h
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.h,v 1.34 2013/05/28 00:10:34 christos Exp $ */
+/* $NetBSD: readline.h,v 1.37 2015/06/02 15:36:45 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -41,9 +41,8 @@
/* typedefs */
typedef int Function(const char *, int);
typedef void VFunction(void);
-typedef void VCPFunction(char *);
-typedef char *CPFunction(const char *, int);
-typedef char **CPPFunction(const char *, int, int);
+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);
@@ -110,9 +109,9 @@ extern int max_input_history;
extern char *rl_basic_word_break_characters;
extern char *rl_completer_word_break_characters;
extern char *rl_completer_quote_characters;
-extern Function *rl_completion_entry_function;
+extern rl_compentry_func_t *rl_completion_entry_function;
extern char *(*rl_completion_word_break_hook)(void);
-extern CPPFunction *rl_attempted_completion_function;
+extern rl_completion_func_t *rl_attempted_completion_function;
extern int rl_attempted_completion_over;
extern int rl_completion_type;
extern int rl_completion_query_items;
@@ -177,7 +176,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 *, CPFunction *);
+char **completion_matches(const char *, rl_compentry_func_t *);
void rl_display_match_list(char **, int, int);
int rl_insert(int, int);
@@ -186,7 +185,7 @@ void rl_reset_terminal(const char *);
int rl_bind_key(int, rl_command_func_t *);
int rl_newline(int, int);
void rl_callback_read_char(void);
-void rl_callback_handler_install(const char *, VCPFunction *);
+void rl_callback_handler_install(const char *, rl_vcpfunc_t *);
void rl_callback_handler_remove(void);
void rl_redisplay(void);
int rl_get_previous_history(int, int);
@@ -196,7 +195,7 @@ int rl_read_init_file(const char *);
int rl_parse_and_bind(const char *);
int rl_variable_bind(const char *, const char *);
void rl_stuff_char(int);
-int rl_add_defun(const char *, Function *, int);
+int rl_add_defun(const char *, rl_command_func_t *, int);
HISTORY_STATE *history_get_history_state(void);
void rl_get_screen_size(int *, int *);
void rl_set_screen_size(int, int);
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c
index 2dd7f4f..caddb9f 100644
--- a/lib/libedit/readline.c
+++ b/lib/libedit/readline.c
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.c,v 1.115 2015/04/01 15:23:15 christos Exp $ */
+/* $NetBSD: readline.c,v 1.117 2015/06/02 15:35:31 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.115 2015/04/01 15:23:15 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.117 2015/06/02 15:35:31 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -80,7 +80,7 @@ FILE *rl_outstream = NULL;
int rl_point = 0;
int rl_end = 0;
char *rl_line_buffer = NULL;
-VCPFunction *rl_linefunc = NULL;
+rl_vcpfunc_t *rl_linefunc = NULL;
int rl_done = 0;
VFunction *rl_event_hook = NULL;
KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
@@ -109,9 +109,9 @@ int rl_attempted_completion_over = 0;
char *rl_basic_word_break_characters = break_chars;
char *rl_completer_word_break_characters = NULL;
char *rl_completer_quote_characters = NULL;
-Function *rl_completion_entry_function = NULL;
+rl_compentry_func_t *rl_completion_entry_function = NULL;
char *(*rl_completion_word_break_hook)(void) = NULL;
-CPPFunction *rl_attempted_completion_function = NULL;
+rl_completion_func_t *rl_attempted_completion_function = NULL;
Function *rl_pre_input_hook = NULL;
Function *rl_startup1_hook = NULL;
int (*rl_getc_function)(FILE *) = NULL;
@@ -162,7 +162,7 @@ int rl_completion_append_character = ' ';
static History *h = NULL;
static EditLine *e = NULL;
-static Function *map[256];
+static rl_command_func_t *map[256];
static jmp_buf topbuf;
/* internal functions */
@@ -1829,9 +1829,11 @@ rl_complete(int ignore __attribute__((__unused__)), int invoking_key)
else
breakchars = rl_basic_word_break_characters;
+ _rl_update_pos();
+
/* Just look at how many global variables modify this operation! */
return fn_complete(e,
- (CPFunction *)rl_completion_entry_function,
+ (rl_compentry_func_t *)rl_completion_entry_function,
rl_attempted_completion_function,
ct_decode_string(rl_basic_word_break_characters, &wbreak_conv),
ct_decode_string(breakchars, &sprefix_conv),
@@ -1960,7 +1962,7 @@ rl_bind_wrapper(EditLine *el __attribute__((__unused__)), unsigned char c)
_rl_update_pos();
- (*map[c])(NULL, c);
+ (*map[c])(1, c);
/* If rl_done was set by the above call, deal with it here */
if (rl_done)
@@ -1970,7 +1972,7 @@ rl_bind_wrapper(EditLine *el __attribute__((__unused__)), unsigned char c)
}
int
-rl_add_defun(const char *name, Function *fun, int c)
+rl_add_defun(const char *name, rl_command_func_t *fun, int c)
{
char dest[8];
if ((size_t)c >= sizeof(map) / sizeof(map[0]) || c < 0)
@@ -2009,7 +2011,7 @@ rl_callback_read_char(void)
}
void
-rl_callback_handler_install(const char *prompt, VCPFunction *linefunc)
+rl_callback_handler_install(const char *prompt, rl_vcpfunc_t *linefunc)
{
if (e == NULL) {
rl_initialize();
OpenPOWER on IntegriCloud