2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Donn Seeley at BSDI.
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.
15 .\" 4. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" From @(#)setlocale.3 8.1 (Berkeley) 6/9/93
32 .\" From FreeBSD: src/lib/libc/locale/setlocale.3,v 1.28 2003/11/15 02:26:04 tjr Exp
40 .Nd natural language formatting for C
49 .Fn localeconv_l "locale_t locale"
53 function returns a pointer to a structure
54 which provides parameters for formatting numbers,
55 especially currency values:
56 .Bd -literal -offset indent
61 char *int_curr_symbol;
62 char *currency_symbol;
63 char *mon_decimal_point;
64 char *mon_thousands_sep;
76 char int_p_cs_precedes;
77 char int_n_cs_precedes;
78 char int_p_sep_by_space;
79 char int_n_sep_by_space;
85 The individual fields have the following meanings:
86 .Bl -tag -width mon_decimal_point
88 The decimal point character, except for currency values,
89 cannot be an empty string.
91 The separator between groups of digits
92 before the decimal point, except for currency values.
94 The sizes of the groups of digits, except for currency values.
95 This is a pointer to a vector of integers, each of size
97 representing group size from low order digit groups
98 to high order (right to left).
99 The list may be terminated with 0 or
101 If the list is terminated with 0,
102 the last group size before the 0 is repeated to account for all the digits.
103 If the list is terminated with
105 no more grouping is performed.
106 .It Va int_curr_symbol
107 The standardized international currency symbol.
108 .It Va currency_symbol
109 The local currency symbol.
110 .It Va mon_decimal_point
111 The decimal point character for currency values.
112 .It Va mon_thousands_sep
113 The separator for digit groups in currency values.
117 but for currency values.
119 The character used to denote nonnegative currency values,
120 usually the empty string.
122 The character used to denote negative currency values,
123 usually a minus sign.
124 .It Va int_frac_digits
125 The number of digits after the decimal point
126 in an international-style currency value.
128 The number of digits after the decimal point
129 in the local style for currency values.
131 1 if the currency symbol precedes the currency value
132 for nonnegative values, 0 if it follows.
133 .It Va p_sep_by_space
134 1 if a space is inserted between the currency symbol
135 and the currency value for nonnegative values, 0 otherwise.
139 but for negative values.
140 .It Va n_sep_by_space
143 but for negative values.
147 with respect to a nonnegative quantity and the
148 .Va currency_symbol ,
151 .Bl -tag -width 3n -compact
153 Parentheses around the entire string.
160 .Va currency_symbol .
163 .Va currency_symbol .
168 but for negative currency values.
169 .It Va int_p_cs_precedes
172 but for internationally formatted monetary quantities.
173 .It Va int_n_cs_precedes
176 but for internationally formatted monetary quantities.
177 .It Va int_p_sep_by_space
180 but for internationally formatted monetary quantities.
181 .It Va int_n_sep_by_space
184 but for internationally formatted monetary quantities.
185 .It Va int_p_sign_posn
188 but for internationally formatted monetary quantities.
189 .It Va int_n_sign_posn
192 but for internationally formatted monetary quantities.
195 Unless mentioned above,
196 an empty string as a value for a field
197 indicates a zero length result or
198 a value that is not in the current locale.
201 result similarly denotes an unavailable value.
205 function takes an explicit locale parameter. For more information, see
210 function returns a pointer to a static object
211 which may be altered by later calls to
217 is stored with the locale.
218 It will remain valid until a subsequent call to
220 If a thread-local locale is in effect then the return value from
222 will remain valid until the locale is destroyed.
224 No errors are defined.
236 function first appeared in