Bash-4.0 patchlevel 38

This commit is contained in:
Chet Ramey
2011-11-21 20:49:12 -05:00
parent 17345e5ad2
commit 89a92869e5
27 changed files with 490 additions and 164 deletions
+17 -4
View File
@@ -88,6 +88,7 @@ extern int errno;
extern int current_command_line_count;
extern int literal_history;
extern int posixly_correct;
extern int subshell_environment, interactive_shell;
extern int unlink __P((const char *));
@@ -172,7 +173,7 @@ fc_builtin (list)
register int i;
register char *sep;
int numbering, reverse, listing, execute;
int histbeg, histend, last_hist, retval, opt;
int histbeg, histend, last_hist, retval, opt, rh;
FILE *stream;
REPL *rlist, *rl;
char *ename, *command, *newcom, *fcedit;
@@ -275,6 +276,8 @@ fc_builtin (list)
fprintf (stderr, "%s\n", command);
fc_replhist (command); /* replace `fc -s' with command */
/* Posix says that the re-executed commands should be entered into the
history. */
return (parse_and_execute (command, "fc", SEVAL_NOHIST));
}
@@ -293,7 +296,12 @@ fc_builtin (list)
line was actually added (HISTIGNORE may have caused it to not be),
so we check hist_last_line_added. */
last_hist = i - remember_on_history - hist_last_line_added;
/* Even though command substitution through parse_and_execute turns off
remember_on_history, command substitution in a shell when set -o history
has been enabled (interactive or not) should use it in the last_hist
calculation as if it were on. */
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
last_hist = i - rh - hist_last_line_added;
if (list)
{
@@ -456,7 +464,7 @@ fc_gethnum (command, hlist)
char *command;
HIST_ENTRY **hlist;
{
int sign, n, clen;
int sign, n, clen, rh;
register int i, j;
register char *s;
@@ -472,7 +480,12 @@ fc_gethnum (command, hlist)
line was actually added (HISTIGNORE may have caused it to not be),
so we check hist_last_line_added. This needs to agree with the
calculation of last_hist in fc_builtin above. */
i -= remember_on_history + hist_last_line_added;
/* Even though command substitution through parse_and_execute turns off
remember_on_history, command substitution in a shell when set -o history
has been enabled (interactive or not) should use it in the last_hist
calculation as if it were on. */
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
i -= rh + hist_last_line_added;
/* No specification defaults to most recent command. */
if (command == NULL)