xref: /onnv-gate/usr/src/lib/libast/common/comp/localeconv.c (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                  David Korn <dgk@research.att.com>                   *
194887Schin *                   Phong Vo <kpv@research.att.com>                    *
204887Schin *                                                                      *
214887Schin ***********************************************************************/
224887Schin #pragma prototyped
234887Schin 
244887Schin /*
254887Schin  * localeconv() intercept
264887Schin  */
274887Schin 
284887Schin #include "lclib.h"
294887Schin 
304887Schin #undef	localeconv
314887Schin 
324887Schin static char	null[] = "";
334887Schin 
344887Schin static struct lconv	debug_lconv =
354887Schin {
364887Schin 	",",
374887Schin 	".",
384887Schin 	&null[0],
394887Schin 	&null[0],
404887Schin 	&null[0],
414887Schin 	&null[0],
424887Schin 	&null[0],
434887Schin 	&null[0],
444887Schin 	&null[0],
454887Schin 	&null[0],
464887Schin 	CHAR_MAX,
474887Schin 	CHAR_MAX,
484887Schin 	CHAR_MAX,
494887Schin 	CHAR_MAX,
504887Schin 	CHAR_MAX,
514887Schin 	CHAR_MAX,
524887Schin 	CHAR_MAX,
534887Schin 	CHAR_MAX,
544887Schin };
554887Schin 
564887Schin #if !_lib_localeconv
574887Schin 
584887Schin static struct lconv	default_lconv =
594887Schin {
604887Schin 	".",
614887Schin 	&null[0],
624887Schin 	&null[0],
634887Schin 	&null[0],
644887Schin 	&null[0],
654887Schin 	&null[0],
664887Schin 	&null[0],
674887Schin 	&null[0],
684887Schin 	&null[0],
694887Schin 	&null[0],
704887Schin 	CHAR_MAX,
714887Schin 	CHAR_MAX,
724887Schin 	CHAR_MAX,
734887Schin 	CHAR_MAX,
744887Schin 	CHAR_MAX,
754887Schin 	CHAR_MAX,
764887Schin 	CHAR_MAX,
774887Schin 	CHAR_MAX,
784887Schin };
794887Schin 
804887Schin struct lconv*
localeconv(void)814887Schin localeconv(void)
824887Schin {
834887Schin 	return &default_lconv;
844887Schin }
854887Schin 
864887Schin #endif
874887Schin 
884887Schin /*
894887Schin  * localeconv() intercept
904887Schin  */
914887Schin 
924887Schin struct lconv*
_ast_localeconv(void)934887Schin _ast_localeconv(void)
944887Schin {
954887Schin 	return ((locales[AST_LC_MONETARY]->flags | locales[AST_LC_NUMERIC]->flags) & LC_debug) ? &debug_lconv : localeconv();
964887Schin }
97