]> git.saurik.com Git - apple/libc.git/blobdiff - stdlib/FreeBSD/strtoimax.c
Libc-763.11.tar.gz
[apple/libc.git] / stdlib / FreeBSD / strtoimax.c
index c57d0448eb5bbd97f39523b97d08d3ffe3314712..09e073f473e6a0a6c333185e78e7af66e5ac9569 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -35,7 +31,7 @@
 static char sccsid[] = "from @(#)strtol.c      8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.9 2003/01/01 18:48:43 schweikh Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 imp Exp $");
 
 #include <ctype.h>
 #include <errno.h>
@@ -75,7 +71,10 @@ strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base)
                        c = *s++;
        }
        if ((base == 0 || base == 16) &&
-           c == '0' && (*s == 'x' || *s == 'X')) {
+           c == '0' && (*s == 'x' || *s == 'X') &&
+           ((s[1] >= '0' && s[1] <= '9') ||
+           (s[1] >= 'A' && s[1] <= 'F') ||
+           (s[1] >= 'a' && s[1] <= 'f'))) {
                c = s[1];
                s += 2;
                base = 16;