about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-23 08:41:54 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-23 08:41:54 +0000
commitd3c4108f30fd987724ccffd9559ea2f49ac57328 (patch)
treec3b6d260a1af979fffac64ad7a85c3ad5f057aa7
parentc54e113d2885251fc4269331524532e02c7a7f6e (diff)
downloadzsh-d3c4108f30fd987724ccffd9559ea2f49ac57328.tar.gz
zsh-d3c4108f30fd987724ccffd9559ea2f49ac57328.tar.xz
zsh-d3c4108f30fd987724ccffd9559ea2f49ac57328.zip
Rocky Bernstein: 25727: allow fc non-interactively
Add sanity test for empty history
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c2
-rw-r--r--Test/.distfiles1
-rw-r--r--Test/B06fc.ztst11
4 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a4e59cb23..6f225124f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-23  Peter Stephenson  <pws@csr.com>
+
+	* Rocky Bernstein: 25727: Src/hist.c, Test/B06fc.ztst: remove
+	restriction on interactive use of fc and test another problem.
+
 2008-09-23  Clint Adams  <clint@zsh.org>
 
 	* 25728: Completion/Linux/Command/_ionice: spelling fix.
diff --git a/Src/builtin.c b/Src/builtin.c
index 4772e0a8c..d274ef9ad 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1296,10 +1296,12 @@ bin_fc(char *nam, char **argv, Options ops, int func)
     Patprog pprog = NULL;
 
     /* fc is only permitted in interactive shells */
+#ifdef FACIST_INTERACTIVE
     if (!interact) {
 	zwarnnam(nam, "not interactive shell");
 	return 1;
     }
+#endif
     if (OPT_ISSET(ops,'p')) {
 	char *hf = "";
 	zlong hs = DEFAULT_HISTSIZE;
diff --git a/Test/.distfiles b/Test/.distfiles
index 6b72d8965..fcb61d7bd 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -13,6 +13,7 @@ B02typeset.ztst
 B03print.ztst
 B04read.ztst
 B05eval.ztst
+B06fc.ztst
 C01arith.ztst
 C02cond.ztst
 C03traps.ztst
diff --git a/Test/B06fc.ztst b/Test/B06fc.ztst
new file mode 100644
index 000000000..6195fd6ab
--- /dev/null
+++ b/Test/B06fc.ztst
@@ -0,0 +1,11 @@
+# Tests of fc command
+%prep
+
+ mkdir fc.tmp 
+ cd fc.tmp
+ print 'fc -l foo' >fcl
+ 
+%test
+  $ZTST_testdir/../Src/zsh ./fcl
+1:Checking that fc -l foo doesn't core dump history is empty
+?./fcl:fc:1: event not found: foo