oops, ctypes are indexed by ASCII value even on EBCDIC systems

This commit is contained in:
tg 2017-04-28 03:51:14 +00:00
parent d905bd16e1
commit dba2efa290
2 changed files with 4 additions and 4 deletions

4
sh.h
View File

@ -175,7 +175,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.826 2017/04/28 03:46:50 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.827 2017/04/28 03:51:13 tg Exp $");
#endif
#define MKSH_VERSION "R55 2017/04/27"
@ -1489,7 +1489,7 @@ extern void ebcdic_init(void);
#define ksh_eq(c,u,l) ((ord(c) | 0x20) == ord(l))
#endif
/* new fast character classes */
#define ctype(c,t) tobool(ksh_ctypes[ord(c)] & (t))
#define ctype(c,t) tobool(ksh_ctypes[rtt2asc(c)] & (t))
/* helper functions */
#define ksh_isdash(s) tobool(ord((s)[0]) == '-' && ord((s)[1]) == '\0')
/* invariant distance even in EBCDIC */

4
shf.c
View File

@ -25,7 +25,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.87 2017/04/28 02:40:26 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.88 2017/04/28 03:51:14 tg Exp $");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */
@ -1214,7 +1214,7 @@ set_ifs(const char *s)
memset(ksh_ctypes + sizeof(tpl_ctypes), '\0',
sizeof(ksh_ctypes) - sizeof(tpl_ctypes));
while (*s)
ksh_ctypes[ord(*s++)] |= CiIFS;
ksh_ctypes[rtt2asc(*s++)] |= CiIFS;
}
#ifdef MKSH_EBCDIC