summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorEric Andersen2001-09-06 17:35:20 +0000
committerEric Andersen2001-09-06 17:35:20 +0000
commit88cec25e99370ccef499e0b65480aa8458e66b7a (patch)
treec61aef5eee53abff53154f8ed411259af254bb7a /shell
parent1644db9a2bc153373a2c27e7622a5486bf648114 (diff)
downloadbusybox-88cec25e99370ccef499e0b65480aa8458e66b7a.zip
busybox-88cec25e99370ccef499e0b65480aa8458e66b7a.tar.gz
Patch from vodz to make ash cope with leading redirections
(i.e. '2>/dev/null ls rubbish') will now work.
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 53fb56c..bd34c0e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9857,6 +9857,14 @@ command() {
n1 = NULL;
rpp = &redir;
+ /* Check for redirection which may precede command */
+ while (readtoken() == TREDIR) {
+ *rpp = n2 = redirnode;
+ rpp = &n2->nfile.next;
+ parsefname();
+ }
+ tokpushback++;
+
switch (readtoken()) {
case TIF:
n1 = (union node *)stalloc(sizeof (struct nif));
@@ -10026,7 +10034,6 @@ TRACE(("expecting DO got %s %s\n", tokname(got), got == TWORD ? wordtext : ""));
if (!redir)
synexpect(-1);
case TWORD:
- case TREDIR:
tokpushback++;
n1 = simplecmd();
return n1;
@@ -12673,7 +12680,7 @@ findvar(struct var **vpp, const char *name)
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
- * $Id: ash.c,v 1.22 2001/08/12 17:32:56 mjn3 Exp $
+ * $Id: ash.c,v 1.23 2001/09/06 17:35:20 andersen Exp $
*/
static int timescmd (int argc, char **argv)
{