try to handle Beof in the macros (Michael Teichgräber)

This commit is contained in:
rsc 2007-03-25 18:32:51 +00:00
parent ff3dce55bf
commit 79049567a0
3 changed files with 15 additions and 15 deletions

View file

@ -685,7 +685,7 @@ gotop(int c)
char *a, *b;
op_ptr = optmp;
*op_ptr++ = c;
while (isop(( *op_ptr = getch())))op_ptr++;
while (isop((uchar)( *op_ptr = getch())))op_ptr++;
if(!strict)unget(*op_ptr);
else if (*op_ptr != ' ')unget( *op_ptr);
*op_ptr = '\0';
@ -845,7 +845,7 @@ lookup(char *first, char *last)
ptr = key;
while ((ckey = ptr->name) != 0){
for (k = cptr; (*ckey == *k && *ckey != '\0'); k++, ckey++);
if(*ckey=='\0' && (k==last|| (k<last && !isalnum(*k)))){
if(*ckey=='\0' && (k==last|| (k<last && !isalnum((uchar)*k)))){
opflag = 1;
lastlook = 0;
return(ptr);
@ -955,7 +955,7 @@ getnext(int must){
}
tp = lastplace;
if(inswitch && tptr <= lastplace)
if (isalnum(*lastplace)||ispunct(*lastplace)||isop(*lastplace))return(lastplace);
if (isalnum((uchar)*lastplace)||ispunct((uchar)*lastplace)||isop((uchar)*lastplace))return(lastplace);
space:
while(isspace(c=Bgetc(input)))puttmp(c,1);
beg = tp;

View file

@ -1,6 +1,6 @@
#include "cbtype.h"
unsigned char _cbtype_[] = {
unsigned char _cbtype_[257] = {
0,
_C, _C, _C, _C, _C, _C, _C, _C,
_C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C,

View file

@ -34,17 +34,17 @@ extern unsigned char _cbtype_[]; /* in /usr/src/libc/gen/ctype_.c */
#undef tolower
#undef toascii
#define isop(c) ((_cbtype_+1)[(uchar)(c)]&_O)
#define isalpha(c) ((_cbtype_+1)[(uchar)(c)]&(_U|_L))
#define isupper(c) ((_cbtype_+1)[(uchar)(c)]&_U)
#define islower(c) ((_cbtype_+1)[(uchar)(c)]&_L)
#define isdigit(c) ((_cbtype_+1)[(uchar)(c)]&_N)
#define isxdigit(c) ((_cbtype_+1)[(uchar)(c)]&(_N|_X))
#define isspace(c) ((_cbtype_+1)[(uchar)(c)]&_S)
#define ispunct(c) ((_cbtype_+1)[(uchar)(c)]&_P)
#define isalnum(c) ((_cbtype_+1)[(uchar)(c)]&(_U|_L|_N))
#define isprint(c) ((_cbtype_+1)[(uchar)(c)]&(_P|_U|_L|_N))
#define iscntrl(c) ((_cbtype_+1)[(uchar)(c)]&_C)
#define isop(c) ((_cbtype_+1)[c]&_O)
#define isalpha(c) ((_cbtype_+1)[c]&(_U|_L))
#define isupper(c) ((_cbtype_+1)[c]&_U)
#define islower(c) ((_cbtype_+1)[c]&_L)
#define isdigit(c) ((_cbtype_+1)[c]&_N)
#define isxdigit(c) ((_cbtype_+1)[c]&(_N|_X))
#define isspace(c) ((_cbtype_+1)[c]&_S)
#define ispunct(c) ((_cbtype_+1)[c]&_P)
#define isalnum(c) ((_cbtype_+1)[c]&(_U|_L|_N))
#define isprint(c) ((_cbtype_+1)[c]&(_P|_U|_L|_N))
#define iscntrl(c) ((_cbtype_+1)[c]&_C)
#define isascii(c) ((unsigned)(c)<=0177)
#define toupper(c) ((c)-'a'+'A')
#define tolower(c) ((c)-'A'+'a')