diff options
Diffstat (limited to 'stdlib/strfmon.c')
-rw-r--r-- | stdlib/strfmon.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c index 469908c1df..54771049ad 100644 --- a/stdlib/strfmon.c +++ b/stdlib/strfmon.c @@ -1,5 +1,5 @@ /* Formatting a monetary value according to the current locale. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com> and Jochen Hein <Jochen.Hein@informatik.TU-Clausthal.de>, 1996. @@ -54,6 +54,17 @@ #define to_digit(Ch) ((Ch) - '0') + +/* We use this code also for the extended locale handling where the + function gets as an additional argument the locale which has to be + used. To access the values we have to redefine the _NL_CURRENT + macro. */ +#ifdef USE_IN_EXTENDED_LOCALE_MODEL +# undef _NL_CURRENT +# define _NL_CURRENT(category, item) \ + (current->values[_NL_ITEM_INDEX (item)].string) +#endif + extern int __printf_fp (FILE *, const struct printf_info *, const void **const); /* This function determines the number of digit groups in the output. @@ -63,14 +74,22 @@ extern unsigned int __guess_grouping (unsigned int intdig_max, /* We have to overcome some problems with this implementation. On the - one hand the strfmon() function is specified by in XPG4 and of - course it has to follow this. But on the other hand POSIX.2 - specifies some information in the LC_MONETARY category which should - be used, too. Some of the information contradicts the information - which can be specified in format string. */ + one hand the strfmon() function is specified in XPG4 and of course + it has to follow this. But on the other hand POSIX.2 specifies + some information in the LC_MONETARY category which should be used, + too. Some of the information contradicts the information which can + be specified in format string. */ +#ifndef USE_IN_EXTENDED_LOCALE_MODEL ssize_t strfmon (char *s, size_t maxsize, const char *format, ...) +#else +ssize_t +__strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) +#endif { +#ifdef USE_IN_EXTENDED_LOCALE_MODEL + struct locale_data *current = loc->__locales[LC_MONETARY]; +#endif #ifdef USE_IN_LIBIO _IO_strfile f; #else |