diff options
author | Ron Yorston <rmy@pobox.com> | 2015-08-03 13:46:00 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-29 19:30:55 +0100 |
commit | ab80e01cd9865571875b5dde7d2f88dea3331969 (patch) | |
tree | 357ba4079551ef0624f12e2fd13e6f7d12678d6a /shell/ash.c | |
parent | 9121510dc659baf6664456796c195460468c850b (diff) | |
download | busybox-w32-ab80e01cd9865571875b5dde7d2f88dea3331969.tar.gz busybox-w32-ab80e01cd9865571875b5dde7d2f88dea3331969.tar.bz2 busybox-w32-ab80e01cd9865571875b5dde7d2f88dea3331969.zip |
ash: allow newline after variable name in for loop
Newline is a valid delimiter between the variable name and `in`
keyword in for loops.
Based on commit 22e8fb4 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.
function old new delta
parse_command 1568 1563 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5) Total: -5 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c index 17121aa9b..3339666b9 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -10913,7 +10913,7 @@ parse_command(void) | |||
10913 | n1 = stzalloc(sizeof(struct nfor)); | 10913 | n1 = stzalloc(sizeof(struct nfor)); |
10914 | n1->type = NFOR; | 10914 | n1->type = NFOR; |
10915 | n1->nfor.var = wordtext; | 10915 | n1->nfor.var = wordtext; |
10916 | checkkwd = CHKKWD | CHKALIAS; | 10916 | checkkwd = CHKNL | CHKKWD | CHKALIAS; |
10917 | if (readtoken() == TIN) { | 10917 | if (readtoken() == TIN) { |
10918 | app = ≈ | 10918 | app = ≈ |
10919 | while (readtoken() == TWORD) { | 10919 | while (readtoken() == TWORD) { |
@@ -10940,7 +10940,7 @@ parse_command(void) | |||
10940 | * Newline or semicolon here is optional (but note | 10940 | * Newline or semicolon here is optional (but note |
10941 | * that the original Bourne shell only allowed NL). | 10941 | * that the original Bourne shell only allowed NL). |
10942 | */ | 10942 | */ |
10943 | if (lasttoken != TNL && lasttoken != TSEMI) | 10943 | if (lasttoken != TSEMI) |
10944 | tokpushback = 1; | 10944 | tokpushback = 1; |
10945 | } | 10945 | } |
10946 | checkkwd = CHKNL | CHKKWD | CHKALIAS; | 10946 | checkkwd = CHKNL | CHKKWD | CHKALIAS; |