summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/stdlib.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c
index 4c9e8f039..689fdeb3b 100644
--- a/libc/stdlib/stdlib.c
+++ b/libc/stdlib/stdlib.c
@@ -638,7 +638,17 @@ void ssort (void *base,
#define UTF_8_MAX_LEN 3
#endif
+#ifdef __UCLIBC_HAS_LOCALE__
#define ENCODING (__global_locale.encoding)
+#warning implement __CTYPE_HAS_UTF_8_LOCALES!
+#define __CTYPE_HAS_UTF_8_LOCALES
+#else
+#define ENCODING (__ctype_encoding_7_bit)
+#undef __CTYPE_HAS_8_BIT_LOCALES
+#undef __CTYPE_HAS_UTF_8_LOCALES
+#undef L__wchar_utf8sntowcs
+#undef L__wchar_wcsntoutf8s
+#endif
#endif
@@ -647,16 +657,20 @@ void ssort (void *base,
size_t _stdlib_mb_cur_max(void)
{
+#ifdef __CTYPE_HAS_UTF_8_LOCALES
return __global_locale.mb_cur_max;
+#else
+#ifdef __CTYPE_HAS_8_BIT_LOCALES
+#warning need to change this when/if transliteration is implemented
+#endif
+ return 1;
+#endif
}
#endif
/**********************************************************************/
#ifdef L_mblen
-#warning implement __CTYPE_HAS_UTF_8_LOCALES!
-#define __CTYPE_HAS_UTF_8_LOCALES
-
int mblen(register const char *s, size_t n)
{
static mbstate_t state;
@@ -683,9 +697,6 @@ int mblen(register const char *s, size_t n)
/**********************************************************************/
#ifdef L_mbtowc
-#warning implement __CTYPE_HAS_UTF_8_LOCALES!
-#define __CTYPE_HAS_UTF_8_LOCALES
-
int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n)
{
static mbstate_t state;
@@ -712,9 +723,6 @@ int mbtowc(wchar_t *__restrict pwc, register const char *__restrict s, size_t n)
/**********************************************************************/
#ifdef L_wctomb
-#warning implement __CTYPE_HAS_UTF_8_LOCALES!
-#define __CTYPE_HAS_UTF_8_LOCALES
-
/* Note: We completely ignore state in all currently supported conversions. */
int wctomb(register char *__restrict s, wchar_t swc)