From 0e990a4be898b44994320532cc49199e18cdfc4a Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Fri, 4 Jun 2021 01:46:41 +0200 Subject: LibC: Implement `mblen()` --- Userland/Libraries/LibC/stdlib.cpp | 8 ++++++++ Userland/Libraries/LibC/stdlib.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index 8c2e5545d5..feae781848 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -865,6 +865,14 @@ lldiv_t lldiv(long long numerator, long long denominator) return result; } +int mblen(char const* s, size_t n) +{ + // FIXME: Implement locale support + if (!s) + return 0; + return (MB_CUR_MAX > n) ? n : MB_CUR_MAX; +} + size_t mbstowcs(wchar_t*, const char*, size_t) { dbgln("FIXME: Implement mbstowcs()"); diff --git a/Userland/Libraries/LibC/stdlib.h b/Userland/Libraries/LibC/stdlib.h index c9eae34db1..5a5f63beb4 100644 --- a/Userland/Libraries/LibC/stdlib.h +++ b/Userland/Libraries/LibC/stdlib.h @@ -59,6 +59,7 @@ char* mktemp(char*); int mkstemp(char*); char* mkdtemp(char*); void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*)); +int mblen(char const*, size_t); size_t mbstowcs(wchar_t*, const char*, size_t); int mbtowc(wchar_t*, const char*, size_t); int wctomb(char*, wchar_t); -- cgit v1.2.3