Sync usage with man page.
[netbsd-mini2440.git] / lib / libc / locale / global_locale.c
blobc70e9ac9dd62b18323f802c46ffae46d99c71c62
1 /* $NetBSD: global_locale.c,v 1.2 2009/01/11 02:46:28 christos Exp $ */
3 /*-
4 * Copyright (c)2008 Citrus Project,
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
29 #include <sys/cdefs.h>
30 #if defined(LIBC_SCCS) && !defined(lint)
31 __RCSID("$NetBSD: global_locale.c,v 1.2 2009/01/11 02:46:28 christos Exp $");
32 #endif /* LIBC_SCCS and not lint */
34 #include <sys/types.h>
35 #include <sys/localedef.h>
36 #define _CTYPE_PRIVATE
37 #include <ctype.h>
38 #include <langinfo.h>
39 #include <limits.h>
40 #define __SETLOCALE_SOURCE__
41 #include <locale.h>
42 #include <stdlib.h>
43 #ifdef WITH_RUNE
44 #include "rune.h"
45 #else
46 #include "bsdctype.h"
47 #endif
49 #include "setlocale_local.h"
51 struct _locale_impl_t _global_locale =
53 .cache = {
54 .ctype_tab = (const unsigned char *)&_C_ctype_[0],
55 .tolower_tab = (const short *)&_C_tolower_[0],
56 .toupper_tab = (const short *)&_C_toupper_[0],
57 .mb_cur_max = (size_t)1,
58 .ldata = {
59 .decimal_point = __UNCONST("."),
60 .thousands_sep = __UNCONST(""),
61 .grouping = __UNCONST(""),
62 .int_curr_symbol = __UNCONST(""),
63 .currency_symbol = __UNCONST(""),
64 .mon_decimal_point = __UNCONST(""),
65 .mon_thousands_sep = __UNCONST(""),
66 .mon_grouping = __UNCONST(""),
67 .positive_sign = __UNCONST(""),
68 .negative_sign = __UNCONST(""),
69 .int_frac_digits = CHAR_MAX,
70 .frac_digits = CHAR_MAX,
71 .p_cs_precedes = CHAR_MAX,
72 .p_sep_by_space = CHAR_MAX,
73 .n_cs_precedes = CHAR_MAX,
74 .n_sep_by_space = CHAR_MAX,
75 .p_sign_posn = CHAR_MAX,
76 .n_sign_posn = CHAR_MAX,
77 .int_p_cs_precedes = CHAR_MAX,
78 .int_n_cs_precedes = CHAR_MAX,
79 .int_p_sep_by_space = CHAR_MAX,
80 .int_n_sep_by_space = CHAR_MAX,
81 .int_p_sign_posn = CHAR_MAX,
82 .int_n_sign_posn = CHAR_MAX,
84 .items = {
85 [(size_t)D_T_FMT ] = "%a %b %e %H:%M:%S %Y",
86 [(size_t)D_FMT ] = "%m/%d/%y",
87 [(size_t)T_FMT ] = "%H:%M:%S",
88 [(size_t)T_FMT_AMPM ] = "%I:%M:%S %p",
89 [(size_t)AM_STR ] = "AM",
90 [(size_t)PM_STR ] = "PM",
91 [(size_t)DAY_1 ] = "Sun",
92 [(size_t)DAY_2 ] = "Mon",
93 [(size_t)DAY_3 ] = "Tue",
94 [(size_t)DAY_4 ] = "Wed",
95 [(size_t)DAY_5 ] = "Thu",
96 [(size_t)DAY_6 ] = "Fri",
97 [(size_t)DAY_7 ] = "Sat",
98 [(size_t)ABDAY_1 ] = "Sunday",
99 [(size_t)ABDAY_2 ] = "Monday",
100 [(size_t)ABDAY_3 ] = "Tuesday",
101 [(size_t)ABDAY_4 ] = "Wednesday",
102 [(size_t)ABDAY_5 ] = "Thursday",
103 [(size_t)ABDAY_6 ] = "Friday",
104 [(size_t)ABDAY_7 ] = "Saturday",
105 [(size_t)MON_1 ] = "Jan",
106 [(size_t)MON_2 ] = "Feb",
107 [(size_t)MON_3 ] = "Mar",
108 [(size_t)MON_4 ] = "Apr",
109 [(size_t)MON_5 ] = "May",
110 [(size_t)MON_6 ] = "Jun",
111 [(size_t)MON_7 ] = "Jul",
112 [(size_t)MON_8 ] = "Aug",
113 [(size_t)MON_9 ] = "Sep",
114 [(size_t)MON_10 ] = "Oct",
115 [(size_t)MON_11 ] = "Nov",
116 [(size_t)MON_12 ] = "Dec",
117 [(size_t)ABMON_1 ] = "January",
118 [(size_t)ABMON_2 ] = "February",
119 [(size_t)ABMON_3 ] = "March",
120 [(size_t)ABMON_4 ] = "April",
121 [(size_t)ABMON_5 ] = "May",
122 [(size_t)ABMON_6 ] = "June",
123 [(size_t)ABMON_7 ] = "July",
124 [(size_t)ABMON_8 ] = "Augst",
125 [(size_t)ABMON_9 ] = "September",
126 [(size_t)ABMON_10 ] = "October",
127 [(size_t)ABMON_11 ] = "November",
128 [(size_t)ABMON_12 ] = "December",
129 [(size_t)RADIXCHAR ] = ".",
130 [(size_t)THOUSEP ] = "",
131 [(size_t)YESSTR ] = "yes",
132 [(size_t)YESEXPR ] = "^[Yy]",
133 [(size_t)NOSTR ] = "no",
134 [(size_t)NOEXPR ] = "^[Nn]",
135 [(size_t)CRNCYSTR ] = NULL,
136 [(size_t)CODESET ] = "646",
137 [(size_t)ERA ] = NULL,
138 [(size_t)ERA_D_FMT ] = NULL,
139 [(size_t)ERA_D_T_FMT] = NULL,
140 [(size_t)ERA_T_FMT ] = NULL,
141 [(size_t)ALT_DIGITS ] = NULL,
144 .query = { _C_LOCALE },
145 .part_name = {
146 [(size_t)LC_ALL ] = _C_LOCALE,
147 [(size_t)LC_COLLATE ] = _C_LOCALE,
148 [(size_t)LC_CTYPE ] = _C_LOCALE,
149 [(size_t)LC_MONETARY] = _C_LOCALE,
150 [(size_t)LC_NUMERIC ] = _C_LOCALE,
151 [(size_t)LC_TIME ] = _C_LOCALE,
152 [(size_t)LC_MESSAGES] = _C_LOCALE,
154 .part_impl = {
155 [(size_t)LC_ALL ] = (_locale_part_t)NULL,
156 [(size_t)LC_COLLATE ] = (_locale_part_t)NULL,
157 [(size_t)LC_CTYPE ] = (_locale_part_t)
158 #ifdef WITH_RUNE
159 __UNCONST(&_DefaultRuneLocale),
160 #else
161 __UNCONST(&_DefaultBSDCTypeLocale),
162 #endif
163 [(size_t)LC_MONETARY] = (_locale_part_t)
164 __UNCONST(&_DefaultMonetaryLocale),
165 [(size_t)LC_NUMERIC ] = (_locale_part_t)
166 __UNCONST(&_DefaultNumericLocale),
167 [(size_t)LC_MESSAGES] = (_locale_part_t)
168 __UNCONST(&_DefaultMessagesLocale),