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