diff options
Diffstat (limited to 'lib/readline/isearch.c')
-rw-r--r-- | lib/readline/isearch.c | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/lib/readline/isearch.c b/lib/readline/isearch.c index 9f67bfc..f3f46a7 100644 --- a/lib/readline/isearch.c +++ b/lib/readline/isearch.c @@ -1,29 +1,30 @@ +/* isearch.c - incremental searching */ + /* **************************************************************** */ /* */ /* I-Search and Searching */ /* */ /* **************************************************************** */ -/* Copyright (C) 1987-2005 Free Software Foundation, Inc. +/* Copyright (C) 1987-2009 Free Software Foundation, Inc. - This file contains the Readline Library (the Library), a set of - routines for providing Emacs style line input to programs that ask - for it. + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. - The Library is free software; you can redistribute it and/or modify + Readline is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - The Library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Readline. If not, see <http://www.gnu.org/licenses/>. +*/ + #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) @@ -75,7 +76,7 @@ static int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int)); static char *last_isearch_string; static int last_isearch_string_len; -static char *default_isearch_terminators = "\033\012"; +static char * const default_isearch_terminators = "\033\012"; _rl_search_cxt * _rl_scxt_alloc (type, flags) @@ -125,7 +126,7 @@ _rl_scxt_dispose (cxt, flags) FREE (cxt->allocated_line); FREE (cxt->lines); - free (cxt); + xfree (cxt); } /* Search backwards through the history looking for a string which is typed @@ -192,7 +193,7 @@ rl_display_search (search_string, reverse_p, where) strcpy (message + msglen, "': "); rl_message ("%s", message); - free (message); + xfree (message); (*rl_redisplay_function) (); } @@ -327,8 +328,15 @@ _rl_isearch_dispatch (cxt, c) rl_command_func_t *f; f = (rl_command_func_t *)NULL; - - /* Translate the keys we do something with to opcodes. */ + + if (c < 0) + { + cxt->sflags |= SF_FAILED; + cxt->history_pos = cxt->last_found_line; + return -1; + } + + /* Translate the keys we do something with to opcodes. */ if (c >= 0 && _rl_keymap[c].type == ISFUNC) { f = _rl_keymap[c].function; @@ -375,7 +383,7 @@ _rl_isearch_dispatch (cxt, c) { if (cxt->lastc >= 0 && (cxt->mb[0] && cxt->mb[1] == '\0') && ENDSRCH_CHAR (cxt->lastc)) { - /* This sets rl_pending_input to c; it will be picked up the next + /* This sets rl_pending_input to LASTC; it will be picked up the next time rl_read_key is called. */ rl_execute_next (cxt->lastc); return (0); |