]>
Commit | Line | Data |
---|---|---|
224c7076 A |
1 | .\" Copyright (c) 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Donn Seeley at BSDI. | |
6 | .\" | |
7 | .\" Redistribution and use in source and binary forms, with or without | |
8 | .\" modification, are permitted provided that the following conditions | |
9 | .\" are met: | |
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 | .\" 3. All advertising materials mentioning features or use of this software | |
16 | .\" must display the following acknowledgement: | |
17 | .\" This product includes software developed by the University of | |
18 | .\" California, Berkeley and its contributors. | |
19 | .\" 4. Neither the name of the University nor the names of its contributors | |
20 | .\" may be used to endorse or promote products derived from this software | |
21 | .\" without specific prior written permission. | |
22 | .\" | |
23 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
24 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
25 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
26 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
27 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
28 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
29 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
32 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
33 | .\" SUCH DAMAGE. | |
34 | .\" | |
35 | .\" From @(#)setlocale.3 8.1 (Berkeley) 6/9/93 | |
36 | .\" From FreeBSD: src/lib/libc/locale/setlocale.3,v 1.28 2003/11/15 02:26:04 tjr Exp | |
37 | .\" $FreeBSD: src/lib/libc/locale/localeconv.3,v 1.2 2004/07/05 06:36:36 ru Exp $ | |
38 | .\" | |
39 | .Dd November 21, 2003 | |
40 | .Dt LOCALECONV 3 | |
41 | .Os | |
42 | .Sh NAME | |
43 | .Nm localeconv , | |
44 | .Nm localeconv_l | |
45 | .Nd natural language formatting for C | |
46 | .Sh LIBRARY | |
47 | .Lb libc | |
48 | .Sh SYNOPSIS | |
49 | .In locale.h | |
50 | .Ft struct lconv * | |
51 | .Fo localeconv | |
52 | .Fa "void" | |
53 | .Fc | |
54 | .In xlocale.h | |
55 | .Ft struct lconv * | |
56 | .Fo localeconv_l | |
57 | .Fa "locale_t loc" | |
58 | .Fc | |
59 | .Sh DESCRIPTION | |
60 | The | |
61 | .Fn localeconv | |
62 | function returns a pointer to a structure | |
63 | which provides parameters for formatting numbers, | |
64 | especially currency values: | |
65 | .Bd -literal -offset indent | |
66 | struct lconv { | |
67 | char *decimal_point; | |
68 | char *thousands_sep; | |
69 | char *grouping; | |
70 | char *int_curr_symbol; | |
71 | char *currency_symbol; | |
72 | char *mon_decimal_point; | |
73 | char *mon_thousands_sep; | |
74 | char *mon_grouping; | |
75 | char *positive_sign; | |
76 | char *negative_sign; | |
77 | char int_frac_digits; | |
78 | char frac_digits; | |
79 | char p_cs_precedes; | |
80 | char p_sep_by_space; | |
81 | char n_cs_precedes; | |
82 | char n_sep_by_space; | |
83 | char p_sign_posn; | |
84 | char n_sign_posn; | |
85 | char int_p_cs_precedes; | |
86 | char int_n_cs_precedes; | |
87 | char int_p_sep_by_space; | |
88 | char int_n_sep_by_space; | |
89 | char int_p_sign_posn; | |
90 | char int_n_sign_posn; | |
91 | }; | |
92 | .Ed | |
93 | .Pp | |
94 | The individual fields have the following meanings: | |
95 | .Pp | |
96 | .Bl -tag -width mon_decimal_point | |
97 | .It Va decimal_point | |
98 | The decimal point character, except for currency values, | |
99 | cannot be an empty string. | |
100 | .It Va thousands_sep | |
101 | The separator between groups of digits | |
102 | before the decimal point, except for currency values. | |
103 | .It Va grouping | |
104 | The sizes of the groups of digits, except for currency values. | |
105 | This is a pointer to a vector of integers, each of size | |
106 | .Vt char , | |
107 | representing group size from low order digit groups | |
108 | to high order (right to left). | |
109 | The list may be terminated with 0 or | |
110 | .Dv CHAR_MAX . | |
111 | If the list is terminated with 0, | |
112 | the last group size before the 0 is repeated to account for all the digits. | |
113 | If the list is terminated with | |
114 | .Dv CHAR_MAX , | |
115 | no more grouping is performed. | |
116 | .It Va int_curr_symbol | |
117 | The standardized international currency symbol. | |
118 | .It Va currency_symbol | |
119 | The local currency symbol. | |
120 | .It Va mon_decimal_point | |
121 | The decimal point character for currency values. | |
122 | .It Va mon_thousands_sep | |
123 | The separator for digit groups in currency values. | |
124 | .It Va mon_grouping | |
125 | Like | |
126 | .Va grouping | |
127 | but for currency values. | |
128 | .It Va positive_sign | |
129 | The character used to denote nonnegative currency values, | |
130 | usually the empty string. | |
131 | .It Va negative_sign | |
132 | The character used to denote negative currency values, | |
133 | usually a minus sign. | |
134 | .It Va int_frac_digits | |
135 | The number of digits after the decimal point | |
136 | in an international-style currency value. | |
137 | .It Va frac_digits | |
138 | The number of digits after the decimal point | |
139 | in the local style for currency values. | |
140 | .It Va p_cs_precedes | |
141 | 1 if the currency symbol precedes the currency value | |
142 | for nonnegative values, 0 if it follows. | |
143 | .It Va p_sep_by_space | |
144 | 1 if a space is inserted between the currency symbol | |
145 | and the currency value for nonnegative values, 0 otherwise. | |
146 | .It Va n_cs_precedes | |
147 | Like | |
148 | .Va p_cs_precedes | |
149 | but for negative values. | |
150 | .It Va n_sep_by_space | |
151 | Like | |
152 | .Va p_sep_by_space | |
153 | but for negative values. | |
154 | .It Va p_sign_posn | |
155 | The location of the | |
156 | .Va positive_sign | |
157 | with respect to a nonnegative quantity and the | |
158 | .Va currency_symbol , | |
159 | coded as follows: | |
160 | .Pp | |
161 | .Bl -tag -width 3n -compact | |
162 | .It Li 0 | |
163 | Parentheses around the entire string. | |
164 | .It Li 1 | |
165 | Before the string. | |
166 | .It Li 2 | |
167 | After the string. | |
168 | .It Li 3 | |
169 | Just before | |
170 | .Va currency_symbol . | |
171 | .It Li 4 | |
172 | Just after | |
173 | .Va currency_symbol . | |
174 | .El | |
175 | .It Va n_sign_posn | |
176 | Like | |
177 | .Va p_sign_posn | |
178 | but for negative currency values. | |
179 | .It Va int_p_cs_precedes | |
180 | Same as | |
181 | .Va p_cs_precedes , | |
182 | but for internationally formatted monetary quantities. | |
183 | .It Va int_n_cs_precedes | |
184 | Same as | |
185 | .Va n_cs_precedes , | |
186 | but for internationally formatted monetary quantities. | |
187 | .It Va int_p_sep_by_space | |
188 | Same as | |
189 | .Va p_sep_by_space , | |
190 | but for internationally formatted monetary quantities. | |
191 | .It Va int_n_sep_by_space | |
192 | Same as | |
193 | .Va n_sep_by_space , | |
194 | but for internationally formatted monetary quantities. | |
195 | .It Va int_p_sign_posn | |
196 | Same as | |
197 | .Va p_sign_posn , | |
198 | but for internationally formatted monetary quantities. | |
199 | .It Va int_n_sign_posn | |
200 | Same as | |
201 | .Va n_sign_posn , | |
202 | but for internationally formatted monetary quantities. | |
203 | .El | |
204 | .Pp | |
205 | Unless mentioned above, | |
206 | an empty string as a value for a field | |
207 | indicates a zero length result or | |
208 | a value that is not in the current locale. | |
209 | A | |
210 | .Dv CHAR_MAX | |
211 | result similarly denotes an unavailable value. | |
212 | .Pp | |
213 | While the | |
214 | .Fn localeconv | |
215 | function uses the current locale, the | |
216 | .Fn localeconv_l | |
217 | function may be passed a locale directly. See | |
218 | .Xr xlocale 3 | |
219 | for more information. | |
220 | .Sh RETURN VALUES | |
221 | The | |
222 | .Fn localeconv | |
223 | function returns a pointer to a static object | |
224 | which may be altered by later calls to | |
225 | .Xr setlocale 3 | |
226 | or | |
227 | .Fn localeconv . | |
228 | .Sh ERRORS | |
229 | No errors are defined. | |
230 | .Sh SEE ALSO | |
231 | .Xr setlocale 3 , | |
232 | .Xr strfmon 3 , | |
233 | .Xr xlocale 3 | |
234 | .Sh STANDARDS | |
235 | The | |
236 | .Fn localeconv | |
237 | function conforms to | |
238 | .St -isoC-99 . | |
239 | .Sh HISTORY | |
240 | The | |
241 | .Fn localeconv | |
242 | function first appeared in | |
243 | .Bx 4.4 . |