plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit 79049567a0fac8707ea3f2927403445bdb2394fa
parent ff3dce55bfbc7da32db11803f2acac7ec30c35c9
Author: rsc <devnull@localhost>
Date:   Sun, 25 Mar 2007 18:32:51 +0000

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

Diffstat:
Msrc/cmd/cb/cb.c | 6+++---
Msrc/cmd/cb/cbtype.c | 2+-
Msrc/cmd/cb/cbtype.h | 22+++++++++++-----------
3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/cmd/cb/cb.c b/src/cmd/cb/cb.c @@ -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; diff --git a/src/cmd/cb/cbtype.c b/src/cmd/cb/cbtype.c @@ -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, diff --git a/src/cmd/cb/cbtype.h b/src/cmd/cb/cbtype.h @@ -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')