This commit is contained in:
tg 2018-01-14 01:44:02 +00:00
parent cc59adb1f5
commit 5c920fe4db
2 changed files with 6 additions and 7 deletions

6
lex.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.246 2018/01/14 01:25:28 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.247 2018/01/14 01:44:01 tg Exp $");
/*
* states while lexing word
@ -245,7 +245,7 @@ yylex(int cf)
/* collect non-special or quoted characters to form word */
while (!((c = getsc()) == 0 ||
((state == SBASE || state == SHEREDELIM) && cinttype(c, C_LEX1)))) {
((state == SBASE || state == SHEREDELIM) && ctype(c, C_LEX1)))) {
if (state == SBASE &&
subshell_nesting_type == ORD(/*{*/ '}') &&
(unsigned int)c == ORD(/*{*/ '}'))
@ -296,7 +296,7 @@ yylex(int cf)
}
/* FALLTHROUGH */
Sbase1: /* includes *(...|...) pattern (*+?@!) */
if (cinttype(c, C_PATMO)) {
if (ctype(c, C_PATMO)) {
c2 = getsc();
if ((unsigned int)c2 == ORD('(' /*)*/)) {
*wp++ = OPAT;

7
sh.h
View File

@ -182,7 +182,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.856 2018/01/14 01:28:15 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.857 2018/01/14 01:44:02 tg Exp $");
#endif
#define MKSH_VERSION "R56 2017/10/17"
@ -1515,10 +1515,9 @@ extern void ebcdic_init(void);
#endif
/* new fast character classes */
#define ctype(c,t) tobool(ksh_ctypes[ord(c)] & (t))
#define cinttype(c,t) ((c) >= 0 && (c) <= 0xFF ? \
tobool(ksh_ctypes[(unsigned char)(c)] & (t)) : false)
/* helper functions */
#define cinttype(c,t) (intischar(c) ? \
tobool(ksh_ctypes[(unsigned char)(c)] & (t)) : 0)
#define intischar(i) ((i) >= 0 && (i) <= 0xFF)
#define ksh_isdash(s) tobool(ord((s)[0]) == '-' && ord((s)[1]) == '\0')
/* invariant distance even in EBCDIC */
#define ksh_tolower(c) (ctype(c, C_UPPER) ? (c) - 'A' + 'a' : (c))