From 7cfd8be0dc83342b4a71f3a8e5b7efab4670e50c Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Tue, 25 Sep 2007 22:29:00 +0800 Subject: [EXPAND] Move parse-time quote flag detection to run-time Because the parser does not recursively parse parameter expansion with respect to quotes, we can't accurately determine quote status at parse time. This patch works around this by moving the quote detection to run-time where we do interpret it recursively. Test case: foo=\\ echo "<${foo#[\\]}>" Old result: <\> New result: <> --- src/mystring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mystring.c') diff --git a/src/mystring.c b/src/mystring.c index 49201a9..7d937a8 100644 --- a/src/mystring.c +++ b/src/mystring.c @@ -55,7 +55,8 @@ char nullstr[1]; /* zero length string */ const char spcstr[] = " "; const char snlfmt[] = "%s\n"; -const char dolatstr[] = { CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' }; +const char dolatstr[] = { CTLQUOTEMARK, CTLVAR, VSNORMAL, '@', '=', + CTLQUOTEMARK, '\0' }; const char illnum[] = "Illegal number: %s"; const char homestr[] = "HOME"; -- cgit 1.4.1