Module Name: src
Committed By: martin
Date: Tue Jan 3 18:28:06 UTC 2023
Modified Files:
src/lib/libc/locale [netbsd-9]: setlocale.3
Log Message:
Pull up following revision(s) (requested by nia in ticket #1561):
lib/libc/locale/setlocale.3: revision 1.22
lib/libc/locale/setlocale.3: revision 1.23
setlocale.3: minor updates to reflect the current implementation
Reflect a couple of amendments noted by John Marino on tech-userlevel:
https://mail-index.netbsd.org/tech-userlevel/2021/10/19/msg013091.html
setlocale.3: Reflect state of NetBSD locale support in the 21st century
Don't use LC_COLLATE in a real code example, since a real call to set
LC_COLLATE will fail. Mention this.
Inconsistencies noticed by khw on IRC.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.100.1 src/lib/libc/locale/setlocale.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/locale/setlocale.3
diff -u src/lib/libc/locale/setlocale.3:1.21 src/lib/libc/locale/setlocale.3:1.21.100.1
--- src/lib/libc/locale/setlocale.3:1.21 Sat Jan 24 16:58:54 2004
+++ src/lib/libc/locale/setlocale.3 Tue Jan 3 18:28:06 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: setlocale.3,v 1.21 2004/01/24 16:58:54 wiz Exp $
+.\" $NetBSD: setlocale.3,v 1.21.100.1 2023/01/03 18:28:06 martin Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -32,7 +32,7 @@
.\"
.\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93
.\"
-.Dd May 30, 2003
+.Dd December 31, 2022
.Dt SETLOCALE 3
.Os
.Sh NAME
@@ -81,9 +81,6 @@ functions.
This controls recognition of upper and lower case,
alphabetic or non-alphabetic characters,
and so on.
-The real work is done by the
-.Fn setrunelocale
-function.
.It Dv LC_MESSAGES
Set a locale for message catalogs.
This controls the selection of message catalogs by the
@@ -317,6 +314,14 @@ which may be altered by later calls to
.Fn setlocale
or
.Fn localeconv .
+.Pp
+Currently,
+.Fn setlocale
+returns
+.Dv NULL
+and fails to change the locale when
+.Dv LC_COLLATE
+is modified independently of other values.
.Sh EXAMPLES
The following code illustrates how a program can initialize the
international environment for one language, while selectively
@@ -325,7 +330,7 @@ string operations can be applied to text
language:
.Bd -literal
setlocale(LC_ALL, "de");
- setlocale(LC_COLLATE, "fr");
+ setlocale(LC_NUMERIC, "C");
.Ed
.Pp
When a process is started, its current locale is set to the C or POSIX
@@ -336,7 +341,9 @@ following manner before using any of the
.Bd -literal
setlocale(LC_ALL, "");
.Ed
-.\" .Sh FILES XXX
+.Sh FILES
+The use of multibyte locales requires shared libraries located in
+.Pa /usr/lib/i18n .
.\" .Bl -tag -width /usr/share/locale/locale/category -compact XXX
.\" .It Pa $PATH_LOCALE/\fIlocale\fP/\fIcategory\fP XXX
.\" .It Pa /usr/share/locale/\fIlocale\fP/\fIcategory\fP XXX
@@ -380,21 +387,13 @@ and
functions first appeared in
.Bx 4.4 .
.Sh BUGS
-The current implementation supports only the
-.Li "\&""C""
-and
-.Li "\&""POSIX""
-locales for all but the
-.Dv LC_CTYPE
-locale.
-.Pp
In spite of the gnarly currency support in
.Fn localeconv ,
the standards don't include any functions
for generalized currency formatting.
.Pp
.Dv LC_COLLATE
-does not make sense for many languages.
+is unimplemented (but does not make sense for many languages).
Use of
.Dv LC_MONETARY
could lead to misleading results until we have a real time currency