diff options
author | peter <peter@FreeBSD.org> | 1996-09-10 02:42:33 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-09-10 02:42:33 +0000 |
commit | 614a655c28be6073db8df17ebd9d375bd8ae8177 (patch) | |
tree | 14134b75b61a4e162ef2c992693d5280b489395a /bin/sh/parser.c | |
parent | 7c1eab4782f77ffff1d0bb055cd721f10a5a4d2d (diff) | |
download | FreeBSD-src-614a655c28be6073db8df17ebd9d375bd8ae8177.zip FreeBSD-src-614a655c28be6073db8df17ebd9d375bd8ae8177.tar.gz |
Ok, lets try this again, shall we? It was definatly my mistake, not
Steve's.. :-]
Diffstat (limited to 'bin/sh/parser.c')
-rw-r--r-- | bin/sh/parser.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 291f152..1874531 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: parser.c,v 1.13 1996/09/03 14:15:57 peter Exp $ + * $Id$ */ #ifndef lint @@ -1141,6 +1141,7 @@ parsesub: { #ifndef GDB_HACK static const char types[] = "}-+?="; #endif + int bracketed_name = 0; /* used to handle ${[0-9]*} variables */ c = pgetc(); if (c != '(' && c != '{' && !is_name(c) && !is_special(c)) { @@ -1159,6 +1160,7 @@ parsesub: { USTPUTC(VSNORMAL, out); subtype = VSNORMAL; if (c == '{') { + bracketed_name = 1; c = pgetc(); if (c == '#') { if ((c = pgetc()) == '}') @@ -1174,6 +1176,16 @@ parsesub: { STPUTC(c, out); c = pgetc(); } while (is_in_name(c)); + } else if (is_digit(c)) { + if (bracketed_name) { + do { + STPUTC(c, out); + c = pgetc(); + } while (is_digit(c)); + } else { + STPUTC(c, out); + c = pgetc(); + } } else { if (! is_special(c)) badsub: synerror("Bad substitution"); |