aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdio/scanf.3
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2023-08-28 15:34:17 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2023-08-28 15:34:17 +0000
commit76edfabbecdec686a570b8e009d5ea4112f943e0 (patch)
tree20840f7ebecd6799e7ae010c1dee15ece0fedb57 /lib/libc/stdio/scanf.3
parentb9385720f34b536ef2568a642e8b1fad0450056f (diff)
libc: Document support for binary integers.
Reviewed by: debdrup, emaste Differential Revision: https://reviews.freebsd.org/D41522
Diffstat (limited to 'lib/libc/stdio/scanf.3')
-rw-r--r--lib/libc/stdio/scanf.329
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/libc/stdio/scanf.3 b/lib/libc/stdio/scanf.3
index b1c50e10a795..6cefdb133983 100644
--- a/lib/libc/stdio/scanf.3
+++ b/lib/libc/stdio/scanf.3
@@ -31,7 +31,7 @@
.\"
.\" @(#)scanf.3 8.2 (Berkeley) 12/11/93
.\"
-.Dd April 2, 2022
+.Dd August 21, 2023
.Dt SCANF 3
.Os
.Sh NAME
@@ -141,7 +141,7 @@ The conversion that follows occurs as usual, but no pointer is used;
the result of the conversion is simply discarded.
.It Cm hh
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -150,7 +150,7 @@ and the next pointer is a pointer to a
.Vt int ) .
.It Cm h
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -159,7 +159,7 @@ and the next pointer is a pointer to a
.Vt int ) .
.It Cm l No (ell)
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -185,7 +185,7 @@ and the next pointer is a pointer to an array of
.Vt char ) .
.It Cm ll No (ell ell)
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -201,7 +201,7 @@ and the next pointer is a pointer to
.Vt "long double" .
.It Cm j
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -210,7 +210,7 @@ and the next pointer is a pointer to a
.Vt int ) .
.It Cm t
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -219,7 +219,7 @@ and the next pointer is a pointer to a
.Vt int ) .
.It Cm z
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -229,7 +229,7 @@ and the next pointer is a pointer to a
.It Cm q
(deprecated.)
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -273,6 +273,10 @@ matches a single input
.Ql %
character.
No conversion is done, and assignment does not occur.
+.It Cm b , B
+Matches an optionally signed binary integer;
+the next pointer must be a pointer to
+.Vt "unsigned int" .
.It Cm d
Matches an optionally signed decimal integer;
the next pointer must be a pointer to
@@ -281,7 +285,12 @@ the next pointer must be a pointer to
Matches an optionally signed integer;
the next pointer must be a pointer to
.Vt int .
-The integer is read in base 16 if it begins
+The integer is read
+in base 2 if it begins with
+.Ql 0b
+or
+.Ql 0B ,
+in base 16 if it begins
with
.Ql 0x
or