1.\" $OpenBSD: localeconv.3,v 1.4 2022/09/11 06:38:10 jmc Exp $ 2.\" $NetBSD: setlocale.3,v 1.3 1997/07/14 23:19:47 kleink Exp $ 3.\" 4.\" Copyright (c) 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" This code is derived from software contributed to Berkeley by 8.\" Donn Seeley at BSDI. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93 35.\" 36.Dd $Mdocdate: September 11 2022 $ 37.Dt LOCALECONV 3 38.Os 39.Sh NAME 40.Nm localeconv 41.Nd retrieve parameters for locale-dependent formatting of numbers 42.Sh SYNOPSIS 43.In locale.h 44.Ft struct lconv * 45.Fn localeconv "void" 46.Sh DESCRIPTION 47The 48.Fn localeconv 49function returns a pointer to a static structure 50which provides parameters for 51.Xr locale 1 Ns -dependent 52formatting of numbers. 53On 54.Ox , 55nothing in the returned structure ever changes. 56On other operating systems, the contents of the structure may vary 57according to the 58.Dv LC_NUMERIC 59and 60.Dv LC_MONETARY 61locale categories. 62.Pp 63It provides the following fields of type 64.Vt char * : 65.Bl -tag -width mon_decimal_point 66.It Fa decimal_point 67The decimal point character, except for currency values. 68.It Fa thousands_sep 69The separator between groups of digits 70before the decimal point, except for currency values. 71.It Fa grouping 72The sizes of the groups of digits, except for currency values. 73This is a pointer to a vector of integers, each of size 74.Vt char , 75representing group size from low order digit groups 76to high order (right to left). 77The list may be terminated with 0 or 78.Dv CHAR_MAX . 79If the list is terminated with 0, 80the last group size before the 0 is repeated to account for all the digits. 81If the list is terminated with 82.Dv CHAR_MAX , 83no more grouping is performed. 84.It Fa int_curr_symbol 85The standardized international currency symbol. 86.It Fa currency_symbol 87The local currency symbol. 88.It Fa mon_decimal_point 89The decimal point character for currency values. 90.It Fa mon_thousands_sep 91The separator for digit groups in currency values. 92.It Fa mon_grouping 93Like 94.Fa grouping 95but for currency values. 96.It Fa positive_sign 97The character used to denote non-negative currency values, 98usually the empty string. 99.It Fa negative_sign 100The character used to denote negative currency values, 101usually a minus sign. 102.El 103.Pp 104It also provides the following fields of type 105.Vt char : 106.Bl -tag -width mon_decimal_point 107.It Fa int_frac_digits 108The number of digits after the decimal point 109in an international-style currency value. 110.It Fa frac_digits 111The number of digits after the decimal point 112in the local style for currency values. 113.It Fa p_cs_precedes 1141 if the currency symbol precedes the currency value 115for non-negative values, 0 if it follows. 116.It Fa p_sep_by_space 1171 if a space is inserted between the currency symbol 118and the currency value for non-negative values, 0 otherwise. 119.It Fa n_cs_precedes 120Like 121.Fa p_cs_precedes 122but for negative values. 123.It Fa n_sep_by_space 124Like 125.Fa p_sep_by_space 126but for negative values. 127.It Fa p_sign_posn 128The location of the 129.Fa positive_sign 130with respect to a non-negative quantity and the 131.Fa currency_symbol , 132coded as follows: 133.Pp 134.Bl -tag -width 3n -compact 135.It Li 0 136Parentheses around the entire string. 137.It Li 1 138Before the string. 139.It Li 2 140After the string. 141.It Li 3 142Just before 143.Fa currency_symbol . 144.It Li 4 145Just after 146.Fa currency_symbol . 147.El 148.It Fa n_sign_posn 149Like 150.Fa p_sign_posn 151but for negative currency values. 152.It Fa int_p_cs_precedes 153Like 154.Fa p_cs_precedes 155but for the international symbol. 156.It Fa int_n_cs_precedes 157Like 158.Fa n_cs_precedes 159but for the international symbol. 160.It Fa int_p_sep_by_space 161Like 162.Fa p_sep_by_space 163but for the international symbol. 164.It Fa int_n_sep_by_space 165Like 166.Fa n_sep_by_space 167but for the international symbol. 168.It Fa int_p_sign_posn 169Like 170.Fa p_sign_posn 171but for the international symbol. 172.It Fa int_n_sign_posn 173Like 174.Fa n_sign_posn 175but for the international symbol. 176.El 177.Pp 178Unless mentioned above, 179an empty string as a value for a field 180indicates a zero length result or 181a value that is not in the current locale. 182A 183.Dv CHAR_MAX 184result similarly denotes an unavailable value. 185.Sh SEE ALSO 186.Xr locale 1 , 187.Xr nl_langinfo 3 , 188.Xr setlocale 3 189.Sh STANDARDS 190The 191.Fn localeconv 192function conforms to 193.St -ansiC . 194.Sh HISTORY 195The 196.Fn localeconv 197function first appeared in 198.Bx 4.3 Net/2 . 199