1 diff -urN netbsd-sh/mksyntax.c ash-0.3.7.orig/mksyntax.c
2 --- netbsd-sh/mksyntax.c Fri Jan 12 17:50:38 2001
3 +++ ash-0.3.7.orig/mksyntax.c Mon Apr 23 22:16:46 2001
7 /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
8 - add("!*?[=~:/-", "CCTL");
9 + add("!*?[=~:/-]", "CCTL");
12 fputs("\n/* syntax table used when in single quotes */\n", cfile);
14 add("'", "CENDQUOTE");
15 /* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
16 - add("!*?[=~:/-", "CCTL");
17 + add("!*?[=~:/-]\\", "CCTL");
20 fputs("\n/* syntax table used when in arithmetic */\n", cfile);
21 diff -urN netbsd-sh/parser.c ash-0.3.7.orig/parser.c
22 --- netbsd-sh/parser.c Fri Jan 12 17:50:39 2001
23 +++ ash-0.3.7.orig/parser.c Mon Apr 23 22:16:46 2001
25 union node *n1, *n2, *n3;
31 if ((t = readtoken()) == TAND) {
38 n3 = (union node *)stalloc(sizeof (struct nbinary));
43 TRACE(("pipeline: entered\n"));
44 - while (readtoken() == TNOT)
45 + if (readtoken() == TNOT) {
52 if (readtoken() == TPIPE) {
53 pipenode = (union node *)stalloc(sizeof (struct npipe));
57 lp = (struct nodelist *)stalloc(sizeof (struct nodelist));
61 } while (readtoken() == TPIPE);
63 union node *ap, **app;
64 union node *cp, **cpp;
65 union node *redir, **rpp;
77 - while (readtoken() == TNOT) {
78 - TRACE(("command: TNOT recognized\n"));
83 switch (readtoken()) {
85 n1 = (union node *)stalloc(sizeof (struct nif));
87 cpp = &n1->ncase.cases;
88 checkkwd = 2, readtoken();
90 + if (lasttoken == TLP)
92 *cpp = cp = (union node *)stalloc(sizeof (struct nclist));
94 app = &cp->nclist.pattern;
97 /* Handle an empty command like other simple commands. */
106 * An empty command before a ; doesn't make much sense, and
107 * should certainly be disallowed in the case of `if ;'.
118 n1 = simplecmd(rpp, redir);
125 n1->nredir.redirect = redir;
130 - n2 = (union node *)stalloc(sizeof (struct nnot));
143 union node *args, **app;
144 union node **orig_rpp = rpp;
145 - union node *n = NULL, *n2;
147 + union node *n = NULL;
149 /* If we don't have any redirections already, then we must reset */
150 /* rpp to be the address of the local redir variable. */
155 - while (readtoken() == TNOT) {
156 - TRACE(("command: TNOT recognized\n"));
162 if (readtoken() == TWORD) {
163 n = (union node *)stalloc(sizeof (struct narg));
165 synerror("Bad function name");
169 n->narg.next = command();
178 n->ncmd.redirect = redir;
182 - n2 = (union node *)stalloc(sizeof (struct nnot));
197 - checkkwd = (t == TNOT) ? savecheckkwd : 0;
203 int varnest; /* levels of variables expansion */
204 int arinest; /* levels of arithmetic expansion */
205 int parenlevel; /* levels of parens in arithmetic */
206 + int dqvarnest; /* levels of variables expansion within double quotes */
208 char const *prevsyntax; /* syntax before arithmetic */
225 loop: { /* for each line, until end of word */
230 - if (eofmark == NULL || dblquote)
231 + if ((eofmark == NULL || dblquote) &&
233 USTPUTC(CTLESC, out);
240 - } else if (eofmark == NULL) {
241 + } else if (eofmark == NULL &&
247 case CENDVAR: /* '}' */
250 + if (dqvarnest > 0) {
253 USTPUTC(CTLENDVAR, out);
256 @@ -1260,8 +1248,12 @@
257 if (dblquote || arinest)
259 *(stackblock() + typeloc) = subtype | flags;
260 - if (subtype != VSNORMAL)
261 + if (subtype != VSNORMAL) {
268 goto parsesub_return;