diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-09-06 17:35:20 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-09-06 17:35:20 +0000 |
commit | 88cec25e99370ccef499e0b65480aa8458e66b7a (patch) | |
tree | c61aef5eee53abff53154f8ed411259af254bb7a | |
parent | 1644db9a2bc153373a2c27e7622a5486bf648114 (diff) | |
download | busybox-w32-88cec25e99370ccef499e0b65480aa8458e66b7a.tar.gz busybox-w32-88cec25e99370ccef499e0b65480aa8458e66b7a.tar.bz2 busybox-w32-88cec25e99370ccef499e0b65480aa8458e66b7a.zip |
Patch from vodz to make ash cope with leading redirections
(i.e. '2>/dev/null ls rubbish') will now work.
-rw-r--r-- | Changelog | 5 | ||||
-rw-r--r-- | ash.c | 11 | ||||
-rw-r--r-- | shell/ash.c | 11 |
3 files changed, 21 insertions, 6 deletions
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | * Vladimir Oleynik, Manuel Novoa III, Aaron Lehmann | 14 | * Vladimir Oleynik, Manuel Novoa III, Aaron Lehmann |
15 | -- a whole bunch of ash size optimizations | 15 | -- a whole bunch of ash size optimizations |
16 | -- Fix for ash leading redirections (i.e. '2>/dev/null ls rubbish') | ||
16 | * Rodney Brown <RDBrown@mira.net> | 17 | * Rodney Brown <RDBrown@mira.net> |
17 | -- Optimized gzip.c, shrinking it be ~1.5k | 18 | -- Optimized gzip.c, shrinking it be ~1.5k |
18 | * Matt Kraai | 19 | * Matt Kraai |
@@ -20,8 +21,8 @@ | |||
20 | -- Fix `-/bin/sh' invocation (closes: #1209). | 21 | -- Fix `-/bin/sh' invocation (closes: #1209). |
21 | -- Fix ash exec (noted by Arne Bernin). | 22 | -- Fix ash exec (noted by Arne Bernin). |
22 | * Magick | 23 | * Magick |
23 | -- maked init run inittab command's in inittab order ( | 24 | -- made init run inittab command's in the order they show up |
24 | (i.e. FIFO instead of LIFO). | 25 | in the inittab file (FIFO instead of LIFO). |
25 | 26 | ||
26 | 27 | ||
27 | -Erik Andersen, --not yet released-- | 28 | -Erik Andersen, --not yet released-- |
@@ -9857,6 +9857,14 @@ command() { | |||
9857 | n1 = NULL; | 9857 | n1 = NULL; |
9858 | rpp = &redir; | 9858 | rpp = &redir; |
9859 | 9859 | ||
9860 | /* Check for redirection which may precede command */ | ||
9861 | while (readtoken() == TREDIR) { | ||
9862 | *rpp = n2 = redirnode; | ||
9863 | rpp = &n2->nfile.next; | ||
9864 | parsefname(); | ||
9865 | } | ||
9866 | tokpushback++; | ||
9867 | |||
9860 | switch (readtoken()) { | 9868 | switch (readtoken()) { |
9861 | case TIF: | 9869 | case TIF: |
9862 | n1 = (union node *)stalloc(sizeof (struct nif)); | 9870 | n1 = (union node *)stalloc(sizeof (struct nif)); |
@@ -10026,7 +10034,6 @@ TRACE(("expecting DO got %s %s\n", tokname(got), got == TWORD ? wordtext : "")); | |||
10026 | if (!redir) | 10034 | if (!redir) |
10027 | synexpect(-1); | 10035 | synexpect(-1); |
10028 | case TWORD: | 10036 | case TWORD: |
10029 | case TREDIR: | ||
10030 | tokpushback++; | 10037 | tokpushback++; |
10031 | n1 = simplecmd(); | 10038 | n1 = simplecmd(); |
10032 | return n1; | 10039 | return n1; |
@@ -12673,7 +12680,7 @@ findvar(struct var **vpp, const char *name) | |||
12673 | /* | 12680 | /* |
12674 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> | 12681 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> |
12675 | * This file contains code for the times builtin. | 12682 | * This file contains code for the times builtin. |
12676 | * $Id: ash.c,v 1.22 2001/08/12 17:32:56 mjn3 Exp $ | 12683 | * $Id: ash.c,v 1.23 2001/09/06 17:35:20 andersen Exp $ |
12677 | */ | 12684 | */ |
12678 | static int timescmd (int argc, char **argv) | 12685 | static int timescmd (int argc, char **argv) |
12679 | { | 12686 | { |
diff --git a/shell/ash.c b/shell/ash.c index 53fb56c2c..bd34c0efb 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -9857,6 +9857,14 @@ command() { | |||
9857 | n1 = NULL; | 9857 | n1 = NULL; |
9858 | rpp = &redir; | 9858 | rpp = &redir; |
9859 | 9859 | ||
9860 | /* Check for redirection which may precede command */ | ||
9861 | while (readtoken() == TREDIR) { | ||
9862 | *rpp = n2 = redirnode; | ||
9863 | rpp = &n2->nfile.next; | ||
9864 | parsefname(); | ||
9865 | } | ||
9866 | tokpushback++; | ||
9867 | |||
9860 | switch (readtoken()) { | 9868 | switch (readtoken()) { |
9861 | case TIF: | 9869 | case TIF: |
9862 | n1 = (union node *)stalloc(sizeof (struct nif)); | 9870 | n1 = (union node *)stalloc(sizeof (struct nif)); |
@@ -10026,7 +10034,6 @@ TRACE(("expecting DO got %s %s\n", tokname(got), got == TWORD ? wordtext : "")); | |||
10026 | if (!redir) | 10034 | if (!redir) |
10027 | synexpect(-1); | 10035 | synexpect(-1); |
10028 | case TWORD: | 10036 | case TWORD: |
10029 | case TREDIR: | ||
10030 | tokpushback++; | 10037 | tokpushback++; |
10031 | n1 = simplecmd(); | 10038 | n1 = simplecmd(); |
10032 | return n1; | 10039 | return n1; |
@@ -12673,7 +12680,7 @@ findvar(struct var **vpp, const char *name) | |||
12673 | /* | 12680 | /* |
12674 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> | 12681 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> |
12675 | * This file contains code for the times builtin. | 12682 | * This file contains code for the times builtin. |
12676 | * $Id: ash.c,v 1.22 2001/08/12 17:32:56 mjn3 Exp $ | 12683 | * $Id: ash.c,v 1.23 2001/09/06 17:35:20 andersen Exp $ |
12677 | */ | 12684 | */ |
12678 | static int timescmd (int argc, char **argv) | 12685 | static int timescmd (int argc, char **argv) |
12679 | { | 12686 | { |