From: Alejandro Colomar Date: Sun, 23 Mar 2025 18:47:33 +0000 (+0100) Subject: man/man3/strto[u]l.3: C23 added "0b" and "0B" X-Git-Tag: man-pages-6.14~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b2519c7722166dbe4313da6ec048d137ea42ba7;p=thirdparty%2Fman-pages.git man/man3/strto[u]l.3: C23 added "0b" and "0B" Link: Reported-by: Bruno Haible Signed-off-by: Alejandro Colomar --- diff --git a/man/man3/strtol.3 b/man/man3/strtol.3 index 2ae48119b..7744628cb 100644 --- a/man/man3/strtol.3 +++ b/man/man3/strtol.3 @@ -53,8 +53,13 @@ followed by a single optional \[aq]+\[aq] or \[aq]\-\[aq] sign. If .I base is zero or 16, the string may then include a -"0x" or "0X" prefix, and the number will be read in base 16; otherwise, a -zero +"0x" or "0X" prefix, and the number will be read in base 16; +if +.I base +is zero or 2, the string may then include a +"0b" or "0B" prefix, and the number will be read in base 2; +otherwise, +a zero .I base is taken as 10 (decimal) unless the next character is \[aq]0\[aq], in which case it is taken as 8 (octal). @@ -183,7 +188,7 @@ may be equivalent to or to .BR strtol (). .SH STANDARDS -C11, POSIX.1-2008. +C23, POSIX.1-2024. .SH HISTORY .TP .BR strtol () @@ -191,6 +196,11 @@ POSIX.1-2001, C89, SVr4, 4.3BSD. .TP .BR strtoll () POSIX.1-2001, C99. +.TP +"0b", "0B" +C23. +glibc 2.38. +(Not in POSIX.) .SH CAVEATS .SS Range checks Since diff --git a/man/man3/strtoul.3 b/man/man3/strtoul.3 index c6a2bb9be..7e13dce8c 100644 --- a/man/man3/strtoul.3 +++ b/man/man3/strtoul.3 @@ -59,8 +59,13 @@ sign. If .I base is zero or 16, the string may then include a -"0x" or "0X" prefix, and the number will be read in base 16; otherwise, a -zero +"0x" or "0X" prefix, and the number will be read in base 16; +if +.I base +is zero or 2, the string may then include a +"0b" or "0B" prefix, and the number will be read in base 2; +otherwise, +a zero .I base is taken as 10 (decimal) unless the next character is \[aq]0\[aq], in which case it is taken as 8 (octal). @@ -182,7 +187,7 @@ may be equivalent to or to .BR strtoul (). .SH STANDARDS -C11, POSIX.1-2008. +C23, POSIX.1-2024. .SH HISTORY .TP .BR strtoul () @@ -190,6 +195,11 @@ POSIX.1-2001, C89, SVr4. .TP .BR strtoull () POSIX.1-2001, C99. +.TP +"0b", "0B" +C23. +glibc 2.38. +(Not in POSIX.) .SH CAVEATS Since .BR strtoul ()