Bash-4.3 distribution sources and documentation

This commit is contained in:
Chet Ramey 2014-02-26 09:36:43 -05:00
commit ac50fbac37
497 changed files with 129395 additions and 87598 deletions

View file

@ -1,7 +1,7 @@
/* readline.c -- a general facility for reading lines of input
with emacs style editing and completion. */
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@ -101,6 +101,25 @@ rl_add_undo (what, start, end, text)
rl_undo_list = temp;
}
/* Free an UNDO_LIST */
void
_rl_free_undo_list (ul)
UNDO_LIST *ul;
{
UNDO_LIST *release;
while (ul)
{
release = ul;
ul = ul->next;
if (release->what == UNDO_DELETE)
xfree (release->text);
xfree (release);
}
}
/* Free the existing undo list. */
void
rl_free_undo_list ()
@ -108,16 +127,7 @@ rl_free_undo_list ()
UNDO_LIST *release, *orig_list;
orig_list = rl_undo_list;
while (rl_undo_list)
{
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
if (release->what == UNDO_DELETE)
xfree (release->text);
xfree (release);
}
_rl_free_undo_list (rl_undo_list);
rl_undo_list = (UNDO_LIST *)NULL;
replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
}
@ -168,6 +178,7 @@ rl_do_undo ()
{
UNDO_LIST *release;
int waiting_for_begin, start, end;
HIST_ENTRY *cur, *temp;
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
@ -222,6 +233,18 @@ rl_do_undo ()
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
/* If we are editing a history entry, make sure the change is replicated
in the history entry's line */
cur = current_history ();
if (cur && cur->data && (UNDO_LIST *)cur->data == release)
{
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
xfree (temp->line);
FREE (temp->timestamp);
xfree (temp);
}
replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
xfree (release);