1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifdef __sun__
11
12 #include "support/solaris/xlocale.h"
13 #include <stdarg.h>
14 #include <stdio.h>
15 #include <sys/localedef.h>
16
17 extern "C" {
18
isxdigit_l(int __c,locale_t __l)19 int isxdigit_l(int __c, locale_t __l) {
20 return isxdigit(__c);
21 }
22
iswxdigit_l(wint_t __c,locale_t __l)23 int iswxdigit_l(wint_t __c, locale_t __l) {
24 return isxdigit(__c);
25 }
26
27 // FIXME: This disregards the locale, which is Very Wrong
28 #define vsnprintf_l(__s, __n, __l, __format, __va) \
29 vsnprintf(__s, __n, __format, __va)
30
snprintf_l(char * __s,size_t __n,locale_t __l,const char * __format,...)31 int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...)
32 {
33 va_list __va;
34 va_start(__va, __format);
35 int __res = vsnprintf_l(__s, __n , __l, __format, __va);
36 va_end(__va);
37 return __res;
38 }
39
asprintf_l(char ** __s,locale_t __l,const char * __format,...)40 int asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
41 va_list __va;
42 va_start(__va, __format);
43 // FIXME:
44 int __res = vasprintf(__s, __format, __va);
45 va_end(__va);
46 return __res;
47 }
48
sscanf_l(const char * __s,locale_t __l,const char * __format,...)49 int sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
50 va_list __va;
51 va_start(__va, __format);
52 // FIXME:
53 int __res = vsscanf(__s, __format, __va);
54 va_end(__va);
55 return __res;
56 }
57
mbrtowc_l(wchar_t * __pwc,const char * __pmb,size_t __max,mbstate_t * __ps,locale_t __loc)58 size_t mbrtowc_l(wchar_t *__pwc, const char *__pmb,
59 size_t __max, mbstate_t *__ps, locale_t __loc) {
60 return mbrtowc(__pwc, __pmb, __max, __ps);
61 }
62
localeconv_l(locale_t __l)63 struct lconv *localeconv_l(locale_t __l) {
64 return localeconv();
65 }
66
67 };
68
69 #endif // __sun__
70