Recognize 0[bB] as binary (base 2)
This commit is contained in:
parent
6c340bb484
commit
557b696a7a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _strtol.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */
|
||||
/* $NetBSD: _strtol.h,v 1.8 2015/11/12 17:23:51 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -105,8 +105,12 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char *nptr, char **endptr,
|
||||
c = s[1];
|
||||
s += 2;
|
||||
base = 16;
|
||||
}
|
||||
if (base == 0)
|
||||
} else if ((base == 0 || base == 2) &&
|
||||
c == '0' && (*s == 'b' || *s == 'b')) {
|
||||
c = s[1];
|
||||
s += 2;
|
||||
base = 2;
|
||||
} else if (base == 0)
|
||||
base = (c == '0' ? 8 : 10);
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */
|
||||
/* $NetBSD: _strtoul.h,v 1.8 2015/11/12 17:23:51 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -102,8 +102,12 @@ INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char *nptr, char **endptr,
|
||||
c = s[1];
|
||||
s += 2;
|
||||
base = 16;
|
||||
}
|
||||
if (base == 0)
|
||||
} else if ((base == 0 || base == 2) &&
|
||||
c == '0' && (*s == 'b' || *s == 'B')) {
|
||||
c = s[1];
|
||||
s += 2;
|
||||
base = 2;
|
||||
} else if (base == 0)
|
||||
base = (c == '0' ? 8 : 10);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user