summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-04-11 12:24:47 +0000
committerjilles <jilles@FreeBSD.org>2010-04-11 12:24:47 +0000
commit160d26da32d45e41bb0e8e229530479a1ae957ef (patch)
tree3e27875db3322354a4de8fb72bef072e3a53c1a2
parent22858658af4aa248638b9368d74ebd0b9779a046 (diff)
downloadFreeBSD-src-160d26da32d45e41bb0e8e229530479a1ae957ef.zip
FreeBSD-src-160d26da32d45e41bb0e8e229530479a1ae957ef.tar.gz
sh: Partially revert r206146, allowing double-quotes in arithmetic.
These do pretty much nothing (except that parentheses are ignored), but people seem to use them and allowing them does not hurt much. Single-quotes seem not to be used and cause silently different behaviour with ksh93 character constants.
-rw-r--r--bin/sh/mksyntax.c1
-rw-r--r--bin/sh/parser.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c
index f5bc51a..7a38ad1 100644
--- a/bin/sh/mksyntax.c
+++ b/bin/sh/mksyntax.c
@@ -232,6 +232,7 @@ main(int argc __unused, char **argv __unused)
add("\n", "CNL");
add("\\", "CBACK");
add("`", "CBQUOTE");
+ add("\"", "CDQUOTE");
add("$", "CVAR");
add("}", "CENDVAR");
add("(", "CLP");
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 64c97aa..29ccd83 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -1223,7 +1223,10 @@ readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs)
if (eofmark != NULL && newvarnest == 0)
USTPUTC(c, out);
else {
- state[level].syntax = BASESYNTAX;
+ if (state[level].category == TSTATE_ARITH)
+ state[level].syntax = ARISYNTAX;
+ else
+ state[level].syntax = BASESYNTAX;
quotef++;
}
break;
OpenPOWER on IntegriCloud