From a76abbed5861ed16d2683ae3866953bf7ed653c8 Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 12 Apr 2005 22:01:40 +0000 Subject: [PATCH] PR/29958: Peter Bex: add rl_variable_bind and rl_attempted_completion_over --- lib/libedit/readline.c | 20 +++++++++++++++++--- lib/libedit/readline/readline.h | 4 +++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index bd6e075050af..f16786b342bd 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $NetBSD: readline.c,v 1.50 2005/04/02 06:28:10 christos Exp $ */ +/* $NetBSD: readline.c,v 1.51 2005/04/12 22:01:40 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: readline.c,v 1.50 2005/04/02 06:28:10 christos Exp $"); +__RCSID("$NetBSD: readline.c,v 1.51 2005/04/12 22:01:40 christos Exp $"); #endif /* not lint && not SCCSID */ #include @@ -1762,9 +1762,13 @@ _rl_complete_internal(int what_to_do) (end - len), end); } else matches = 0; - if (!rl_attempted_completion_function || !matches) + if (!rl_attempted_completion_function || + (!rl_attempted_completion_over && !matches)) matches = completion_matches(temp, (CPFunction *)complet_func); + if (rl_attempted_completion_over) + rl_attempted_completion_over = 0; + if (matches) { int i, retval = CC_REFRESH; int matches_num, maxlen, match_len, match_display=1; @@ -2096,6 +2100,16 @@ rl_parse_and_bind(const char *line) return (argc ? 1 : 0); } +int +rl_variable_bind(const char *var, const char *value) +{ + /* + * The proper return value is undocument, but this is what the + * readline source seems to do. + */ + return ((el_set(e, EL_BIND, "", var, value) == -1) ? 1 : 0); +} + void rl_stuff_char(int c) { diff --git a/lib/libedit/readline/readline.h b/lib/libedit/readline/readline.h index 01cf83ece642..c275bd25b5ed 100644 --- a/lib/libedit/readline/readline.h +++ b/lib/libedit/readline/readline.h @@ -1,4 +1,4 @@ -/* $NetBSD: readline.h,v 1.12 2004/09/08 18:15:37 christos Exp $ */ +/* $NetBSD: readline.h,v 1.13 2005/04/12 22:01:40 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -102,6 +102,7 @@ extern char *rl_completer_word_break_characters; extern char *rl_completer_quote_characters; extern Function *rl_completion_entry_function; extern CPPFunction *rl_attempted_completion_function; +extern int rl_attempted_completion_over; extern int rl_completion_type; extern int rl_completion_query_items; extern char *rl_special_prefixes; @@ -174,6 +175,7 @@ void rl_prep_terminal(int); void rl_deprep_terminal(void); 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);