From 7f728c60bc55821e8651ac693c64fd34e0dc1975 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 11 Apr 2010 12:24:47 +0000 Subject: [PATCH] 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. --- bin/sh/mksyntax.c | 1 + bin/sh/parser.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index f5bc51a2251b..7a38ad192025 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 64c97aa451a4..29ccd83f5a43 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;