Print this page
2964 need POSIX 2008 locale object support
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libc/port/locale/timelocal.c
+++ new/usr/src/lib/libc/port/locale/timelocal.c
1 1 /*
2 2 * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
3 3 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
4 4 * Copyright (c) 1997 FreeBSD Inc.
5 5 * All rights reserved.
6 6 *
7 7 * Redistribution and use in source and binary forms, with or without
8 8 * modification, are permitted provided that the following conditions
9 9 * are met:
10 10 * 1. Redistributions of source code must retain the above copyright
11 11 * notice, this list of conditions and the following disclaimer.
12 12 * 2. Redistributions in binary form must reproduce the above copyright
13 13 * notice, this list of conditions and the following disclaimer in the
14 14 * documentation and/or other materials provided with the distribution.
15 15 *
16 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 26 * SUCH DAMAGE.
27 27 */
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
28 28
29 29 #include "lint.h"
30 30 #include <stddef.h>
31 31 #include "ldpart.h"
32 32 #include "timelocal.h"
33 33
34 34 static struct lc_time_T _time_locale;
35 35 static int _time_using_locale;
36 36 static char *time_locale_buf;
37 37
38 +struct xlocale_time __xlocale_global_time;
39 +
38 40 #define LCTIME_SIZE (sizeof (struct lc_time_T) / sizeof (char *))
39 41
40 42 static const struct lc_time_T _C_time_locale = {
41 43 {
42 44 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
43 45 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
44 46 }, {
45 47 "January", "February", "March", "April", "May", "June",
46 48 "July", "August", "September", "October", "November", "December"
47 49 }, {
48 50 "Sun", "Mon", "Tue", "Wed",
49 51 "Thu", "Fri", "Sat"
50 52 }, {
51 53 "Sunday", "Monday", "Tuesday", "Wednesday",
52 54 "Thursday", "Friday", "Saturday"
53 55 },
54 56
55 57 /* X_fmt */
56 58 "%H:%M:%S",
57 59
58 60 /*
59 61 * x_fmt
60 62 * Since the C language standard calls for
61 63 * "date, using locale's date format," anything goes.
62 64 * Using just numbers (as here) makes Quakers happier;
63 65 * it's also compatible with SVR4.
64 66 */
65 67 "%m/%d/%y",
66 68
67 69 /*
68 70 * c_fmt
69 71 */
70 72 "%a %b %e %H:%M:%S %Y",
71 73
72 74 /* am */
73 75 "AM",
74 76
75 77 /* pm */
76 78 "PM",
77 79
78 80 /* date_fmt */
79 81 "%a %b %e %H:%M:%S %Z %Y",
80 82
81 83 /*
82 84 * ampm_fmt - To determine 12-hour clock format time (empty, if N/A)
83 85 */
84 86 "%I:%M:%S %p"
85 87 };
86 88
87 89 struct lc_time_T *
88 90 __get_current_time_locale(void)
89 91 {
90 92 return (_time_using_locale ? &_time_locale :
↓ open down ↓ |
43 lines elided |
↑ open up ↑ |
91 93 (struct lc_time_T *)&_C_time_locale);
92 94 }
93 95
94 96 int
95 97 __time_load_locale(const char *name)
96 98 {
97 99 return (__part_load_locale(name, &_time_using_locale,
98 100 &time_locale_buf, "LC_TIME", LCTIME_SIZE, LCTIME_SIZE,
99 101 (const char **)&_time_locale));
100 102 }
103 +
104 +void *
105 +__time_load(const char* name, locale_t loc)
106 +{
107 + struct xlocale_time *new;
108 +
109 + new = calloc(sizeof(struct xlocale_time), 1);
110 + /* XXX */
111 +
112 + return (new);
113 +}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX