Avoid passing negative values to <ctype.h> functions on machines with

signed chars.
This commit is contained in:
Tim J. Robbins 2004-07-16 05:10:46 +00:00
parent f1f7aaab59
commit 911a3ff97b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132240

View File

@ -344,7 +344,7 @@ getprec(char *str)
if (!*p)
return (0);
for (q = ++p; *p; p++)
if (!isdigit(*p))
if (!isdigit((unsigned char)*p))
break;
return (p - q);
}
@ -381,8 +381,8 @@ getformat(void)
*/
p2 = p++;
dot = hash = space = sign = numbers = 0;
while (!isalpha(*p)) {
if (isdigit(*p)) {
while (!isalpha((unsigned char)*p)) {
if (isdigit((unsigned char)*p)) {
numbers++;
p++;
} else if ((*p == '#' && !(numbers|dot|sign|space|