Module Name: src Committed By: christos Date: Thu Nov 12 17:23:51 UTC 2015
Modified Files: src/common/lib/libc/stdlib: _strtol.h _strtoul.h Log Message: Recognize 0[bB] as binary (base 2) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/stdlib/_strtol.h \ src/common/lib/libc/stdlib/_strtoul.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/stdlib/_strtol.h diff -u src/common/lib/libc/stdlib/_strtol.h:1.7 src/common/lib/libc/stdlib/_strtol.h:1.8 --- src/common/lib/libc/stdlib/_strtol.h:1.7 Fri May 17 08:55:56 2013 +++ src/common/lib/libc/stdlib/_strtol.h Thu Nov 12 12:23:51 2015 @@ -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 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); /* Index: src/common/lib/libc/stdlib/_strtoul.h diff -u src/common/lib/libc/stdlib/_strtoul.h:1.7 src/common/lib/libc/stdlib/_strtoul.h:1.8 --- src/common/lib/libc/stdlib/_strtoul.h:1.7 Fri May 17 08:55:56 2013 +++ src/common/lib/libc/stdlib/_strtoul.h Thu Nov 12 12:23:51 2015 @@ -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 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); /*