aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/setlocale.3
diff options
context:
space:
mode:
authorGordon Bergling <gbe@FreeBSD.org>2020-08-07 17:25:56 +0000
committerGordon Bergling <gbe@FreeBSD.org>2020-08-07 17:25:56 +0000
commiteef7327a689b9c748707e59dab3dc0c454b0f29e (patch)
treeafc01f932150f792f25a07b4be1f772f6fa49ce1 /lib/libc/locale/setlocale.3
parent90fb6afc5534df63f5c211d71e44263de646bce2 (diff)
downloadsrc-eef7327a689b9c748707e59dab3dc0c454b0f29e.tar.gz
src-eef7327a689b9c748707e59dab3dc0c454b0f29e.zip
setlocale(3): Add an EXAMPLES section and add LANG category
PR: 41824 Submitted by: Slaven Rezic <eserte atvran dot herceg dot de> Obtained from: NetBSD MFC after: 1 week
Notes
Notes: svn path=/head/; revision=364032
Diffstat (limited to 'lib/libc/locale/setlocale.3')
-rw-r--r--lib/libc/locale/setlocale.325
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/libc/locale/setlocale.3 b/lib/libc/locale/setlocale.3
index 586d82dd3dc2..bef7b0bdd17c 100644
--- a/lib/libc/locale/setlocale.3
+++ b/lib/libc/locale/setlocale.3
@@ -31,7 +31,7 @@
.\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
-.Dd September 9, 2019
+.Dd August 7, 2020
.Dt SETLOCALE 3
.Os
.Sh NAME
@@ -98,6 +98,10 @@ as well as values returned by
Set a locale for formatting dates and times using the
.Fn strftime
function.
+.It Dv LANG
+Sets the generic locale category for native language, local customs
+and coded character set in the absence of more specific locale
+variables.
.El
.Pp
Only three locales are defined by default,
@@ -153,6 +157,25 @@ if the given combination of
and
.Fa locale
makes no sense.
+.Sh EXAMPLES
+The following code illustrates how a program can initialize the
+international environment for one language, while selectively
+modifying the program's locale such that regular expressions and
+string operations can be applied to text recorded in a different
+language:
+.Bd -literal
+ setlocale(LC_ALL, "de");
+ setlocale(LC_COLLATE, "fr");
+.Ed
+.Pp
+When a process is started, its current locale is set to the C or POSIX
+locale.
+An internationalized program that depends on locale data not defined in
+the C or POSIX locale must invoke the setlocale subroutine in the
+following manner before using any of the locale-specific information:
+.Bd -literal
+ setlocale(LC_ALL, "");
+.Ed
.Sh FILES
.Bl -tag -width /usr/share/locale/locale/category -compact
.It Pa $PATH_LOCALE/ Ns Em locale/category