commit bash-20161216 snapshot

This commit is contained in:
Chet Ramey
2016-12-20 14:15:35 -05:00
parent a57ed9e90a
commit 06db13a410
23 changed files with 284 additions and 47 deletions
+6 -2
View File
@@ -198,8 +198,12 @@ with the other options to replace the history list completely.
@item -d @var{offset}
Delete the history entry at position @var{offset}.
@var{offset} should be specified as it appears when the history is
displayed.
If @var{offset} is positive, it should be specified as it appears when
the history is displayed.
If @var{offset} is negative, it is interpreted as relative to one greater
than the last history position, so negative indices count back from the
end of the history, and an index of @samp{-1} refers to the current
@code{history -d} command.
@item -a
Append the new history lines to the history file.
+13
View File
@@ -498,14 +498,27 @@ remove_history (which)
{
HIST_ENTRY *return_value;
register int i;
#if 1
int nentries;
HIST_ENTRY **start, **end;
#endif
if (which < 0 || which >= history_length || history_length == 0 || the_history == 0)
return ((HIST_ENTRY *)NULL);
return_value = the_history[which];
#if 1
/* Copy the rest of the entries, moving down one slot. Copy includes
trailing NULL. */
nentries = history_length - which;
start = the_history + which;
end = start + 1;
memmove (start, end, nentries * sizeof (HIST_ENTRY *));
#else
for (i = which; i < history_length; i++)
the_history[i] = the_history[i + 1];
#endif
history_length--;