mirror of https://github.com/mkerrisk/man-pages
125 lines
3.4 KiB
Groff
125 lines
3.4 KiB
Groff
.\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
|
|
.\"
|
|
.\" %%%LICENSE_START(VERBATIM)
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
.\" preserved on all copies.
|
|
.\"
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
.\" permission notice identical to this one.
|
|
.\"
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
.\" have taken the same level of care in the production of this manual,
|
|
.\" which is licensed free of charge, as they might when working
|
|
.\" professionally.
|
|
.\"
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
.\" %%%LICENSE_END
|
|
.\"
|
|
.TH USELOCALE 3 2020-06-09 "Linux" "Linux Programmer's Manual"
|
|
.SH NAME
|
|
uselocale \- set/get the locale for the calling thread
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.B #include <locale.h>
|
|
.PP
|
|
.BI "locale_t uselocale(locale_t " newloc );
|
|
.fi
|
|
.PP
|
|
.in -4n
|
|
Feature Test Macro Requirements for glibc (see
|
|
.BR feature_test_macros (7)):
|
|
.in
|
|
.PP
|
|
.BR uselocale ():
|
|
.PD 0
|
|
.RS 4
|
|
.TP
|
|
Since glibc 2.10:
|
|
_XOPEN_SOURCE\ >=\ 700
|
|
.TP
|
|
Before glibc 2.10:
|
|
_GNU_SOURCE
|
|
.RE
|
|
.PD
|
|
.SH DESCRIPTION
|
|
The
|
|
.BR uselocale ()
|
|
function sets the current locale for the calling thread,
|
|
and returns the thread's previously current locale.
|
|
After a successful call to
|
|
.BR uselocale (),
|
|
any calls by this thread to functions that depend on the locale
|
|
will operate as though the locale has been set to
|
|
.IR newloc .
|
|
.PP
|
|
The
|
|
.I newloc
|
|
argument can have one of the following values:
|
|
.TP
|
|
A handle returned by a call to \fBnewlocale\fP(3) or \fBduplocale\fP(3)
|
|
The calling thread's current locale is set to the specified locale.
|
|
.TP
|
|
The special locale object handle \fBLC_GLOBAL_LOCALE\fP
|
|
The calling thread's current locale is set to the global locale determined by
|
|
.BR setlocale (3).
|
|
.TP
|
|
.I "(locale_t) 0"
|
|
The calling thread's current locale is left unchanged
|
|
(and the current locale is returned as the function result).
|
|
.SH RETURN VALUE
|
|
On success,
|
|
.BR uselocale ()
|
|
returns the locale handle that was set by the previous call to
|
|
.BR uselocale ()
|
|
in this thread, or
|
|
.B LC_GLOBAL_LOCALE
|
|
if there was no such previous call.
|
|
On error, it returns
|
|
.IR "(locale_t)\ 0" ,
|
|
and sets
|
|
.I errno
|
|
to indicate the cause of the error.
|
|
.SH ERRORS
|
|
.TP
|
|
.B EINVAL
|
|
.I newloc
|
|
does not refer to a valid locale object.
|
|
.SH VERSIONS
|
|
The
|
|
.BR uselocale ()
|
|
function first appeared in version 2.3 of the GNU C library.
|
|
.SH CONFORMING TO
|
|
POSIX.1-2008.
|
|
.SH NOTES
|
|
Unlike
|
|
.BR setlocale (3),
|
|
.BR uselocale ()
|
|
does not allow selective replacement of individual locale categories.
|
|
To employ a locale that differs in only a few categories from the current
|
|
locale, use calls to
|
|
.BR duplocale (3)
|
|
and
|
|
.BR newlocale (3)
|
|
to obtain a locale object equivalent to the current locale and
|
|
modify the desired categories in that object.
|
|
.SH EXAMPLES
|
|
See
|
|
.BR newlocale (3)
|
|
and
|
|
.BR duplocale (3).
|
|
.SH SEE ALSO
|
|
.BR locale (1),
|
|
.BR duplocale (3),
|
|
.BR freelocale (3),
|
|
.BR newlocale (3),
|
|
.BR setlocale (3),
|
|
.BR locale (5),
|
|
.BR locale (7)
|