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"
|
#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
|
* string expansion
|
||||||
@ -897,7 +897,7 @@ expand(
|
|||||||
--newlines;
|
--newlines;
|
||||||
} else {
|
} else {
|
||||||
while ((c = shf_getc(x.u.shf)) == 0 ||
|
while ((c = shf_getc(x.u.shf)) == 0 ||
|
||||||
ctype(c, C_NL)) {
|
cinttype(c, C_NL)) {
|
||||||
#ifdef MKSH_WITH_TEXTMODE
|
#ifdef MKSH_WITH_TEXTMODE
|
||||||
if (c == '\r') {
|
if (c == '\r') {
|
||||||
c = shf_getc(x.u.shf);
|
c = shf_getc(x.u.shf);
|
||||||
|
6
lex.c
6
lex.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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
|
* states while lexing word
|
||||||
@ -248,7 +248,7 @@ yylex(int cf)
|
|||||||
|
|
||||||
/* collect non-special or quoted characters to form word */
|
/* collect non-special or quoted characters to form word */
|
||||||
while (!((c = getsc()) == 0 ||
|
while (!((c = getsc()) == 0 ||
|
||||||
((state == SBASE || state == SHEREDELIM) && ctype(c, C_LEX1)))) {
|
((state == SBASE || state == SHEREDELIM) && cinttype(c, C_LEX1)))) {
|
||||||
if (state == SBASE &&
|
if (state == SBASE &&
|
||||||
subshell_nesting_type == ORD(/*{*/ '}') &&
|
subshell_nesting_type == ORD(/*{*/ '}') &&
|
||||||
(unsigned int)c == ORD(/*{*/ '}'))
|
(unsigned int)c == ORD(/*{*/ '}'))
|
||||||
@ -299,7 +299,7 @@ yylex(int cf)
|
|||||||
}
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
Sbase1: /* includes *(...|...) pattern (*+?@!) */
|
Sbase1: /* includes *(...|...) pattern (*+?@!) */
|
||||||
if (ctype(c, C_PATMO)) {
|
if (cinttype(c, C_PATMO)) {
|
||||||
c2 = getsc();
|
c2 = getsc();
|
||||||
if ((unsigned int)c2 == ORD('(' /*)*/)) {
|
if ((unsigned int)c2 == ORD('(' /*)*/)) {
|
||||||
*wp++ = OPAT;
|
*wp++ = OPAT;
|
||||||
|
5
sh.h
5
sh.h
@ -182,7 +182,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#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
|
#endif
|
||||||
#define MKSH_VERSION "R56 2017/10/17"
|
#define MKSH_VERSION "R56 2017/10/17"
|
||||||
|
|
||||||
@ -1516,6 +1516,9 @@ extern void ebcdic_init(void);
|
|||||||
/* new fast character classes */
|
/* new fast character classes */
|
||||||
#define ctype(c,t) tobool(ksh_ctypes[ord(c)] & (t))
|
#define ctype(c,t) tobool(ksh_ctypes[ord(c)] & (t))
|
||||||
/* helper functions */
|
/* 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')
|
#define ksh_isdash(s) tobool(ord((s)[0]) == '-' && ord((s)[1]) == '\0')
|
||||||
/* invariant distance even in EBCDIC */
|
/* invariant distance even in EBCDIC */
|
||||||
#define ksh_tolower(c) (ctype(c, C_UPPER) ? (c) - 'A' + 'a' : (c))
|
#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"
|
#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 {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@ -95,7 +95,7 @@ yyparse(bool doalias)
|
|||||||
c = tpeek(0);
|
c = tpeek(0);
|
||||||
if (c == 0 && !outtree)
|
if (c == 0 && !outtree)
|
||||||
outtree = newtp(TEOF);
|
outtree = newtp(TEOF);
|
||||||
else if (!ctype(c, C_LF | C_NUL))
|
else if (!cinttype(c, C_LF | C_NUL))
|
||||||
syntaxerr(NULL);
|
syntaxerr(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user