]>
Commit | Line | Data |
---|---|---|
2aa62f2b | 1 | /* $NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $ */\r |
2 | \r | |
3 | /*\r | |
4 | * Written by J.T. Conklin <jtc@NetBSD.org>.\r | |
5 | * Public domain.\r | |
6 | */\r | |
7 | #include <LibConfig.h>\r | |
8 | #include <sys/EfiCdefs.h>\r | |
9 | #if defined(LIBC_SCCS) && !defined(lint)\r | |
10 | __RCSID("$NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $");\r | |
11 | #endif /* LIBC_SCCS and not lint */\r | |
12 | \r | |
13 | #include <sys/localedef.h>\r | |
14 | #include <locale.h>\r | |
15 | #include <nl_types.h>\r | |
16 | #include <langinfo.h>\r | |
17 | #include "rune.h"\r | |
18 | #include "runetype.h"\r | |
19 | \r | |
20 | char *\r | |
21 | nl_langinfo(nl_item item)\r | |
22 | {\r | |
23 | const char *s;\r | |
24 | \r | |
25 | switch (item) {\r | |
26 | case D_T_FMT:\r | |
27 | s = _CurrentTimeLocale->d_t_fmt;\r | |
28 | break;\r | |
29 | case D_FMT:\r | |
30 | s = _CurrentTimeLocale->d_fmt;\r | |
31 | break;\r | |
32 | case T_FMT:\r | |
33 | s = _CurrentTimeLocale->t_fmt;\r | |
34 | break;\r | |
35 | case T_FMT_AMPM:\r | |
36 | s = _CurrentTimeLocale->t_fmt_ampm;\r | |
37 | break;\r | |
38 | case AM_STR:\r | |
39 | case PM_STR:\r | |
40 | s = _CurrentTimeLocale->am_pm[(size_t)(item - AM_STR)];\r | |
41 | break;\r | |
42 | case DAY_1:\r | |
43 | case DAY_2:\r | |
44 | case DAY_3:\r | |
45 | case DAY_4:\r | |
46 | case DAY_5:\r | |
47 | case DAY_6:\r | |
48 | case DAY_7:\r | |
49 | s = _CurrentTimeLocale->day[(size_t)(item - DAY_1)];\r | |
50 | break;\r | |
51 | case ABDAY_1:\r | |
52 | case ABDAY_2:\r | |
53 | case ABDAY_3:\r | |
54 | case ABDAY_4:\r | |
55 | case ABDAY_5:\r | |
56 | case ABDAY_6:\r | |
57 | case ABDAY_7:\r | |
58 | s = _CurrentTimeLocale->abday[(size_t)(item - ABDAY_1)];\r | |
59 | break;\r | |
60 | case MON_1:\r | |
61 | case MON_2:\r | |
62 | case MON_3:\r | |
63 | case MON_4:\r | |
64 | case MON_5:\r | |
65 | case MON_6:\r | |
66 | case MON_7:\r | |
67 | case MON_8:\r | |
68 | case MON_9:\r | |
69 | case MON_10:\r | |
70 | case MON_11:\r | |
71 | case MON_12:\r | |
72 | s = _CurrentTimeLocale->mon[(size_t)(item - MON_1)];\r | |
73 | break;\r | |
74 | case ABMON_1:\r | |
75 | case ABMON_2:\r | |
76 | case ABMON_3:\r | |
77 | case ABMON_4:\r | |
78 | case ABMON_5:\r | |
79 | case ABMON_6:\r | |
80 | case ABMON_7:\r | |
81 | case ABMON_8:\r | |
82 | case ABMON_9:\r | |
83 | case ABMON_10:\r | |
84 | case ABMON_11:\r | |
85 | case ABMON_12:\r | |
86 | s = _CurrentTimeLocale->abmon[(size_t)(item - ABMON_1)];\r | |
87 | break;\r | |
88 | case RADIXCHAR:\r | |
89 | s = _CurrentNumericLocale->decimal_point;\r | |
90 | break;\r | |
91 | case THOUSEP:\r | |
92 | s = _CurrentNumericLocale->thousands_sep;\r | |
93 | break;\r | |
94 | case YESSTR:\r | |
95 | s = _CurrentMessagesLocale->yesstr;\r | |
96 | break;\r | |
97 | case YESEXPR:\r | |
98 | s = _CurrentMessagesLocale->yesexpr;\r | |
99 | break;\r | |
100 | case NOSTR:\r | |
101 | s = _CurrentMessagesLocale->nostr;\r | |
102 | break;\r | |
103 | case NOEXPR:\r | |
104 | s = _CurrentMessagesLocale->noexpr;\r | |
105 | break;\r | |
106 | case CRNCYSTR: /* XXX */\r | |
107 | s = "";\r | |
108 | break;\r | |
109 | case CODESET:\r | |
110 | #ifdef WITH_RUNE\r | |
111 | s = _CurrentRuneLocale->rl_codeset;\r | |
112 | #else\r | |
113 | s = NULL;\r | |
114 | #endif\r | |
115 | if (!s)\r | |
116 | s = "";\r | |
117 | break;\r | |
118 | default:\r | |
119 | s = "";\r | |
120 | break;\r | |
121 | }\r | |
122 | \r | |
123 | /* The return value should be really const, but the interface says OW */\r | |
124 | return __UNCONST(s);\r | |
125 | }\r |