summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/strtoq.c
diff options
context:
space:
mode:
authorderaadt <>1996-07-27 10:45:26 +0000
committerderaadt <>1996-07-27 10:45:26 +0000
commitf4c9be3243403d728030bb01603f41e6f5c061bc (patch)
tree65bdb513fc1b9b5db4b407c783d2eaa4911d0c96 /src/lib/libc/stdlib/strtoq.c
parent790e572a83b827ace1ed6ee87a9614e24af34d85 (diff)
downloadopenbsd-f4c9be3243403d728030bb01603f41e6f5c061bc.tar.gz
openbsd-f4c9be3243403d728030bb01603f41e6f5c061bc.tar.bz2
openbsd-f4c9be3243403d728030bb01603f41e6f5c061bc.zip
be very careful in case of signed chars
Diffstat (limited to 'src/lib/libc/stdlib/strtoq.c')
-rw-r--r--src/lib/libc/stdlib/strtoq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/strtoq.c b/src/lib/libc/stdlib/strtoq.c
index 003c020d71..0532f9f228 100644
--- a/src/lib/libc/stdlib/strtoq.c
+++ b/src/lib/libc/stdlib/strtoq.c
@@ -66,7 +66,7 @@ strtoq(nptr, endptr, base)
66 */ 66 */
67 s = nptr; 67 s = nptr;
68 do { 68 do {
69 c = *s++; 69 c = (unsigned char) *s++;
70 } while (isspace(c)); 70 } while (isspace(c));
71 if (c == '-') { 71 if (c == '-') {
72 neg = 1; 72 neg = 1;
@@ -113,7 +113,7 @@ strtoq(nptr, endptr, base)
113 } 113 }
114 cutlim = -cutlim; 114 cutlim = -cutlim;
115 } 115 }
116 for (acc = 0, any = 0;; c = *s++) { 116 for (acc = 0, any = 0;; c = (unsigned char) *s++) {
117 if (isdigit(c)) 117 if (isdigit(c))
118 c -= '0'; 118 c -= '0';
119 else if (isalpha(c)) 119 else if (isalpha(c))