aboutsummaryrefslogtreecommitdiffstats
path: root/builtins/fc.def
diff options
context:
space:
mode:
Diffstat (limited to 'builtins/fc.def')
-rw-r--r--builtins/fc.def14
1 files changed, 12 insertions, 2 deletions
diff --git a/builtins/fc.def b/builtins/fc.def
index a378d9d..257029d 100644
--- a/builtins/fc.def
+++ b/builtins/fc.def
@@ -1,7 +1,7 @@
This file is fc.def, from which is created fc.c.
It implements the builtin "fc" in Bash.
-Copyright (C) 1987-2009 Free Software Foundation, Inc.
+Copyright (C) 1987-2010 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -85,7 +85,7 @@ $END
extern int errno;
#endif /* !errno */
-extern int current_command_line_count;
+extern int current_command_line_count, saved_command_line_count;
extern int literal_history;
extern int posixly_correct;
extern int subshell_environment, interactive_shell;
@@ -303,6 +303,16 @@ fc_builtin (list)
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
last_hist = i - rh - hist_last_line_added;
+ /* XXX */
+ if (saved_command_line_count > 0 && i == last_hist && hlist[last_hist] == 0)
+ while (last_hist >= 0 && hlist[last_hist] == 0)
+ last_hist--;
+ if (last_hist < 0)
+ {
+ sh_erange ((char *)NULL, _("history specification"));
+ return (EXECUTION_FAILURE);
+ }
+
if (list)
{
histbeg = fc_gethnum (list->word->word, hlist);