summary refs log tree commit diff
path: root/src/mksyntax.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/mksyntax.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 '')
-rw-r--r--src/mksyntax.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mksyntax.c b/src/mksyntax.c
index 7a8a9ae..9ecbb45 100644
--- a/src/mksyntax.c
+++ b/src/mksyntax.c
@@ -53,6 +53,7 @@ struct synclass synclass[] = {
 	{ "CWORD",	"character is nothing special" },
 	{ "CNL",	"newline character" },
 	{ "CBACK",	"a backslash character" },
+	{ "CDBACK",	"a backslash character in double quotes" },
 	{ "CSQUOTE",	"single quote" },
 	{ "CDQUOTE",	"double quote" },
 	{ "CENDQUOTE",	"a terminating quote" },
@@ -175,7 +176,7 @@ main(int argc, char **argv)
 	init();
 	fputs("\n/* syntax table used when in double quotes */\n", cfile);
 	add("\n", "CNL");
-	add("\\", "CBACK");
+	add("\\", "CDBACK");
 	add("\"", "CENDQUOTE");
 	add("`", "CBQUOTE");
 	add("$", "CVAR");
@@ -193,7 +194,7 @@ main(int argc, char **argv)
 	init();
 	fputs("\n/* syntax table used when in arithmetic */\n", cfile);
 	add("\n", "CNL");
-	add("\\", "CBACK");
+	add("\\", "CDBACK");
 	add("`", "CBQUOTE");
 	add("$", "CVAR");
 	add("}", "CENDVAR");