mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-10 13:40:55 +02:00
commit bash-20161216 snapshot
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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--;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user