about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-05-08 11:29:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-05-08 11:29:32 +0000
commitd60de3001bbcc91c4d4e2c65499df9bb5e79fe7c (patch)
treebb777e6159d79e6b103d5a5b4fd83692588e5a07
parentbd95e7658f22a6b1c11c8accb1e1ee618888d440 (diff)
downloadzsh-d60de3001bbcc91c4d4e2c65499df9bb5e79fe7c.tar.gz
zsh-d60de3001bbcc91c4d4e2c65499df9bb5e79fe7c.tar.xz
zsh-d60de3001bbcc91c4d4e2c65499df9bb5e79fe7c.zip
30469: Src/builtin.c: allow reverse listing of history using
fc -r, but don't allow reverse execution of commands at all.
-rw-r--r--ChangeLog10
-rw-r--r--Src/builtin.c10
2 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index aba6c0aa8..c93f8a3e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-08  Peter Stephenson  <pws@csr.com>
+
+	* 30469: Src/builtin.c: allow reverse listing of history using
+	fc -r, but don't allow reverse execution of commands at all.
+
+	* unposted: Doc/Zsh/contrib.yo: clarify that zargs is different
+	from xargs.
+
 2012-05-03  Peter Stephenson  <pws@csr.com>
 
 	* unposted, see 30465: Doc/Zsh/expn.yo, Doc/Zsh/params.yo: add
@@ -16276,5 +16284,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5648 $
+* $Revision: 1.5649 $
 *****************************************************
diff --git a/Src/builtin.c b/Src/builtin.c
index c32b1c023..faa5ed374 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1498,7 +1498,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
     }
     if (OPT_ISSET(ops,'l')) {
 	/* list the required part of the history */
-	retval = fclist(stdout, ops, first, last, asgf, pprog);
+	retval = fclist(stdout, ops, first, last, asgf, pprog, 0);
 	unqueue_signals();
     }
     else {
@@ -1530,7 +1530,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
 		}
 	    }
 	    ops->ind['n'] = 1;	/* No line numbers here. */
-	    if (!fclist(out, ops, first, last, asgf, pprog)) {
+	    if (!fclist(out, ops, first, last, asgf, pprog, 1)) {
 		char *editor;
 
 		if (func == BIN_R)
@@ -1639,7 +1639,7 @@ fcsubs(char **sp, struct asgment *sub)
 /**/
 static int
 fclist(FILE *f, Options ops, zlong first, zlong last,
-       struct asgment *subs, Patprog pprog)
+       struct asgment *subs, Patprog pprog, int is_command)
 {
     int fclistdone = 0;
     zlong tmp;
@@ -1652,8 +1652,8 @@ fclist(FILE *f, Options ops, zlong first, zlong last,
 	last = first;
 	first = tmp;
     }
-    if (first > last) {
-	zwarnnam("fc", "history events are in wrong order, aborted");
+    if (is_command && first > last) {
+	zwarnnam("fc", "history events can't be executed backwards, aborted");
 	if (f != stdout)
 	    fclose(f);
 	return 1;