clean up chtypes use

This commit is contained in:
tg 2016-08-01 18:42:42 +00:00
parent 59619ee2ab
commit cc6857dfb6
2 changed files with 7 additions and 8 deletions

5
edit.c
View File

@ -28,7 +28,7 @@
#ifndef MKSH_NO_CMDLINE_EDITING
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.305 2016/08/01 14:25:39 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.306 2016/08/01 18:42:40 tg Exp $");
/*
* in later versions we might use libtermcap for this, but since external
@ -843,12 +843,11 @@ static int
x_escape(const char *s, size_t len, int (*putbuf_func)(const char *, size_t))
{
size_t add = 0, wlen = len;
const char *ifs = str_val(local("IFS", 0));
int rval = 0;
while (wlen - add > 0)
if (vstrchr("\"#$&'()*:;<=>?[\\`{|}", s[add]) ||
vstrchr(ifs, s[add])) {
ctype(s[add], C_IFS)) {
if (putbuf_func(s, add) != 0) {
rval = -1;
break;

10
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.244 2016/07/25 20:36:28 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.245 2016/08/01 18:42:42 tg Exp $");
#define KSH_CHVT_FLAG
#ifdef MKSH_SMALL
@ -78,12 +78,12 @@ static int make_path(const char *, const char *, char **, XString *, int *);
void
setctypes(const char *s, int t)
{
unsigned int i;
if (t & C_IFS) {
for (i = 0; i < UCHAR_MAX + 1; i++)
unsigned int i = 0;
while (++i <= UCHAR_MAX)
chtypes[i] &= ~C_IFS;
/* include \0 in C_IFS */
/* include '\0' in C_IFS */
chtypes[0] |= C_IFS;
}
while (*s != 0)