I think the ord thing was a red herring

This commit is contained in:
tg
2018-01-14 00:51:35 +00:00
parent 9691e330b9
commit 7716e825ab

23
lex.c
View File

@@ -23,7 +23,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.243 2018/01/14 00:22:28 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/lex.c,v 1.244 2018/01/14 00:51:35 tg Exp $");
/* /*
* states while lexing word * states while lexing word
@@ -130,13 +130,8 @@ getsc_i(void)
o_getsc_r(o_getsc()); o_getsc_r(o_getsc());
} }
/*XXX
* getsc() result is supposed to be ord()ed right now,
* but results sometimes aren't handled correctly; re
* check CVS history for *that* change and fix it
*/
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST) #if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
#define getsc() getsc_i() #define getsc() ord(getsc_i())
#else #else
static int getsc_r(int); static int getsc_r(int);
@@ -146,7 +141,7 @@ getsc_r(int c)
o_getsc_r(c); o_getsc_r(c);
} }
#define getsc() getsc_r(o_getsc()) #define getsc() ord(getsc_r(o_getsc()))
#endif #endif
#define STATE_BSIZE 8 #define STATE_BSIZE 8
@@ -225,12 +220,14 @@ yylex(int cf)
} else { } else {
/* normal lexing */ /* normal lexing */
state = (cf & HEREDELIM) ? SHEREDELIM : SBASE; state = (cf & HEREDELIM) ? SHEREDELIM : SBASE;
while (ctype((c = getsc()), C_BLANK)) do {
; c = getsc();
if (ord(c) == '#') { } while (ctype(c, C_BLANK));
if (c == '#') {
ignore_backslash_newline++; ignore_backslash_newline++;
while (!ctype((c = getsc()), C_NUL | C_LF)) do {
; c = getsc();
} while (!ctype(c, C_NUL | C_LF));
ignore_backslash_newline--; ignore_backslash_newline--;
} }
ungetsc(c); ungetsc(c);