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