summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2019-01-16 12:55:50 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2019-01-16 12:55:50 +0000
commit82da4aee4bcc3a63ac48b767b77dc5acc2634d88 (patch)
tree13ee980b960ad1355c481c4ab5892e74c8c02891 /lib/libc/stdio
parent9889c6c46dee44e52ee5a2dc0ae2bb99284f54c2 (diff)
For all functions known to be infected by LC_NUMERIC, add short
CAVEATS pointing to the new CAVEATS section in setlocale(3). Make those in wprintf(3) and wscanf(3) more concise since duplicate information is a bad idea. Incompleteness of information originally pointed out by millert@. OK millert@
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r--lib/libc/stdio/printf.313
-rw-r--r--lib/libc/stdio/scanf.313
-rw-r--r--lib/libc/stdio/wprintf.317
-rw-r--r--lib/libc/stdio/wscanf.316
4 files changed, 30 insertions, 29 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index 1fc1618b29f..236c7dbc6fd 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: printf.3,v 1.78 2018/01/02 08:05:03 jmc Exp $
+.\" $OpenBSD: printf.3,v 1.79 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: January 2 2018 $
+.Dd $Mdocdate: January 16 2019 $
.Dt PRINTF 3
.Os
.Sh NAME
@@ -888,3 +888,12 @@ parameters, up to the
last positionally specified parameter, are used in the format string.
This allows for the format string to be parsed for this information.
Failure to do this will mean the code is non-portable and liable to fail.
+.Pp
+On systems other than
+.Ox ,
+the
+.Dv LC_NUMERIC
+.Xr locale 1
+category can cause erratic output; see CAVEATS in
+.Xr setlocale 3
+for details.
diff --git a/lib/libc/stdio/scanf.3 b/lib/libc/stdio/scanf.3
index bcd156c5441..de75b931ce3 100644
--- a/lib/libc/stdio/scanf.3
+++ b/lib/libc/stdio/scanf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: scanf.3,v 1.23 2017/12/01 11:18:40 schwarze Exp $
+.\" $OpenBSD: scanf.3,v 1.24 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: December 1 2017 $
+.Dd $Mdocdate: January 16 2019 $
.Dt SCANF 3
.Os
.Sh NAME
@@ -459,6 +459,15 @@ and
.Fn vfscanf
in
.Bx 4.3 Reno .
+.Sh CAVEATS
+On systems other than
+.Ox ,
+the
+.Dv LC_NUMERIC
+.Xr locale 1
+category can cause parsing failures; see CAVEATS in
+.Xr setlocale 3
+for details.
.Sh BUGS
Numerical strings are truncated to 512 characters; for example,
.Cm %f
diff --git a/lib/libc/stdio/wprintf.3 b/lib/libc/stdio/wprintf.3
index 2914716e692..bc8dcc34407 100644
--- a/lib/libc/stdio/wprintf.3
+++ b/lib/libc/stdio/wprintf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: wprintf.3,v 1.6 2019/01/11 09:53:26 schwarze Exp $
+.\" $OpenBSD: wprintf.3,v 1.7 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: January 11 2019 $
+.Dd $Mdocdate: January 16 2019 $
.Dt WPRINTF 3
.Os
.Sh NAME
@@ -607,15 +607,6 @@ On systems other than
the
.Dv LC_NUMERIC
.Xr locale 1
-category can cause erratic output, for example different characters
-substituted for the decimal point or thousands separator characters
-inserted into numbers.
-For security reasons, make sure that portable programs calling these
-functions never call
+category can cause erratic output; see CAVEATS in
.Xr setlocale 3
-with the
-.Dv LC_ALL
-or
-.Dv LC_NUMERIC
-categories but only use
-.Dv LC_CTYPE .
+for details.
diff --git a/lib/libc/stdio/wscanf.3 b/lib/libc/stdio/wscanf.3
index c423b3bf4fb..f6583718d14 100644
--- a/lib/libc/stdio/wscanf.3
+++ b/lib/libc/stdio/wscanf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: wscanf.3,v 1.3 2019/01/11 10:20:38 schwarze Exp $
+.\" $OpenBSD: wscanf.3,v 1.4 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -34,7 +34,7 @@
.\" @(#)scanf.3 8.2 (Berkeley) 12/11/93
.\" FreeBSD: src/lib/libc/stdio/scanf.3,v 1.24 2003/06/28 09:03:25 das Exp
.\"
-.Dd $Mdocdate: January 11 2019 $
+.Dd $Mdocdate: January 16 2019 $
.Dt WSCANF 3
.Os
.Sh NAME
@@ -434,17 +434,9 @@ On systems other than
the
.Dv LC_NUMERIC
.Xr locale 1
-category can cause parsing failures, for example because it may cause
-a different character to be expected instead of the decimal point.
-For security reasons, make sure that portable programs calling
-these functions never call
+category can cause parsing failures; see CAVEATS in
.Xr setlocale 3
-with the
-.Dv LC_ALL
-or
-.Dv LC_NUMERIC
-categories but only use
-.Dv LC_CTYPE .
+for details.
.Sh BUGS
In addition to the bugs documented in
.Xr scanf 3 ,