]>
Commit | Line | Data |
---|---|---|
3d9156a7 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 | .Nd natural language formatting for C | |
45 | .Sh LIBRARY | |
46 | .Lb libc | |
47 | .Sh SYNOPSIS | |
48 | .In locale.h | |
49 | .Ft struct lconv * | |
50 | .Fn localeconv "void" | |
51 | .Sh DESCRIPTION | |
52 | The | |
53 | .Fn localeconv | |
54 | function returns a pointer to a structure | |
55 | which provides parameters for formatting numbers, | |
56 | especially currency values: | |
57 | .Bd -literal -offset indent | |
58 | struct lconv { | |
59 | char *decimal_point; | |
60 | char *thousands_sep; | |
61 | char *grouping; | |
62 | char *int_curr_symbol; | |
63 | char *currency_symbol; | |
64 | char *mon_decimal_point; | |
65 | char *mon_thousands_sep; | |
66 | char *mon_grouping; | |
67 | char *positive_sign; | |
68 | char *negative_sign; | |
69 | char int_frac_digits; | |
70 | char frac_digits; | |
71 | char p_cs_precedes; | |
72 | char p_sep_by_space; | |
73 | char n_cs_precedes; | |
74 | char n_sep_by_space; | |
75 | char p_sign_posn; | |
76 | char n_sign_posn; | |
77 | char int_p_cs_precedes; | |
78 | char int_n_cs_precedes; | |
79 | char int_p_sep_by_space; | |
80 | char int_n_sep_by_space; | |
81 | char int_p_sign_posn; | |
82 | char int_n_sign_posn; | |
83 | }; | |
84 | .Ed | |
85 | .Pp | |
86 | The individual fields have the following meanings: | |
87 | .Pp | |
88 | .Bl -tag -width mon_decimal_point | |
89 | .It Va decimal_point | |
90 | The decimal point character, except for currency values, | |
91 | cannot be an empty string. | |
92 | .It Va thousands_sep | |
93 | The separator between groups of digits | |
94 | before the decimal point, except for currency values. | |
95 | .It Va grouping | |
96 | The sizes of the groups of digits, except for currency values. | |
97 | This is a pointer to a vector of integers, each of size | |
98 | .Vt char , | |
99 | representing group size from low order digit groups | |
100 | to high order (right to left). | |
101 | The list may be terminated with 0 or | |
102 | .Dv CHAR_MAX . | |
103 | If the list is terminated with 0, | |
104 | the last group size before the 0 is repeated to account for all the digits. | |
105 | If the list is terminated with | |
106 | .Dv CHAR_MAX , | |
107 | no more grouping is performed. | |
108 | .It Va int_curr_symbol | |
109 | The standardized international currency symbol. | |
110 | .It Va currency_symbol | |
111 | The local currency symbol. | |
112 | .It Va mon_decimal_point | |
113 | The decimal point character for currency values. | |
114 | .It Va mon_thousands_sep | |
115 | The separator for digit groups in currency values. | |
116 | .It Va mon_grouping | |
117 | Like | |
118 | .Va grouping | |
119 | but for currency values. | |
120 | .It Va positive_sign | |
121 | The character used to denote nonnegative currency values, | |
122 | usually the empty string. | |
123 | .It Va negative_sign | |
124 | The character used to denote negative currency values, | |
125 | usually a minus sign. | |
126 | .It Va int_frac_digits | |
127 | The number of digits after the decimal point | |
128 | in an international-style currency value. | |
129 | .It Va frac_digits | |
130 | The number of digits after the decimal point | |
131 | in the local style for currency values. | |
132 | .It Va p_cs_precedes | |
133 | 1 if the currency symbol precedes the currency value | |
134 | for nonnegative values, 0 if it follows. | |
135 | .It Va p_sep_by_space | |
136 | 1 if a space is inserted between the currency symbol | |
137 | and the currency value for nonnegative values, 0 otherwise. | |
138 | .It Va n_cs_precedes | |
139 | Like | |
140 | .Va p_cs_precedes | |
141 | but for negative values. | |
142 | .It Va n_sep_by_space | |
143 | Like | |
144 | .Va p_sep_by_space | |
145 | but for negative values. | |
146 | .It Va p_sign_posn | |
147 | The location of the | |
148 | .Va positive_sign | |
149 | with respect to a nonnegative quantity and the | |
150 | .Va currency_symbol , | |
151 | coded as follows: | |
152 | .Pp | |
153 | .Bl -tag -width 3n -compact | |
154 | .It Li 0 | |
155 | Parentheses around the entire string. | |
156 | .It Li 1 | |
157 | Before the string. | |
158 | .It Li 2 | |
159 | After the string. | |
160 | .It Li 3 | |
161 | Just before | |
162 | .Va currency_symbol . | |
163 | .It Li 4 | |
164 | Just after | |
165 | .Va currency_symbol . | |
166 | .El | |
167 | .It Va n_sign_posn | |
168 | Like | |
169 | .Va p_sign_posn | |
170 | but for negative currency values. | |
171 | .It Va int_p_cs_precedes | |
172 | Same as | |
173 | .Va p_cs_precedes , | |
174 | but for internationally formatted monetary quantities. | |
175 | .It Va int_n_cs_precedes | |
176 | Same as | |
177 | .Va n_cs_precedes , | |
178 | but for internationally formatted monetary quantities. | |
179 | .It Va int_p_sep_by_space | |
180 | Same as | |
181 | .Va p_sep_by_space , | |
182 | but for internationally formatted monetary quantities. | |
183 | .It Va int_n_sep_by_space | |
184 | Same as | |
185 | .Va n_sep_by_space , | |
186 | but for internationally formatted monetary quantities. | |
187 | .It Va int_p_sign_posn | |
188 | Same as | |
189 | .Va p_sign_posn , | |
190 | but for internationally formatted monetary quantities. | |
191 | .It Va int_n_sign_posn | |
192 | Same as | |
193 | .Va n_sign_posn , | |
194 | but for internationally formatted monetary quantities. | |
195 | .El | |
196 | .Pp | |
197 | Unless mentioned above, | |
198 | an empty string as a value for a field | |
199 | indicates a zero length result or | |
200 | a value that is not in the current locale. | |
201 | A | |
202 | .Dv CHAR_MAX | |
203 | result similarly denotes an unavailable value. | |
204 | .Sh RETURN VALUES | |
205 | The | |
206 | .Fn localeconv | |
207 | function returns a pointer to a static object | |
208 | which may be altered by later calls to | |
209 | .Xr setlocale 3 | |
210 | or | |
211 | .Fn localeconv . | |
212 | .Sh ERRORS | |
213 | No errors are defined. | |
214 | .Sh SEE ALSO | |
215 | .Xr setlocale 3 , | |
216 | .Xr strfmon 3 | |
217 | .Sh STANDARDS | |
218 | The | |
219 | .Fn localeconv | |
220 | function conforms to | |
221 | .St -isoC-99 . | |
222 | .Sh HISTORY | |
223 | The | |
224 | .Fn localeconv | |
225 | function first appeared in | |
226 | .Bx 4.4 . |