fix another expand-ugly SUSv4 bug

This commit is contained in:
tg 2010-03-27 16:53:17 +00:00
parent 98e43b0f7a
commit 401e262689
3 changed files with 26 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.369 2010/03/18 19:45:39 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.370 2010/03/27 16:53:15 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 $
@ -25,7 +25,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R39 2010/03/14
@(#)MIRBSD KSH R39 2010/03/27
description:
Check version of shell.
stdin:

27
lex.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.110 2010/02/25 20:18:16 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.111 2010/03/27 16:53:16 tg Exp $");
/*
* states while lexing word
@ -324,6 +324,7 @@ yylex(int cf)
getsc_qchar:
if ((c = getsc())) {
/* trailing \ is lost */
store_qchar:
*wp++ = QCHAR;
*wp++ = c;
}
@ -687,15 +688,31 @@ yylex(int cf)
*wp++ = c;
break;
case SQBRACE:
if (c == '\\') {
/*
* perform POSIX "quote removal" if the back-
* slash is "special", i.e. same cases as the
* {case '\\':} in Subst: plus closing brace;
* in mksh code "quote removal" on '\c' means
* write QCHAR+c, otherwise CHAR+\+CHAR+c are
* emitted (in heredocquote:)
*/
if ((c = getsc()) == '"' || c == '\\' ||
c == '$' || c == '`' || c == /*{*/'}')
goto store_qchar;
goto heredocquote;
}
goto common_SQBRACE;
case SBRACE:
if (c == '\'')
goto open_ssquote;
/* FALLTHROUGH */
case SQBRACE:
if (c == '"')
goto open_sdquote;
else if (c == '\\')
goto getsc_qchar;
common_SQBRACE:
if (c == '"')
goto open_sdquote;
else if (c == '$')
goto subst_dollar;
else if (c == '`')

4
sh.h
View File

@ -150,9 +150,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.385 2010/03/27 16:51:39 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.386 2010/03/27 16:53:17 tg Exp $");
#endif
#define MKSH_VERSION "R39 2010/03/14"
#define MKSH_VERSION "R39 2010/03/27"
#ifndef MKSH_INCLUDES_ONLY