summary refs log tree commit diff
path: root/src/expand.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-09-24 16:17:20 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2007-09-24 16:17:20 +0800
commit880d95239e64f1dfd2b4fb49f32e1e0e59c69a67 (patch)
tree42e594dad1d31a24d4ed795008501f3f38f44637 /src/expand.c
parent[BUILTIN] test: little size and speed optimizations (diff)
downloaddash-880d95239e64f1dfd2b4fb49f32e1e0e59c69a67.tar.gz
dash-880d95239e64f1dfd2b4fb49f32e1e0e59c69a67.zip
[EXPAND] Do not quote back slashes in parameter expansions outside quotes
Test case:

	a=/b/c/*
	b=\\
	echo ${a%$b*}

Old result:

	/b/c/*

New result:

	/b/c/
Diffstat (limited to 'src/expand.c')
-rw-r--r--src/expand.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/expand.c b/src/expand.c
index db67c7c..3956112 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -895,7 +895,7 @@ memtodest(const char *p, size_t len, const char *syntax, int quotes) {
 		int c = (signed char)*p++;
 		if (c) {
 			if ((quotes & QUOTES_ESC) &&
-			    (syntax[c] == CCTL || syntax[c] == CBACK))
+			    (syntax[c] == CCTL || syntax[c] == CDBACK))
 				USTPUTC(CTLESC, q);
 		} else if (!(quotes & QUOTES_KEEPNUL))
 			continue;
@@ -1671,9 +1671,8 @@ _rmescapes(char *str, int flag)
 		}
 		if (*p == (char)CTLESC) {
 			p++;
-			if (notescaped && inquotes && *p != '/') {
+			if (notescaped && inquotes)
 				*q++ = '\\';
-			}
 		}
 		notescaped = globbing;
 copy: