diff options
Diffstat (limited to 'lib/libc/locale/wcstoimax.c')
| -rw-r--r-- | lib/libc/locale/wcstoimax.c | 21 | 
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/libc/locale/wcstoimax.c b/lib/libc/locale/wcstoimax.c index 5fa406784f15..29e12f809812 100644 --- a/lib/libc/locale/wcstoimax.c +++ b/lib/libc/locale/wcstoimax.c @@ -34,15 +34,6 @@   * SUCH DAMAGE.   */ -#include <sys/cdefs.h> -#if 0 -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "from @(#)strtol.c	8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ -__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.8 2002/09/06 11:23:59 tjr Exp "); -#endif -__FBSDID("$FreeBSD$"); -  #include <errno.h>  #include <inttypes.h>  #include <stdlib.h> @@ -80,11 +71,21 @@ wcstoimax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,  			c = *s++;  	}  	if ((base == 0 || base == 16) && -	    c == L'0' && (*s == L'x' || *s == L'X')) { +	    c == L'0' && (*s == L'x' || *s == L'X') && +	    ((s[1] >= L'0' && s[1] <= L'9') || +	    (s[1] >= L'A' && s[1] <= L'F') || +	    (s[1] >= L'a' && s[1] <= L'f'))) {  		c = s[1];  		s += 2;  		base = 16;  	} +	if ((base == 0 || base == 2) && +	    c == L'0' && (*s == L'b' || *s == L'B') && +	    (s[1] >= L'0' && s[1] <= L'1')) { +		c = s[1]; +		s += 2; +		base = 2; +	}  	if (base == 0)  		base = c == L'0' ? 8 : 10;  	acc = any = 0;  | 
