]>
Commit | Line | Data |
---|---|---|
581c785b | 1 | /* Copyright (C) 1991-2022 Free Software Foundation, Inc. |
c84142e8 | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
c84142e8 | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 8 | |
c84142e8 UD |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
28f540f4 | 17 | |
28f540f4 | 18 | #include <locale.h> |
933e73fa | 19 | #include "localeinfo.h" |
9b014809 | 20 | #include <shlib-compat.h> |
28f540f4 RM |
21 | |
22 | /* Return monetary and numeric information about the current locale. */ | |
23 | struct lconv * | |
9b014809 | 24 | __localeconv (void) |
28f540f4 RM |
25 | { |
26 | static struct lconv result; | |
27 | ||
933e73fa RM |
28 | result.decimal_point = (char *) _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT); |
29 | result.thousands_sep = (char *) _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP); | |
30 | result.grouping = (char *) _NL_CURRENT (LC_NUMERIC, GROUPING); | |
a7931fcf | 31 | if (*result.grouping == '\177' || *result.grouping == '\377') |
d8337213 | 32 | result.grouping = (char *) ""; |
933e73fa RM |
33 | |
34 | result.int_curr_symbol = (char *) _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL); | |
35 | result.currency_symbol = (char *) _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL); | |
36 | result.mon_decimal_point = (char *) _NL_CURRENT (LC_MONETARY, | |
37 | MON_DECIMAL_POINT); | |
38 | result.mon_thousands_sep = (char *) _NL_CURRENT (LC_MONETARY, | |
39 | MON_THOUSANDS_SEP); | |
40 | result.mon_grouping = (char *) _NL_CURRENT (LC_MONETARY, MON_GROUPING); | |
a7931fcf | 41 | if (*result.mon_grouping == '\177' || *result.mon_grouping == '\377') |
d8337213 | 42 | result.mon_grouping = (char *) ""; |
933e73fa RM |
43 | result.positive_sign = (char *) _NL_CURRENT (LC_MONETARY, POSITIVE_SIGN); |
44 | result.negative_sign = (char *) _NL_CURRENT (LC_MONETARY, NEGATIVE_SIGN); | |
a7931fcf AS |
45 | |
46 | #define INT_ELEM(member, element) \ | |
47 | result.member = *(char *) _NL_CURRENT (LC_MONETARY, element); \ | |
48 | if (result.member == '\377') result.member = CHAR_MAX | |
49 | ||
50 | INT_ELEM (int_frac_digits, INT_FRAC_DIGITS); | |
51 | INT_ELEM (frac_digits, FRAC_DIGITS); | |
52 | INT_ELEM (p_cs_precedes, P_CS_PRECEDES); | |
53 | INT_ELEM (p_sep_by_space, P_SEP_BY_SPACE); | |
54 | INT_ELEM (n_cs_precedes, N_CS_PRECEDES); | |
55 | INT_ELEM (n_sep_by_space, N_SEP_BY_SPACE); | |
56 | INT_ELEM (p_sign_posn, P_SIGN_POSN); | |
57 | INT_ELEM (n_sign_posn, N_SIGN_POSN); | |
58 | INT_ELEM (int_p_cs_precedes, INT_P_CS_PRECEDES); | |
59 | INT_ELEM (int_p_sep_by_space, INT_P_SEP_BY_SPACE); | |
60 | INT_ELEM (int_n_cs_precedes, INT_N_CS_PRECEDES); | |
61 | INT_ELEM (int_n_sep_by_space, INT_N_SEP_BY_SPACE); | |
62 | INT_ELEM (int_p_sign_posn, INT_P_SIGN_POSN); | |
63 | INT_ELEM (int_n_sign_posn, INT_N_SIGN_POSN); | |
28f540f4 RM |
64 | |
65 | return &result; | |
66 | } | |
9b014809 UD |
67 | |
68 | versioned_symbol (libc, __localeconv, localeconv, GLIBC_2_2); | |
69 | #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) | |
70 | strong_alias (__localeconv, __localeconv20) | |
71 | compat_symbol (libc, __localeconv20, localeconv, GLIBC_2_0); | |
72 | #endif |