ctype sign fixes (Tom Miller)

This commit is contained in:
rsc 2005-10-31 16:42:32 +00:00
parent b330c942b4
commit 74374cc8a4
10 changed files with 22 additions and 17 deletions

View file

@ -189,9 +189,9 @@ input(void)
ERROR "argfp underflow" FATAL;
popsrc();
goto loop;
} else if (c == '$' && isdigit(*srcp->sp)) {
} else if (c == '$' && isdigit((uchar)*srcp->sp)) {
int n = 0;
while (isdigit(*srcp->sp))
while (isdigit((uchar)*srcp->sp))
n = 10 * n + *srcp->sp++ - '0';
if (n > 0 && n <= MAXARGS)
pushsrc(String, argfp->argstk[n-1]);

View file

@ -13,7 +13,7 @@ void setsize(char *p) /* set size as found in p */
ps -= atoi(p+1);
if (szstack[nszstack-1] != 0)
szstack[nszstack] = ps;
} else if (isdigit(*p)) {
} else if (isdigit((uchar)*p)) {
if (szstack[nszstack-1] == 0)
printf(".nr %d \\n(.s\n", 99-nszstack);
else
@ -52,7 +52,7 @@ void globsize(void)
gsize -= atoi(temp+1);
if (szstack[0] != 0)
szstack[0] = gsize;
} else if (isdigit(temp[0])) {
} else if (isdigit((uchar)temp[0])) {
gsize = atoi(temp);
szstack[0] = gsize;
printf(".nr 99 \\n(.s\n");

View file

@ -277,9 +277,9 @@ nextchar(void)
ERROR "argfp underflow" FATAL;
popsrc();
goto loop;
} else if (c == '$' && isdigit(*srcp->sp)) { /* $3 */
} else if (c == '$' && isdigit((uchar)*srcp->sp)) { /* $3 */
int n = 0;
while (isdigit(*srcp->sp))
while (isdigit((uchar)*srcp->sp))
n = 10 * n + *srcp->sp++ - '0';
if (n > 0 && n <= MAXARGS)
pushsrc(String, argfp->argstk[n-1]);
@ -456,11 +456,11 @@ void eprint(void) /* try to print context around error */
for (q=ep-1; q>=p && *q!=' ' && *q!='\t' && *q!='\n'; q--)
;
for (; p < q; p++)
if (isprint(*p))
if (isprint((uchar)*p))
putc(*p, stderr);
fprintf(stderr, " >>> ");
for (; p < q; p++)
if (isprint(*p))
if (isprint((uchar)*p))
putc(*p, stderr);
fprintf(stderr, " <<< ");
while (pb >= pbuf)

View file

@ -147,7 +147,7 @@ void graph(char *s) /* graph statement */
s++;
if (c == '\0')
ERROR "no name on graph statement" WARNING;
if (!isupper(s[0]))
if (!isupper((uchar)s[0]))
ERROR "graph name %s must be capitalized", s WARNING;
for (p=graphname; (c = *s) != ' ' && c != '\t' && c != '\0'; )
*p++ = *s++;

View file

@ -171,7 +171,7 @@ atimes(char *ar)
continue;
}
goto skip;
}else if(strings && h.name[0]=='/' && isdigit(h.name[1])){
}else if(strings && h.name[0]=='/' && isdigit((uchar)h.name[1])){
i = strtol(h.name+1, &p, 10);
if(*p != ' ' || i >= strlen(strings))
goto skip;

View file

@ -83,6 +83,7 @@ dumpr(char *s, Rule *r)
Bprint(&bout, " prog='%s'", r->prog);
Bprint(&bout, "\n\ttarget=%s: %s\n", r->target, wtos(r->tail, ' '));
Bprint(&bout, "\trecipe@%ld='%s'\n", r->recipe, r->recipe);
break;
}
}

View file

@ -4,6 +4,7 @@
*
*/
#include <u.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@ -170,10 +171,10 @@ str_convert(str, err)
*
*/
if ( ! isdigit(**str) )
if ( ! isdigit((uchar)**str) )
return(err);
for ( i = 0; isdigit(**str); *str += 1 )
for ( i = 0; isdigit((uchar)**str); *str += 1 )
i = 10 * i + **str - '0';
return(i);

View file

@ -73,6 +73,7 @@
*
*/
#include <u.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
@ -169,10 +170,10 @@ char *DWBhome(void)
if ( (fp = fopen(DWBCONFIG, "r")) != NULL ) {
len = strlen(DWBENV);
while ( fgets(buf, sizeof(buf), fp) != NULL ) {
for ( ptr = buf; isspace(*ptr); ptr++ ) ;
for ( ptr = buf; isspace((uchar)*ptr); ptr++ ) ;
if ( strncmp(ptr, DWBENV, len) == 0 && *(ptr+len) == '=' ) {
path = ptr + len + 1;
for ( ptr = path; !isspace(*ptr) && *ptr != ';'; ptr++ ) ;
for ( ptr = path; !isspace((uchar)*ptr) && *ptr != ';'; ptr++ ) ;
*ptr = '\0';
if ( home != NULL )
free(home);

View file

@ -5,6 +5,7 @@
* input routines, escape function calling
*/
#include <u.h>
#include "tdef.h"
#include "fns.h"
#include "ext.h"
@ -1091,10 +1092,10 @@ void getpn(char *a)
continue;
default:
n = 0;
if (isdigit(*a)) {
if (isdigit((uchar)*a)) {
do
n = 10 * n + *a++ - '0';
while (isdigit(*a));
while (isdigit((uchar)*a));
a--;
} else
n = 9999;

View file

@ -1,3 +1,4 @@
#include <u.h>
#include "tdef.h"
#include "fns.h"
#include "ext.h"
@ -495,7 +496,7 @@ static void install(char *s) /* map ab4c5de to: 12 abcde \0 00405 \0 */
num[0] = '0';
*nextpat++ = ' '; /* fill in with count later */
for (npat = lastpat = 0; *s != '\n' && *s != '\0'; s++) {
if (isdigit(*s)) {
if (isdigit((uchar)*s)) {
num[npat] = *s;
lastpat = npat;
} else {