summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>1996-07-27 10:45:26 +0000
committerderaadt <>1996-07-27 10:45:26 +0000
commitf4c9be3243403d728030bb01603f41e6f5c061bc (patch)
tree65bdb513fc1b9b5db4b407c783d2eaa4911d0c96
parent790e572a83b827ace1ed6ee87a9614e24af34d85 (diff)
downloadopenbsd-f4c9be3243403d728030bb01603f41e6f5c061bc.tar.gz
openbsd-f4c9be3243403d728030bb01603f41e6f5c061bc.tar.bz2
openbsd-f4c9be3243403d728030bb01603f41e6f5c061bc.zip
be very careful in case of signed chars
-rw-r--r--src/lib/libc/stdlib/strtod.c8
-rw-r--r--src/lib/libc/stdlib/strtol.c6
-rw-r--r--src/lib/libc/stdlib/strtoq.c4
-rw-r--r--src/lib/libc/stdlib/strtoul.c6
-rw-r--r--src/lib/libc/stdlib/strtouq.c4
5 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libc/stdlib/strtod.c b/src/lib/libc/stdlib/strtod.c
index f1c5463933..57db3d42b1 100644
--- a/src/lib/libc/stdlib/strtod.c
+++ b/src/lib/libc/stdlib/strtod.c
@@ -1,5 +1,5 @@
1/* $OpenBSD: strtod.c,v 1.2 1996/03/19 23:15:11 niklas Exp $ */ 1/* $OpenBSD: strtod.c,v 1.3 1996/07/27 10:45:23 deraadt Exp $ */
2/* $NetBSD: strtod.c,v 1.21 1996/02/16 21:19:29 mark Exp $ */ 2/* $NetBSD: strtod.c,v 1.21.4.1 1996/07/20 01:14:54 jtc Exp $ */
3 3
4/**************************************************************** 4/****************************************************************
5 * 5 *
@@ -93,7 +93,7 @@
93 */ 93 */
94 94
95#if defined(LIBC_SCCS) && !defined(lint) 95#if defined(LIBC_SCCS) && !defined(lint)
96static char *rcsid = "$OpenBSD: strtod.c,v 1.2 1996/03/19 23:15:11 niklas Exp $"; 96static char *rcsid = "$OpenBSD: strtod.c,v 1.3 1996/07/27 10:45:23 deraadt Exp $";
97#endif /* LIBC_SCCS and not lint */ 97#endif /* LIBC_SCCS and not lint */
98 98
99#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ 99#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \
@@ -1238,7 +1238,7 @@ strtod
1238 rv = 0.; 1238 rv = 0.;
1239 1239
1240 1240
1241 for(s = s00; isspace(*s); s++) 1241 for(s = s00; isspace((unsigned char) *s); s++)
1242 ; 1242 ;
1243 1243
1244 if (*s == '-') { 1244 if (*s == '-') {
diff --git a/src/lib/libc/stdlib/strtol.c b/src/lib/libc/stdlib/strtol.c
index 021fdc0d2a..6ca9e553b2 100644
--- a/src/lib/libc/stdlib/strtol.c
+++ b/src/lib/libc/stdlib/strtol.c
@@ -33,7 +33,7 @@
33 33
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35/*static char *sccsid = "from: @(#)strtol.c 5.4 (Berkeley) 2/23/91";*/ 35/*static char *sccsid = "from: @(#)strtol.c 5.4 (Berkeley) 2/23/91";*/
36static char *rcsid = "$Id: strtol.c,v 1.2 1995/12/21 14:58:36 deraadt Exp $"; 36static char *rcsid = "$Id: strtol.c,v 1.3 1996/07/27 10:45:24 deraadt Exp $";
37#endif /* LIBC_SCCS and not lint */ 37#endif /* LIBC_SCCS and not lint */
38 38
39#include <ctype.h> 39#include <ctype.h>
@@ -66,7 +66,7 @@ strtol(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;
@@ -112,7 +112,7 @@ strtol(nptr, endptr, base)
112 } 112 }
113 cutlim = -cutlim; 113 cutlim = -cutlim;
114 } 114 }
115 for (acc = 0, any = 0;; c = *s++) { 115 for (acc = 0, any = 0;; c = (unsigned char) *s++) {
116 if (isdigit(c)) 116 if (isdigit(c))
117 c -= '0'; 117 c -= '0';
118 else if (isalpha(c)) 118 else if (isalpha(c))
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))
diff --git a/src/lib/libc/stdlib/strtoul.c b/src/lib/libc/stdlib/strtoul.c
index 1522bec584..9d45c5cb9e 100644
--- a/src/lib/libc/stdlib/strtoul.c
+++ b/src/lib/libc/stdlib/strtoul.c
@@ -33,7 +33,7 @@
33 33
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35/*static char *sccsid = "from: @(#)strtoul.c 5.3 (Berkeley) 2/23/91";*/ 35/*static char *sccsid = "from: @(#)strtoul.c 5.3 (Berkeley) 2/23/91";*/
36static char *rcsid = "$Id: strtoul.c,v 1.2 1995/12/21 14:58:38 deraadt Exp $"; 36static char *rcsid = "$Id: strtoul.c,v 1.3 1996/07/27 10:45:25 deraadt Exp $";
37#endif /* LIBC_SCCS and not lint */ 37#endif /* LIBC_SCCS and not lint */
38 38
39#include <ctype.h> 39#include <ctype.h>
@@ -63,7 +63,7 @@ strtoul(nptr, endptr, base)
63 */ 63 */
64 s = nptr; 64 s = nptr;
65 do { 65 do {
66 c = *s++; 66 c = (unsigned char) *s++;
67 } while (isspace(c)); 67 } while (isspace(c));
68 if (c == '-') { 68 if (c == '-') {
69 neg = 1; 69 neg = 1;
@@ -84,7 +84,7 @@ strtoul(nptr, endptr, base)
84 84
85 cutoff = ULONG_MAX / (unsigned long)base; 85 cutoff = ULONG_MAX / (unsigned long)base;
86 cutlim = ULONG_MAX % (unsigned long)base; 86 cutlim = ULONG_MAX % (unsigned long)base;
87 for (acc = 0, any = 0;; c = *s++) { 87 for (acc = 0, any = 0;; c = (unsigned char) *s++) {
88 if (isdigit(c)) 88 if (isdigit(c))
89 c -= '0'; 89 c -= '0';
90 else if (isalpha(c)) 90 else if (isalpha(c))
diff --git a/src/lib/libc/stdlib/strtouq.c b/src/lib/libc/stdlib/strtouq.c
index 3ab2c232dd..b872cf56f7 100644
--- a/src/lib/libc/stdlib/strtouq.c
+++ b/src/lib/libc/stdlib/strtouq.c
@@ -64,7 +64,7 @@ strtouq(nptr, endptr, base)
64 */ 64 */
65 s = nptr; 65 s = nptr;
66 do { 66 do {
67 c = *s++; 67 c = (unsigned char) *s++;
68 } while (isspace(c)); 68 } while (isspace(c));
69 if (c == '-') { 69 if (c == '-') {
70 neg = 1; 70 neg = 1;
@@ -85,7 +85,7 @@ strtouq(nptr, endptr, base)
85 85
86 cutoff = UQUAD_MAX / (u_quad_t)base; 86 cutoff = UQUAD_MAX / (u_quad_t)base;
87 cutlim = UQUAD_MAX % (u_quad_t)base; 87 cutlim = UQUAD_MAX % (u_quad_t)base;
88 for (acc = 0, any = 0;; c = *s++) { 88 for (acc = 0, any = 0;; c = (unsigned char) *s++) {
89 if (isdigit(c)) 89 if (isdigit(c))
90 c -= '0'; 90 c -= '0';
91 else if (isalpha(c)) 91 else if (isalpha(c))