plug the first couple of ctype bugs
This commit is contained in:
parent
9e4868fb06
commit
609f5c2256
4
eval.c
4
eval.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.217 2018/01/14 00:03:02 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.218 2018/01/14 00:22:27 tg Exp $");
|
||||
|
||||
/*
|
||||
* string expansion
|
||||
@ -897,7 +897,7 @@ expand(
|
||||
--newlines;
|
||||
} else {
|
||||
while ((c = shf_getc(x.u.shf)) == 0 ||
|
||||
ctype(c, C_NL)) {
|
||||
cinttype(c, C_NL)) {
|
||||
#ifdef MKSH_WITH_TEXTMODE
|
||||
if (c == '\r') {
|
||||
c = shf_getc(x.u.shf);
|
||||
|
6
lex.c
6
lex.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.242 2018/01/14 00:03:02 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.243 2018/01/14 00:22:28 tg Exp $");
|
||||
|
||||
/*
|
||||
* states while lexing word
|
||||
@ -248,7 +248,7 @@ yylex(int cf)
|
||||
|
||||
/* collect non-special or quoted characters to form word */
|
||||
while (!((c = getsc()) == 0 ||
|
||||
((state == SBASE || state == SHEREDELIM) && ctype(c, C_LEX1)))) {
|
||||
((state == SBASE || state == SHEREDELIM) && cinttype(c, C_LEX1)))) {
|
||||
if (state == SBASE &&
|
||||
subshell_nesting_type == ORD(/*{*/ '}') &&
|
||||
(unsigned int)c == ORD(/*{*/ '}'))
|
||||
@ -299,7 +299,7 @@ yylex(int cf)
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
Sbase1: /* includes *(...|...) pattern (*+?@!) */
|
||||
if (ctype(c, C_PATMO)) {
|
||||
if (cinttype(c, C_PATMO)) {
|
||||
c2 = getsc();
|
||||
if ((unsigned int)c2 == ORD('(' /*)*/)) {
|
||||
*wp++ = OPAT;
|
||||
|
5
sh.h
5
sh.h
@ -182,7 +182,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.853 2018/01/14 00:09:34 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.854 2018/01/14 00:22:29 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R56 2017/10/17"
|
||||
|
||||
@ -1516,6 +1516,9 @@ extern void ebcdic_init(void);
|
||||
/* new fast character classes */
|
||||
#define ctype(c,t) tobool(ksh_ctypes[ord(c)] & (t))
|
||||
/* 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))
|
||||
|
4
syn.c
4
syn.c
@ -24,7 +24,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.126 2018/01/14 00:03:04 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.127 2018/01/14 00:22:30 tg Exp $");
|
||||
|
||||
struct nesting_state {
|
||||
int start_token; /* token than began nesting (eg, FOR) */
|
||||
@ -95,7 +95,7 @@ yyparse(bool doalias)
|
||||
c = tpeek(0);
|
||||
if (c == 0 && !outtree)
|
||||
outtree = newtp(TEOF);
|
||||
else if (!ctype(c, C_LF | C_NUL))
|
||||
else if (!cinttype(c, C_LF | C_NUL))
|
||||
syntaxerr(NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user