1 .\" Copyright (c) 2011 The FreeBSD Foundation
2 .\" All rights reserved.
4 .\" This documentation was written by David Chisnall under sponsorship from
5 .\" the FreeBSD Foundation.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .Nd Thread-safe extended locale support.
41 The extended locale support includes a set of functions for setting
43 as well convenience functions for performing locale-aware
44 calls with a specified locale.
46 The core of the xlocale API is the
49 This is an opaque type encapsulating a locale.
50 Instances of this can be either set as the locale for a specific thread or
51 passed directly to the
53 suffixed variants of various standard C functions.
57 .Bl -bullet -offset indent
59 NULL refers to the current locale for the thread,
60 or to the global locale if no locale has been set for this thread.
62 LC_GLOBAL_LOCALE refers to the global locale.
65 The global locale is the locale set with the
71 function, and others in the family, refer to the global locale.
72 Other functions that depend on the locale, however,
73 will take the thread-local locale if one has been set.
74 This means that the idiom of setting the locale using
76 calling a locale-dependent function,
77 and then restoring the locale will not
78 have the expected behavior if the current thread has had a locale set using
80 You should avoid this idiom and prefer to use the
82 suffixed versions instead.
90 .Sh CONVENIENCE FUNCTIONS
91 The xlocale API includes a number of
93 suffixed convenience functions.
94 These are variants of standard C functions
95 that have been modified to take an explicit
97 parameter as the final argument or, in the case of variadic functions,
98 as an additional argument directly before the format string.
99 Each of these functions accepts either NULL or LC_GLOBAL_LOCALE.
100 In these functions, NULL refers to the C locale,
101 rather than the thread's current locale.
102 If you wish to use the thread's current locale,
103 then use the unsuffixed version of the function.
105 These functions are exposed by including
108 including the relevant headers for the standard variant.
111 function is exposed by including
119 a complete list of the locale-aware functions that are available in this form,
120 along with the headers that expose them, is provided here:
122 .Bl -tag -width "<monetary.h> "
147 .Xr ishexnumber_l 3 ,
151 .Xr isphonogram_l 3 ,
261 .Xr iswhexnumber_l 3 ,
262 .Xr iswideogram_l 3 ,
264 .Xr iswphonogram_l 3 ,
278 The xlocale APIs first appeared in Darwin 8.0.
279 This implementation was written by David Chisnall,
280 under sponsorship from the FreeBSD Foundation and first appeared in