]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/uselocale.3
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man3 / uselocale.3
CommitLineData
aa14d1cd
MK
1.\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
aa14d1cd 4.\"
4c1c5274 5.TH uselocale 3 (date) "Linux man-pages (unreleased)"
aa14d1cd
MK
6.SH NAME
7uselocale \- set/get the locale for the calling thread
d636e695
AC
8.SH LIBRARY
9Standard C library
8fc3b2cf 10.RI ( libc ", " \-lc )
aa14d1cd
MK
11.SH SYNOPSIS
12.nf
13.B #include <locale.h>
dbfe9c70 14.PP
aa14d1cd
MK
15.BI "locale_t uselocale(locale_t " newloc );
16.fi
68e4db0a 17.PP
d39ad78f 18.RS -4
aa14d1cd
MK
19Feature Test Macro Requirements for glibc (see
20.BR feature_test_macros (7)):
d39ad78f 21.RE
68e4db0a 22.PP
aa14d1cd 23.BR uselocale ():
9d2adbae
MK
24.nf
25 Since glibc 2.10:
5c10d2c5 26 _XOPEN_SOURCE >= 700
9d2adbae
MK
27 Before glibc 2.10:
28 _GNU_SOURCE
29.fi
aa14d1cd
MK
30.SH DESCRIPTION
31The
32.BR uselocale ()
33function sets the current locale for the calling thread,
34and returns the thread's previously current locale.
35After a successful call to
36.BR uselocale (),
37any calls by this thread to functions that depend on the locale
38will operate as though the locale has been set to
39.IR newloc .
847e0d88 40.PP
aa14d1cd
MK
41The
42.I newloc
43argument can have one of the following values:
44.TP
45A handle returned by a call to \fBnewlocale\fP(3) or \fBduplocale\fP(3)
46The calling thread's current locale is set to the specified locale.
47.TP
48The special locale object handle \fBLC_GLOBAL_LOCALE\fP
49The calling thread's current locale is set to the global locale determined by
50.BR setlocale (3).
51.TP
52.I "(locale_t) 0"
53The calling thread's current locale is left unchanged
54(and the current locale is returned as the function result).
55.SH RETURN VALUE
56On success,
57.BR uselocale ()
58returns the locale handle that was set by the previous call to
59.BR uselocale ()
60in this thread, or
d8a86e74 61.B LC_GLOBAL_LOCALE
aa14d1cd
MK
62if there was no such previous call.
63On error, it returns
d8a86e74 64.IR "(locale_t)\ 0" ,
aa14d1cd
MK
65and sets
66.I errno
855d489a 67to indicate the error.
aa14d1cd
MK
68.SH ERRORS
69.TP
70.B EINVAL
71.I newloc
72does not refer to a valid locale object.
73.SH VERSIONS
74The
75.BR uselocale ()
76function first appeared in version 2.3 of the GNU C library.
3113c7f3 77.SH STANDARDS
aa14d1cd
MK
78POSIX.1-2008.
79.SH NOTES
80Unlike
81.BR setlocale (3),
82.BR uselocale ()
83does not allow selective replacement of individual locale categories.
84To employ a locale that differs in only a few categories from the current
85locale, use calls to
86.BR duplocale (3)
87and
88.BR newlocale (3)
89to obtain a locale object equivalent to the current locale and
90modify the desired categories in that object.
a14af333 91.SH EXAMPLES
aa14d1cd
MK
92See
93.BR newlocale (3)
94and
95.BR duplocale (3).
96.SH SEE ALSO
97.BR locale (1),
98.BR duplocale (3),
99.BR freelocale (3),
100.BR newlocale (3),
101.BR setlocale (3),
102.BR locale (5),
103.BR locale (7)