diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2021-06-04 01:46:41 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-04 10:39:41 +0200 |
commit | 0e990a4be898b44994320532cc49199e18cdfc4a (patch) | |
tree | fb154602f02bcdc7e5a5b788dbc3fc2bbfdaa1f2 /Userland | |
parent | 496988de476ffd6ebeb208c508a66ebff5fc34bc (diff) | |
download | serenity-0e990a4be898b44994320532cc49199e18cdfc4a.zip |
LibC: Implement `mblen()`
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibC/stdlib.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibC/stdlib.h | 1 |
2 files changed, 9 insertions, 0 deletions
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); |