svn commit: r206473 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sun Apr 11 12:24:48 UTC 2010


Author: jilles
Date: Sun Apr 11 12:24:47 2010
New Revision: 206473
URL: http://svn.freebsd.org/changeset/base/206473

Log:
  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.

Modified:
  head/bin/sh/mksyntax.c
  head/bin/sh/parser.c

Modified: head/bin/sh/mksyntax.c
==============================================================================
--- head/bin/sh/mksyntax.c	Sun Apr 11 12:07:03 2010	(r206472)
+++ head/bin/sh/mksyntax.c	Sun Apr 11 12:24:47 2010	(r206473)
@@ -232,6 +232,7 @@ main(int argc __unused, char **argv __un
 	add("\n", "CNL");
 	add("\\", "CBACK");
 	add("`", "CBQUOTE");
+	add("\"", "CDQUOTE");
 	add("$", "CVAR");
 	add("}", "CENDVAR");
 	add("(", "CLP");

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Sun Apr 11 12:07:03 2010	(r206472)
+++ head/bin/sh/parser.c	Sun Apr 11 12:24:47 2010	(r206473)
@@ -1223,7 +1223,10 @@ readtoken1(int firstc, char const *initi
 				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;


More information about the svn-src-head mailing list