xref: /titanic_41/usr/src/lib/libast/common/comp/localeconv.c (revision b56bf881a9655cb27b53cba1468312f7c6dfb0a2)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 
24 /*
25  * localeconv() intercept
26  */
27 
28 #include "lclib.h"
29 
30 #undef	localeconv
31 
32 static char	null[] = "";
33 
34 static struct lconv	debug_lconv =
35 {
36 	",",
37 	".",
38 	&null[0],
39 	&null[0],
40 	&null[0],
41 	&null[0],
42 	&null[0],
43 	&null[0],
44 	&null[0],
45 	&null[0],
46 	CHAR_MAX,
47 	CHAR_MAX,
48 	CHAR_MAX,
49 	CHAR_MAX,
50 	CHAR_MAX,
51 	CHAR_MAX,
52 	CHAR_MAX,
53 	CHAR_MAX,
54 };
55 
56 #if !_lib_localeconv
57 
58 static struct lconv	default_lconv =
59 {
60 	".",
61 	&null[0],
62 	&null[0],
63 	&null[0],
64 	&null[0],
65 	&null[0],
66 	&null[0],
67 	&null[0],
68 	&null[0],
69 	&null[0],
70 	CHAR_MAX,
71 	CHAR_MAX,
72 	CHAR_MAX,
73 	CHAR_MAX,
74 	CHAR_MAX,
75 	CHAR_MAX,
76 	CHAR_MAX,
77 	CHAR_MAX,
78 };
79 
80 struct lconv*
81 localeconv(void)
82 {
83 	return &default_lconv;
84 }
85 
86 #endif
87 
88 /*
89  * localeconv() intercept
90  */
91 
92 struct lconv*
93 _ast_localeconv(void)
94 {
95 	return ((locales[AST_LC_MONETARY]->flags | locales[AST_LC_NUMERIC]->flags) & LC_debug) ? &debug_lconv : localeconv();
96 }
97