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/jobs.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/jobs.c') diff --git a/src/jobs.c b/src/jobs.c index 7285d0d..529d615 100644 --- a/src/jobs.c +++ b/src/jobs.c @@ -1377,12 +1377,7 @@ cmdputs(const char *s) str = "${#"; else str = "${"; - if (!(subtype & VSQUOTE) != !(quoted & 1)) { - quoted ^= 1; - c = '"'; - } else - goto dostr; - break; + goto dostr; case CTLENDVAR: str = "\"}" + !(quoted & 1); quoted >>= 1; @@ -1391,9 +1386,6 @@ cmdputs(const char *s) case CTLBACKQ: str = "$(...)"; goto dostr; - case CTLBACKQ+CTLQUOTE: - str = "\"$(...)\""; - goto dostr; case CTLARI: str = "$(("; goto dostr; -- cgit 1.4.1