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) isalldigit(char *s)
{ {
while(*s) while(*s)
if(!isdigit(*s++)) if(!isdigit((uchar)*s++))
return 0; return 0;
return 1; return 1;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -494,7 +494,7 @@ void define(char *a){
short i, j; short i, j;
int curly = 0; int curly = 0;
ap = a; ap = a;
while(isalpha(*ap))ap++; while(isalpha((uchar)*ap))ap++;
if(ap == a){ if(ap == a){
fprint(2,"no name with define\n"); fprint(2,"no name with define\n");
exits("define"); exits("define");
@ -547,7 +547,7 @@ void call(char *a){
char sav; char sav;
double SC; double SC;
ap = a; ap = a;
while(isalpha(*ap))ap++; while(isalpha((uchar)*ap))ap++;
sav = *ap; sav = *ap;
*ap = '\0'; *ap = '\0';
for(f=flibr;f<fptr;f++){ for(f=flibr;f<fptr;f++){
@ -559,7 +559,7 @@ void call(char *a){
exits("undefined"); exits("undefined");
} }
*ap = sav; *ap = sav;
while (isspace(*ap) || *ap == ',') while (isspace((uchar)*ap) || *ap == ',')
ap++; ap++;
if (*ap != '\0') if (*ap != '\0')
SC = atof(ap); 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') if(e!=nil && '0'<=s[0] && s[0]<='9')
return nonnil(e->match[s[0]-'0']); return nonnil(e->match[s[0]-'0']);
for(t=s; isalnum(*t); t++) for(t=s; isalnum((uchar)*t); t++)
; ;
n = t-s; n = t-s;
*namelen = n; *namelen = n;
@ -377,9 +377,9 @@ assignment(char *p)
char *var, *qval; char *var, *qval;
int n; int n;
if(!isalpha(p[0])) if(!isalpha((uchar)p[0]))
return 0; return 0;
for(var=p; isalnum(*p); p++) for(var=p; isalnum((uchar)*p); p++)
; ;
n = p-var; n = p-var;
while(*p==' ' || *p=='\t') while(*p==' ' || *p=='\t')

View file

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

View file

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

View file

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

View file

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