Module Name: src
Committed By: christos
Date: Thu Mar 31 16:12:52 UTC 2016
Modified Files:
src/bin/sh: parser.c
Log Message:
PR bin/51027 - fix the parsing of references to shell parameters
when given without braces (ie: $2 etc). Only the first 9 shell
parameters ($1 .. $9) and the special parameter ($0) can be
referenced this way, $10 is ${1}0 not ${10}. Make it so.
This bug brought to notice by Sven Mascheck's web pages which
discuss (among other things) the history of this (and other ash
based) shells .. see http://www.in-ulm.de/~mascheck/ (from kre@)
To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/bin/sh/parser.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.113 src/bin/sh/parser.c:1.114
--- src/bin/sh/parser.c:1.113 Thu Mar 31 12:12:09 2016
+++ src/bin/sh/parser.c Thu Mar 31 12:12:52 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $ */
+/* $NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95";
#else
-__RCSID("$NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $");
#endif
#endif /* not lint */
@@ -1742,7 +1742,7 @@ parsesub: {
do {
USTPUTC(c, out);
c = pgetc();
- } while (is_digit(c));
+ } while (subtype != VSNORMAL && is_digit(c));
}
else if (is_special(c)) {
USTPUTC(c, out);