NetBSD-macppc ctype needs uchars.

This commit is contained in:
rsc 2005-09-09 23:16:15 +00:00
parent 94d85bc000
commit 3bd56b04a8
22 changed files with 55 additions and 56 deletions

View file

@ -456,7 +456,7 @@ static int
isalldigit(char *s)
{
while(*s)
if(!isdigit(*s++))
if(!isdigit((uchar)*s++))
return 0;
return 1;
}

View file

@ -25,8 +25,7 @@ isostring(uchar *buf, int len)
while(len > 0 && p[len-1] == ' ')
p[--len] = '\0';
for(q=p; *q; q++)
*q = tolower(*q);
*q = tolower((uchar)*q);
q = atom(p);
free(p);
return q;

View file

@ -78,7 +78,7 @@ struprcpy(char *p, char *s)
op = p;
for(; *s; s++)
*p++ = toupper(*s);
*p++ = toupper((uchar)*s);
*p = '\0';
return op;

View file

@ -524,7 +524,7 @@ numsym(char first)
if(first == '.')
isfloat = 1;
if(isdigit(*p++) || isfloat) {
if(isdigit((uchar)*p++) || isfloat) {
for(;;) {
c = lexc();
if(c < 0)

View file

@ -115,7 +115,7 @@ comma(char **p)
static int
parseint(char **pp)
{
if(!isdigit(**pp))
if(!isdigit((uchar)**pp))
oops();
return strtol(*pp, pp, 10);
}
@ -129,7 +129,7 @@ parsename(char *desc, char **pp)
if(*desc == 'c')
return nil;
if(isdigit(*desc) || *desc=='-' || *desc=='(')
if(isdigit((uchar)*desc) || *desc=='-' || *desc=='(')
return parseinfo(desc, pp);
if(*desc == 0)
oops();
@ -169,7 +169,7 @@ parseinfo(char *desc, char **pp)
static int
parsenum(char *p, int *n1, int *n2, char **pp)
{
if(isdigit(*p)){
if(isdigit((uchar)*p)){
*n1 = strtol(p, &p, 10);
*n2 = 0;
*pp = p;
@ -316,7 +316,7 @@ parsedefn(char *p, Type *t, char **pp)
long val;
Type *tt;
if(*p == '(' || isdigit(*p)){
if(*p == '(' || isdigit((uchar)*p)){
t->ty = Defer;
t->sub = parseinfo(p, pp);
return t;
@ -587,7 +587,7 @@ parsebigint(char **pp)
neg = 1;
p++;
}
if(!isdigit(*p))
if(!isdigit((uchar)*p))
oops();
n = strtol(p, &p, 10);
if(neg)

View file

@ -373,7 +373,7 @@ nameof(Type *t, int doanon)
else
return "";
for(p=buf; *p; p++)
if(isspace(*p))
if(isspace((uchar)*p))
*p = '_';
return buf;
}

View file

@ -56,7 +56,7 @@ static void
strtolower(char *s)
{
while(*s){
*s = tolower(*s);
*s = tolower((uchar)*s);
s++;
}
}

View file

@ -22,11 +22,11 @@ scanform(long icount, int prt, char *ifp, Map *map, int literal)
savdot=dot;
/*now loop over format*/
while (*fp) {
if (!isdigit(*fp))
if (!isdigit((uchar)*fp))
fcount = 1;
else {
fcount = 0;
while (isdigit(c = *fp++)) {
while (isdigit((uchar)c = *fp++)) {
fcount *= 10;
fcount += c-'0';
}

View file

@ -301,14 +301,14 @@ parseaddr(char *line, char **eptr)
} else if(*line == '#') {
/* absolute byte offset into dictionary */
line++;
if(!isdigit(*line))
if(!isdigit((uchar)*line))
return -1;
v = strtoul(line, &e, 10);
line = e;
dot->doff[0] = v;
dot->n = 1;
dot->cur = 0;
} else if(isdigit(*line)) {
} else if(isdigit((uchar)*line)) {
v = strtoul(line, &e, 10);
line = e;
if(v < 1 || v > dot->n)

View file

@ -18,10 +18,10 @@ rogetprintentry(Entry e, int cmd)
p = e.start;
if(cmd == 'h'){
while(!isspace(*p) && p < e.end)
while(!isspace((uchar)*p) && p < e.end)
p++;
while(strncmp(p, " -- ", 4) != 0 && p < e.end){
while(isspace(*p) && p < e.end)
while(isspace((uchar)*p) && p < e.end)
p++;
if (*p == '[' || *p == '{'){
c = (*p == '[')? ']': '}';
@ -30,14 +30,14 @@ rogetprintentry(Entry e, int cmd)
p++;
continue;
}
if (isdigit(*p) || ispunct(*p)){
while(!isspace(*p) && p < e.end)
if (isdigit((uchar)*p) || ispunct((uchar)*p)){
while(!isspace((uchar)*p) && p < e.end)
p++;
continue;
}
if (isspace(*p))
if (isspace((uchar)*p))
spc = 1;
else
if (spc){
@ -45,15 +45,15 @@ rogetprintentry(Entry e, int cmd)
spc = 0;
}
while(!isspace(*p) && p < e.end)
while(!isspace((uchar)*p) && p < e.end)
outchar(*p++);
}
return;
}
while(p < e.end && !isspace(*p))
while(p < e.end && !isspace((uchar)*p))
p++;
while(p < e.end && isspace(*p))
while(p < e.end && isspace((uchar)*p))
p++;
while (p < e.end){
@ -78,18 +78,18 @@ rogetprintentry(Entry e, int cmd)
while(p < e.end && *p != ')')
outchar(*p++);
p++;
while(p < e.end && isspace(*p))
while(p < e.end && isspace((uchar)*p))
p++;
while(p < e.end && isdigit(*p))
while(p < e.end && isdigit((uchar)*p))
p++;
outchar('/');
continue;
}
if (p < e.end -3 && strncmp(p, "&c ", 3) == 0){ /* less usefull xref */
while(p < e.end && !isdigit(*p))
while(p < e.end && !isdigit((uchar)*p))
p++;
while(p < e.end && isdigit(*p))
while(p < e.end && isdigit((uchar)*p))
p++;
continue;
}
@ -97,8 +97,8 @@ rogetprintentry(Entry e, int cmd)
if (*p == '\n' && p < (e.end -1)){ /* their newlines */
spc = 0;
p++;
if (isspace(*p)){ /* their continuation line */
while (isspace(*p))
if (isspace((uchar)*p)){ /* their continuation line */
while (isspace((uchar)*p))
p++;
p--;
}
@ -107,11 +107,11 @@ rogetprintentry(Entry e, int cmd)
}
}
if (spc && *p != ';' && *p != '.' &&
*p != ',' && !isspace(*p)){ /* drop spaces before punct */
*p != ',' && !isspace((uchar)*p)){ /* drop spaces before punct */
spc = 0;
outchar(' ');
}
if (isspace(*p))
if (isspace((uchar)*p))
spc = 1;
else
outchar(*p);
@ -131,7 +131,7 @@ rogetnextoff(long fromoff)
Brdline(bdict, '\n');
while ((p = Brdline(bdict, '\n')) != nil){
l = Blinelen(bdict);
if (!isdigit(*p))
if (!isdigit((uchar)*p))
continue;
for (i = 0; i < l-4; i++)
if (strncmp(p+i, " -- ", 4) == 0)

View file

@ -82,7 +82,7 @@ readhash(Biobuf *bp, char *buf)
* coalesce multiple white-space
*/
for (space = 0; len--; p++) {
if (isspace(*p)) {
if (isspace((uchar)*p)) {
space++;
continue;
}
@ -99,7 +99,7 @@ readhash(Biobuf *bp, char *buf)
* strip all white-space
*/
while (len--) {
if (isspace(*p)) {
if (isspace((uchar)*p)) {
p++;
continue;
}
@ -167,7 +167,7 @@ squishspace(char *buf)
int space;
for (space = 0, q = p = buf; *q; q++) {
if (isspace(*q)) {
if (isspace((uchar)*q)) {
space++;
continue;
}

View file

@ -67,7 +67,7 @@ int remove_substr(char* smain, char* ssub)
int n = strlen(ssub);
if (s==0)
return 0;
if (islower(s[n]))
if (islower((uchar)s[n]))
s[0] ^= 32; /* probably tolower(s[0]) or toupper(s[0]) */
else {
for (ss=s+n; *ss!=0; s++, ss++)

View file

@ -107,7 +107,7 @@ scanflag(int c, char *f)
fc=*f++;
if(*f==':'){
f++;
if(!isdigit(*f)){ reason=FLAGSYN; return -1; }
if(!isdigit((uchar)*f)){ reason=FLAGSYN; return -1; }
count=strtol(f, &f, 10);
}
else

View file

@ -646,7 +646,7 @@ getstring(void){
return(-1);
switch(*labbuf) {
default:
if(!isdigit(*labbuf)) {
if(!isdigit((uchar)*labbuf)) {
ungetc(*labbuf,stdin);
i = scanf("%s",labbuf);
break;

View file

@ -31,7 +31,7 @@ isdk(char *name)
slash = 0;
for(; *name; name++){
if(isalnum(*name))
if(isalnum((uchar)*name))
continue;
if(*name == '/'){
slash = 1;
@ -52,7 +52,7 @@ isdomain(char *name)
int alpha = 0;
for(; *name; name++){
if(isalpha(*name) || *name == '-'){
if(isalpha((uchar)*name) || *name == '-'){
alpha = 1;
continue;
}
@ -60,7 +60,7 @@ isdomain(char *name)
dot = 1;
continue;
}
if(isdigit(*name))
if(isdigit((uchar)*name))
continue;
return 0;
}
@ -80,7 +80,7 @@ isip(char *name)
dot = 1;
continue;
}
if(isdigit(*name))
if(isdigit((uchar)*name))
continue;
return 0;
}

View file

@ -579,7 +579,7 @@ sysrun(int errto, char *fmt, ...)
if(tot == sizeof buf)
tot--;
buf[tot] = 0;
while(tot > 0 && isspace(buf[tot-1]))
while(tot > 0 && isspace((uchar)buf[tot-1]))
tot--;
buf[tot] = 0;
if(tot == 0){

View file

@ -494,7 +494,7 @@ void define(char *a){
short i, j;
int curly = 0;
ap = a;
while(isalpha(*ap))ap++;
while(isalpha((uchar)*ap))ap++;
if(ap == a){
fprint(2,"no name with define\n");
exits("define");
@ -547,7 +547,7 @@ void call(char *a){
char sav;
double SC;
ap = a;
while(isalpha(*ap))ap++;
while(isalpha((uchar)*ap))ap++;
sav = *ap;
*ap = '\0';
for(f=flibr;f<fptr;f++){
@ -559,7 +559,7 @@ void call(char *a){
exits("undefined");
}
*ap = sav;
while (isspace(*ap) || *ap == ',')
while (isspace((uchar)*ap) || *ap == ',')
ap++;
if (*ap != '\0')
SC = atof(ap);

View file

@ -255,7 +255,7 @@ dollar(Exec *e, char *s, int *namelen)
if(e!=nil && '0'<=s[0] && s[0]<='9')
return nonnil(e->match[s[0]-'0']);
for(t=s; isalnum(*t); t++)
for(t=s; isalnum((uchar)*t); t++)
;
n = t-s;
*namelen = n;
@ -377,9 +377,9 @@ assignment(char *p)
char *var, *qval;
int n;
if(!isalpha(p[0]))
if(!isalpha((uchar)p[0]))
return 0;
for(var=p; isalnum(*p); p++)
for(var=p; isalnum((uchar)*p); p++)
;
n = p-var;
while(*p==' ' || *p=='\t')

View file

@ -93,7 +93,7 @@ pagelist(char *list) {
start = 0;
while ((c=*list) != '\0') {
n = 0;
while (isdigit(c)) {
while (isdigit((uchar)c)) {
n = n * 10 + c - '0';
c = *++list;
}

View file

@ -79,7 +79,7 @@ readDESC(void) {
break;
case 2:
if (fontmnt <=0) {
if (!isdigit(*token)) {
if (!isdigit((uchar)*token)) {
error(WARNING, "readdesc: expecting number of fonts in mount table.\n");
return(FALSE);
}
@ -99,7 +99,7 @@ readDESC(void) {
break;
case 4:
/* device resolution in dots per inch */
if (!isdigit(*token)) {
if (!isdigit((uchar)*token)) {
error(WARNING, "readdesc: expecting device resolution.\n");
return(FALSE);
}
@ -116,7 +116,7 @@ readDESC(void) {
break;
case 7:
/* unitwidth is the font size at which the character widths are 1:1 */
if (!isdigit(*token)) {
if (!isdigit((uchar)*token)) {
error(WARNING, "readdesc: expecting unitwidth.\n");
return(FALSE);
}

View file

@ -438,7 +438,7 @@ header(char *s)
char buf[512];
strecpy(buf, buf+sizeof buf, pagename);
for(p=buf; *p; p++)
*p = tolower(*p);
*p = tolower((uchar)*p);
Bprint(&bout, "<title>%s(%s) - %s</title>\n", buf, section, s);
}else
Bprint(&bout, "<title>%s</title>\n", s);

View file

@ -24,7 +24,7 @@ strtoullsuf(char *p, char **pp, int rad, u64int *u)
{
u64int v;
if(!isdigit(*p))
if(!isdigit((uchar)*p))
return -1;
v = strtoull(p, &p, rad);
switch(*p){