Fix typo in manual
[platform/upstream/glibc.git] / locale / localeconv.c
1 /* Copyright (C) 1991, 92, 95, 97, 99, 2000 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
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.
8
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
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17
18 #include <locale.h>
19 #include "localeinfo.h"
20 #include <shlib-compat.h>
21
22 /* Return monetary and numeric information about the current locale.  */
23 struct lconv *
24 __localeconv (void)
25 {
26   static struct lconv result;
27
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);
31   if (*result.grouping == CHAR_MAX || *result.grouping == (char) -1)
32     result.grouping = (char *) "";
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);
41   if (*result.mon_grouping == CHAR_MAX || *result.mon_grouping == (char) -1)
42     result.mon_grouping = (char *) "";
43   result.positive_sign = (char *) _NL_CURRENT (LC_MONETARY, POSITIVE_SIGN);
44   result.negative_sign = (char *) _NL_CURRENT (LC_MONETARY, NEGATIVE_SIGN);
45   result.int_frac_digits = *(char *) _NL_CURRENT (LC_MONETARY,
46                                                   INT_FRAC_DIGITS);
47   result.frac_digits = *(char *) _NL_CURRENT (LC_MONETARY, FRAC_DIGITS);
48   result.p_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY, P_CS_PRECEDES);
49   result.p_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY, P_SEP_BY_SPACE);
50   result.n_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY, N_CS_PRECEDES);
51   result.n_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY, N_SEP_BY_SPACE);
52   result.p_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY, P_SIGN_POSN);
53   result.n_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY, N_SIGN_POSN);
54   result.int_p_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY,
55                                                     INT_P_CS_PRECEDES);
56   result.int_p_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY,
57                                                      INT_P_SEP_BY_SPACE);
58   result.int_n_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY,
59                                                     INT_N_CS_PRECEDES);
60   result.int_n_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY,
61                                                      INT_N_SEP_BY_SPACE);
62   result.int_p_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY,
63                                                   INT_P_SIGN_POSN);
64   result.int_n_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY,
65                                                   INT_N_SIGN_POSN);
66
67   return &result;
68 }
69
70 versioned_symbol (libc, __localeconv, localeconv, GLIBC_2_2);
71 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
72 strong_alias (__localeconv, __localeconv20)
73 compat_symbol (libc, __localeconv20, localeconv, GLIBC_2_0);
74 #endif