diff options
author | tjr <tjr@FreeBSD.org> | 2004-07-15 10:26:38 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2004-07-15 10:26:38 +0000 |
commit | 62ca3fc301b91026b9b5724202fed685b1f4b3a6 (patch) | |
tree | 8079609b283e75ecf52fc51b5ee58125ec20df64 | |
parent | 47bda6be1fa17935cd9a1ecc772291cf81dfc325 (diff) | |
download | FreeBSD-src-62ca3fc301b91026b9b5724202fed685b1f4b3a6.zip FreeBSD-src-62ca3fc301b91026b9b5724202fed685b1f4b3a6.tar.gz |
Avoid passing negative values to isdigit() on machines with signed chars.
-rw-r--r-- | usr.bin/rs/rs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/rs/rs.c b/usr.bin/rs/rs.c index 36d7c31..98cc3d4 100644 --- a/usr.bin/rs/rs.c +++ b/usr.bin/rs/rs.c @@ -499,11 +499,11 @@ getlist(short **list, char *p) char *t; for (t = p + 1; *t; t++) { - if (!isdigit(*t)) + if (!isdigit((unsigned char)*t)) errx(1, "option %.1s requires a list of unsigned numbers separated by commas", t); count++; - while (*t && isdigit(*t)) + while (*t && isdigit((unsigned char)*t)) t++; if (*t != ',') break; @@ -515,7 +515,7 @@ getlist(short **list, char *p) (*list)[count++] = atoi(t); printf("++ %d ", (*list)[count-1]); fflush(stdout); - while (*t && isdigit(*t)) + while (*t && isdigit((unsigned char)*t)) t++; if (*t != ',') break; @@ -533,7 +533,7 @@ getnum(int *num, char *p, int strict) { char *t = p; - if (!isdigit(*++t)) { + if (!isdigit((unsigned char)*++t)) { if (strict || *t == '-' || *t == '+') errx(1, "option %.1s requires an unsigned integer", p); *num = 0; @@ -541,7 +541,7 @@ getnum(int *num, char *p, int strict) } *num = atoi(t); while (*++t) - if (!isdigit(*t)) + if (!isdigit((unsigned char)*t)) break; return(--t); } |