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