From 3bd56b04a8bab7208494fd7dc74af5528fc41604 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 9 Sep 2005 23:16:15 +0000 Subject: NetBSD-macppc ctype needs uchars. --- src/cmd/9660/dump.c | 2 +- src/cmd/9660/ichar.c | 3 +-- src/cmd/9660/util.c | 2 +- src/cmd/acid/lex.c | 2 +- src/cmd/acidtypes/stabs.c | 10 +++++----- src/cmd/acidtypes/type.c | 2 +- src/cmd/auth/factotum/httpdigest.c | 2 +- src/cmd/db/format.c | 4 ++-- src/cmd/dict/dict.c | 4 ++-- src/cmd/dict/roget.c | 34 +++++++++++++++++----------------- src/cmd/diff/diffio.c | 6 +++--- src/cmd/draw/gview.c | 2 +- src/cmd/getflags/funcgetflags.c | 2 +- src/cmd/graph/graph.c | 2 +- src/cmd/ndb/ndbmkdb.c | 8 ++++---- src/cmd/netfiles/acme.c | 2 +- src/cmd/plot/plot.c | 6 +++--- src/cmd/plumb/rules.c | 6 +++--- src/cmd/postscript/common/common.c | 2 +- src/cmd/postscript/tr2post/readDESC.c | 6 +++--- src/cmd/troff2html/troff2html.c | 2 +- src/cmd/venti/srv/part.c | 2 +- 22 files changed, 55 insertions(+), 56 deletions(-) diff --git a/src/cmd/9660/dump.c b/src/cmd/9660/dump.c index b77e9eb9..d3504ff9 100644 --- a/src/cmd/9660/dump.c +++ b/src/cmd/9660/dump.c @@ -456,7 +456,7 @@ static int isalldigit(char *s) { while(*s) - if(!isdigit(*s++)) + if(!isdigit((uchar)*s++)) return 0; return 1; } diff --git a/src/cmd/9660/ichar.c b/src/cmd/9660/ichar.c index 35b0c056..3b2b5367 100644 --- a/src/cmd/9660/ichar.c +++ b/src/cmd/9660/ichar.c @@ -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; diff --git a/src/cmd/9660/util.c b/src/cmd/9660/util.c index 16fb21f3..ebf944e2 100644 --- a/src/cmd/9660/util.c +++ b/src/cmd/9660/util.c @@ -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; diff --git a/src/cmd/acid/lex.c b/src/cmd/acid/lex.c index d978407f..e47452a4 100644 --- a/src/cmd/acid/lex.c +++ b/src/cmd/acid/lex.c @@ -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) diff --git a/src/cmd/acidtypes/stabs.c b/src/cmd/acidtypes/stabs.c index 51d71c4a..7cc45c26 100644 --- a/src/cmd/acidtypes/stabs.c +++ b/src/cmd/acidtypes/stabs.c @@ -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) diff --git a/src/cmd/acidtypes/type.c b/src/cmd/acidtypes/type.c index 4afd3e54..5757a327 100644 --- a/src/cmd/acidtypes/type.c +++ b/src/cmd/acidtypes/type.c @@ -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; } diff --git a/src/cmd/auth/factotum/httpdigest.c b/src/cmd/auth/factotum/httpdigest.c index 4f05b6d6..3e299bf5 100644 --- a/src/cmd/auth/factotum/httpdigest.c +++ b/src/cmd/auth/factotum/httpdigest.c @@ -56,7 +56,7 @@ static void strtolower(char *s) { while(*s){ - *s = tolower(*s); + *s = tolower((uchar)*s); s++; } } diff --git a/src/cmd/db/format.c b/src/cmd/db/format.c index ef053646..c2b352bc 100644 --- a/src/cmd/db/format.c +++ b/src/cmd/db/format.c @@ -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'; } diff --git a/src/cmd/dict/dict.c b/src/cmd/dict/dict.c index 6704775a..0a2cf4f3 100644 --- a/src/cmd/dict/dict.c +++ b/src/cmd/dict/dict.c @@ -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) diff --git a/src/cmd/dict/roget.c b/src/cmd/dict/roget.c index 16bfeae5..d9536365 100644 --- a/src/cmd/dict/roget.c +++ b/src/cmd/dict/roget.c @@ -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) diff --git a/src/cmd/diff/diffio.c b/src/cmd/diff/diffio.c index 640f2d2b..f522ec71 100644 --- a/src/cmd/diff/diffio.c +++ b/src/cmd/diff/diffio.c @@ -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; } diff --git a/src/cmd/draw/gview.c b/src/cmd/draw/gview.c index 0909449d..855c7b4e 100644 --- a/src/cmd/draw/gview.c +++ b/src/cmd/draw/gview.c @@ -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++) diff --git a/src/cmd/getflags/funcgetflags.c b/src/cmd/getflags/funcgetflags.c index a88e99f2..d0686679 100644 --- a/src/cmd/getflags/funcgetflags.c +++ b/src/cmd/getflags/funcgetflags.c @@ -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 diff --git a/src/cmd/graph/graph.c b/src/cmd/graph/graph.c index b740a53e..01c8bc66 100644 --- a/src/cmd/graph/graph.c +++ b/src/cmd/graph/graph.c @@ -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; diff --git a/src/cmd/ndb/ndbmkdb.c b/src/cmd/ndb/ndbmkdb.c index e19685a6..7796aace 100644 --- a/src/cmd/ndb/ndbmkdb.c +++ b/src/cmd/ndb/ndbmkdb.c @@ -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; } diff --git a/src/cmd/netfiles/acme.c b/src/cmd/netfiles/acme.c index cff529ee..ddd39284 100644 --- a/src/cmd/netfiles/acme.c +++ b/src/cmd/netfiles/acme.c @@ -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){ diff --git a/src/cmd/plot/plot.c b/src/cmd/plot/plot.c index 1360f686..2fe216af 100644 --- a/src/cmd/plot/plot.c +++ b/src/cmd/plot/plot.c @@ -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;fmatch[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') diff --git a/src/cmd/postscript/common/common.c b/src/cmd/postscript/common/common.c index afcdb766..6ac567ec 100644 --- a/src/cmd/postscript/common/common.c +++ b/src/cmd/postscript/common/common.c @@ -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; } diff --git a/src/cmd/postscript/tr2post/readDESC.c b/src/cmd/postscript/tr2post/readDESC.c index 600fc174..366bae70 100644 --- a/src/cmd/postscript/tr2post/readDESC.c +++ b/src/cmd/postscript/tr2post/readDESC.c @@ -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); } diff --git a/src/cmd/troff2html/troff2html.c b/src/cmd/troff2html/troff2html.c index 9cf0bdac..4a3b6402 100644 --- a/src/cmd/troff2html/troff2html.c +++ b/src/cmd/troff2html/troff2html.c @@ -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, "%s(%s) - %s\n", buf, section, s); }else Bprint(&bout, "%s\n", s); diff --git a/src/cmd/venti/srv/part.c b/src/cmd/venti/srv/part.c index 42c1635f..df79341d 100644 --- a/src/cmd/venti/srv/part.c +++ b/src/cmd/venti/srv/part.c @@ -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){ -- cgit v1.2.3