1
From ab72e0678b0febde521c9b828af6b227b4cca3a8 Mon Sep 17 00:00:00 2001
2
From: Herbert Xu <herbert@gondor.apana.org.au>
3
Date: Thu, 4 Oct 2007 22:15:10 +0800
4
Subject: [PATCH] [PARSER] Fix parsing of ${##1}
6
Previously dash treated ${##1} as a length operation. This patch fixes that.
22
src/parser.c | 31 ++++++++++++++++++++++---------
23
2 files changed, 26 insertions(+), 9 deletions(-)
25
diff --git a/ChangeLog b/ChangeLog
26
index ac717c5..3352429 100644
30
+2007-10-04 Herbert Xu <herbert@gondor.apana.org.au>
32
+ * Fix parsing of ${##1}.
34
2007-10-04 Alexey Gladkov <legion@altlinux.org>
36
* Add --enable-static option to configure.
37
diff --git a/src/parser.c b/src/parser.c
38
index cac0aa5..9edb824 100644
41
@@ -1167,15 +1167,9 @@ parsesub: {
46
- if ((c = pgetc()) == '}')
56
if (c > PEOA && is_name(c)) {
59
@@ -1188,8 +1182,27 @@ parsesub: {
60
} while (is_digit(c));
62
else if (is_special(c)) {
68
+ if (!subtype && cc == '#') {
71
+ if (c == '_' || isalnum(c))
76
+ if (cc == '}' || c != '}') {
87
badsub: synerror("Bad substitution");