From f4b417c62a4f272c4cf9a074d0f7a3a97201f9db Mon Sep 17 00:00:00 2001
From: Sebastian Schmidt <yath@yath.de>
Date: Tue, 17 Apr 2012 11:23:35 +0200
Subject: Update to upstream bash 4.2

This upgrades bash to from 4.1-rc to 4.2-release. See CWRU/changelog for
changes.

Change-Id: I926269c300cf44fa25964b5b375a148fcf11c4b7
---
 builtins/fc.def | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'builtins/fc.def')

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);
-- 
cgit v1.1

