isdigit (Tom Miller)

This commit is contained in:
rsc 2005-11-01 15:01:00 +00:00
parent 24d5692977
commit 604ad4d8ff
7 changed files with 10 additions and 7 deletions

View file

@ -1,3 +1,4 @@
#include <u.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,3 +1,4 @@
#include <u.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,3 +1,4 @@
#include <u.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -31,7 +31,7 @@ main(int argc, char *argv[])
ARGBEGIN{
case 'l':
s = ARGF();
if(s==nil || (!isdigit(s[0]) && s[0]!='-'))
if(s==nil || (!isdigit((uchar)s[0]) && s[0]!='-'))
usage();
loop = atoi(s);
break;
@ -42,13 +42,13 @@ main(int argc, char *argv[])
break;
case 'd':
s = ARGF();
if(s==nil || !isdigit(s[0]))
if(s==nil || !isdigit((uchar)s[0]))
usage();
dt = atoi(s);
break;
case 't':
s = ARGF();
if(s==nil || !isdigit(s[0]))
if(s==nil || !isdigit((uchar)s[0]))
usage();
trans = atoi(s);
if(trans > 255)
@ -101,7 +101,7 @@ main(int argc, char *argv[])
usage();
}else
s = &argv[j][2];
if(!isdigit(s[0]))
if(!isdigit((uchar)s[0]))
usage();
dt = atoi(s);
if(j == argc-1) /* last argument must be file */

View file

@ -248,7 +248,7 @@ WS [ \t]
pbstr(p->s_val.p);
dprintf("pushing back `%s'\n", p->s_val.p);
}
} else if (islower(yytext[0])) {
} else if (islower((unsigned char)yytext[0])) {
yylval.p = tostring(yytext);
return(VARNAME);
} else {

View file

@ -52,7 +52,7 @@ static char *parse(char *s, int typeit) /* convert \0, etc to nroff driving tabl
if (isdigit((uchar)s[0]) && isdigit((uchar)s[1]) && isdigit((uchar)s[2])) {
*t++ = (s[0]-'0')<<6 | (s[1]-'0')<<3 | s[2]-'0';
s += 2;
} else if (isdigit(s[0])) {
} else if (isdigit((uchar)s[0])) {
*t++ = *s - '0';
} else if (*s == 'b') {
*t++ = '\b';

View file

@ -307,7 +307,7 @@ opendisk(char *disk, int rdonly, int noctl)
/* check for floppy(3) disk */
if(strlen(p) >= 7) {
q = p+strlen(p)-7;
if(q[0] == 'f' && q[1] == 'd' && isdigit(q[2]) && strcmp(q+3, "disk") == 0) {
if(q[0] == 'f' && q[1] == 'd' && isdigit((uchar)q[2]) && strcmp(q+3, "disk") == 0) {
strcpy(q+3, "ctl");
if((d->ctlfd = open(p, ORDWR)) >= 0) {
*q = '\0';