mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 20:50:42 +02:00
commit bash-20080117 snapshot
This commit is contained in:
+1
-1
@@ -295,7 +295,7 @@ fc_builtin (list)
|
||||
if (listing == 0 && hist_last_line_added)
|
||||
delete_last_history ();
|
||||
|
||||
last_hist = i - 1 - hist_last_line_added;
|
||||
last_hist = i - remember_on_history - hist_last_line_added;
|
||||
|
||||
if (list)
|
||||
{
|
||||
|
||||
+13
-4
@@ -24,7 +24,7 @@ $PRODUCES fc.c
|
||||
$BUILTIN fc
|
||||
$FUNCTION fc_builtin
|
||||
$DEPENDS_ON HISTORY
|
||||
$SHORT_DOC fc [-e ename] [-nlr] [first] [last] or fc -s [pat=rep] [command]
|
||||
$SHORT_DOC fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]
|
||||
fc is used to list or edit and re-execute commands from the history list.
|
||||
FIRST and LAST can be numbers specifying the range, or FIRST can be a
|
||||
string, which means the most recent command beginning with that
|
||||
@@ -290,12 +290,13 @@ fc_builtin (list)
|
||||
line was actually added (HISTIGNORE may have caused it to not be),
|
||||
so we check hist_last_line_added. */
|
||||
|
||||
/* "When not listing, he fc command that caused the editing shall not be
|
||||
/* "When not listing, the fc command that caused the editing shall not be
|
||||
entered into the history list." */
|
||||
if (listing == 0 && hist_last_line_added)
|
||||
delete_last_history ();
|
||||
|
||||
last_hist = i - 1 - hist_last_line_added;
|
||||
last_hist = i - remember_on_history - hist_last_line_added;
|
||||
itrace("fc: i = %d last_hist = %d remember_on_history = %d hist_last_line_added = %d", i, last_hist, remember_on_history, hist_last_line_added);
|
||||
|
||||
if (list)
|
||||
{
|
||||
@@ -306,6 +307,7 @@ fc_builtin (list)
|
||||
histend = fc_gethnum (list->word->word, hlist);
|
||||
else
|
||||
histend = listing ? last_hist : histbeg;
|
||||
itrace("fc: histbeg = %d histend = %d", histbeg, histend);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -368,8 +370,15 @@ fc_builtin (list)
|
||||
}
|
||||
|
||||
if (listing)
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
|
||||
fflush (stream);
|
||||
if (ferror (stream))
|
||||
{
|
||||
sh_wrerror ();
|
||||
fclose (stream);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
fclose (stream);
|
||||
|
||||
/* Now edit the file of commands. */
|
||||
|
||||
+7
-1
@@ -340,8 +340,13 @@ read_builtin (list)
|
||||
code = setjmp (alrmbuf);
|
||||
if (code)
|
||||
{
|
||||
#if 0
|
||||
run_unwind_frame ("read_builtin");
|
||||
return (EXECUTION_FAILURE);
|
||||
#else
|
||||
retval = EXECUTION_FAILURE;
|
||||
goto assign_vars;
|
||||
#endif
|
||||
}
|
||||
old_alrm = set_signal_handler (SIGALRM, sigalrm);
|
||||
add_unwind_protect (reset_alarm, (char *)NULL);
|
||||
@@ -565,6 +570,8 @@ add_char:
|
||||
|
||||
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
|
||||
|
||||
assign_vars:
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
/* If -a was given, take the string read, break it into a list of words,
|
||||
an assign them to `arrayname' in turn. */
|
||||
@@ -641,7 +648,6 @@ add_char:
|
||||
for (t = input_string; ifs_chars && *ifs_chars && spctabnl(*t) && isifs(*t); t++)
|
||||
;
|
||||
input_string = t;
|
||||
|
||||
for (; list->next; list = list->next)
|
||||
{
|
||||
varname = list->word->word;
|
||||
|
||||
+10
-3
@@ -340,8 +340,14 @@ read_builtin (list)
|
||||
code = setjmp (alrmbuf);
|
||||
if (code)
|
||||
{
|
||||
itrace("sigalrm: input_string = %s input_is_tty = %d", input_string, input_is_tty);
|
||||
#if 0
|
||||
run_unwind_frame ("read_builtin");
|
||||
return (EXECUTION_FAILURE);
|
||||
#else
|
||||
retval = EXECUTION_FAILURE;
|
||||
goto assign_vars;
|
||||
#endif
|
||||
}
|
||||
old_alrm = set_signal_handler (SIGALRM, sigalrm);
|
||||
add_unwind_protect (reset_alarm, (char *)NULL);
|
||||
@@ -551,10 +557,10 @@ add_char:
|
||||
else
|
||||
#endif
|
||||
if (input_is_tty)
|
||||
ttrestore ();
|
||||
ttyrestore (&termsave);
|
||||
}
|
||||
else if (silent)
|
||||
ttrestore ();
|
||||
ttyrestore (&termsave);
|
||||
|
||||
if (unbuffered_read == 0)
|
||||
zsyncfd (fd);
|
||||
@@ -565,6 +571,8 @@ add_char:
|
||||
|
||||
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
|
||||
|
||||
assign_vars:
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
/* If -a was given, take the string read, break it into a list of words,
|
||||
an assign them to `arrayname' in turn. */
|
||||
@@ -641,7 +649,6 @@ add_char:
|
||||
for (t = input_string; ifs_chars && *ifs_chars && spctabnl(*t) && isifs(*t); t++)
|
||||
;
|
||||
input_string = t;
|
||||
|
||||
for (; list->next; list = list->next)
|
||||
{
|
||||
varname = list->word->word;
|
||||
|
||||
Reference in New Issue
Block a user