… and fix that bug.

Guvf pbzzvg haxabjvatyl fcbafberq
ol NheVFC ToE, fvapr jr hfr zxfu,
naq zl bgure gnfxf ner jnvgvat...
This commit is contained in:
tg 2007-07-23 14:28:52 +00:00
parent 7c0209771c
commit f2a52c65fa
3 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.128 2007/07/23 14:10:48 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.129 2007/07/23 14:28:51 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -7,7 +7,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R30 2007/07/22
@(#)MIRBSD KSH R30 2007/07/23
description:
Check version of shell.
category: pdksh

12
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.45 2007/07/22 14:01:49 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.46 2007/07/23 14:28:52 tg Exp $");
/* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state. */
@ -44,6 +44,7 @@ struct lex_state {
/* ADELIM */
struct sadelim_info {
unsigned char nparen; /* count open parentheses */
#define SADELIM_BASH 0
#define SADELIM_MAKE 1
unsigned char style;
@ -171,7 +172,12 @@ yylex(int cf)
Xcheck(ws, wp);
switch (state) {
case SADELIM:
if (c == /*{*/ '}' || c == statep->ls_sadelim.delimiter) {
if (c == '(')
statep->ls_sadelim.nparen++;
else if (c == ')')
statep->ls_sadelim.nparen--;
else if (statep->ls_sadelim.nparen == 0 &&
(c == /*{*/ '}' || c == statep->ls_sadelim.delimiter)) {
#ifdef notyet
if (statep->ls_sadelim.style == SADELIM_MAKE &&
statep->ls_sadelim.num == 1) {
@ -327,6 +333,7 @@ yylex(int cf)
statep->ls_sadelim.style = SADELIM_BASH;
statep->ls_sadelim.delimiter = ':';
statep->ls_sadelim.num = 1;
statep->ls_sadelim.nparen = 0;
break;
} else if (ksh_isdigit(c) ||
c == '('/*)*/ || c == ' ' ||
@ -341,6 +348,7 @@ yylex(int cf)
statep->ls_sadelim.style = SADELIM_BASH;
statep->ls_sadelim.delimiter = ':';
statep->ls_sadelim.num = 2;
statep->ls_sadelim.nparen = 0;
break;
}
}

4
sh.h
View File

@ -8,8 +8,8 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.161 2007/07/22 14:01:50 tg Exp $"
#define MKSH_VERSION "R30 2007/07/22"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.162 2007/07/23 14:28:52 tg Exp $"
#define MKSH_VERSION "R30 2007/07/23"
#if HAVE_SYS_PARAM_H
#include <sys/param.h>