Back to index

glibc  2.9
localeconv.c
Go to the documentation of this file.
00001 /* Copyright (C) 1991, 92, 95, 97, 99, 2000 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #include <locale.h>
00020 #include "localeinfo.h"
00021 #include <shlib-compat.h>
00022 
00023 /* Return monetary and numeric information about the current locale.  */
00024 struct lconv *
00025 __localeconv (void)
00026 {
00027   static struct lconv result;
00028 
00029   result.decimal_point = (char *) _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
00030   result.thousands_sep = (char *) _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
00031   result.grouping = (char *) _NL_CURRENT (LC_NUMERIC, GROUPING);
00032   if (*result.grouping == CHAR_MAX || *result.grouping == (char) -1)
00033     result.grouping = (char *) "";
00034 
00035   result.int_curr_symbol = (char *) _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL);
00036   result.currency_symbol = (char *) _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL);
00037   result.mon_decimal_point = (char *) _NL_CURRENT (LC_MONETARY,
00038                                              MON_DECIMAL_POINT);
00039   result.mon_thousands_sep = (char *) _NL_CURRENT (LC_MONETARY,
00040                                              MON_THOUSANDS_SEP);
00041   result.mon_grouping = (char *) _NL_CURRENT (LC_MONETARY, MON_GROUPING);
00042   if (*result.mon_grouping == CHAR_MAX || *result.mon_grouping == (char) -1)
00043     result.mon_grouping = (char *) "";
00044   result.positive_sign = (char *) _NL_CURRENT (LC_MONETARY, POSITIVE_SIGN);
00045   result.negative_sign = (char *) _NL_CURRENT (LC_MONETARY, NEGATIVE_SIGN);
00046   result.int_frac_digits = *(char *) _NL_CURRENT (LC_MONETARY,
00047                                             INT_FRAC_DIGITS);
00048   result.frac_digits = *(char *) _NL_CURRENT (LC_MONETARY, FRAC_DIGITS);
00049   result.p_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY, P_CS_PRECEDES);
00050   result.p_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY, P_SEP_BY_SPACE);
00051   result.n_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY, N_CS_PRECEDES);
00052   result.n_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY, N_SEP_BY_SPACE);
00053   result.p_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY, P_SIGN_POSN);
00054   result.n_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY, N_SIGN_POSN);
00055   result.int_p_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY,
00056                                               INT_P_CS_PRECEDES);
00057   result.int_p_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY,
00058                                                INT_P_SEP_BY_SPACE);
00059   result.int_n_cs_precedes = *(char *) _NL_CURRENT (LC_MONETARY,
00060                                               INT_N_CS_PRECEDES);
00061   result.int_n_sep_by_space = *(char *) _NL_CURRENT (LC_MONETARY,
00062                                                INT_N_SEP_BY_SPACE);
00063   result.int_p_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY,
00064                                             INT_P_SIGN_POSN);
00065   result.int_n_sign_posn = *(char *) _NL_CURRENT (LC_MONETARY,
00066                                             INT_N_SIGN_POSN);
00067 
00068   return &result;
00069 }
00070 
00071 versioned_symbol (libc, __localeconv, localeconv, GLIBC_2_2);
00072 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
00073 strong_alias (__localeconv, __localeconv20)
00074 compat_symbol (libc, __localeconv20, localeconv, GLIBC_2_0);
00075 #endif