1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibC: Implement wctomb

This commit is contained in:
Tim Schumacher 2021-10-10 22:15:04 +02:00 committed by Linus Groh
parent 52621093c7
commit 4893e3ef47

View file

@ -29,6 +29,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <syscall.h> #include <syscall.h>
#include <unistd.h> #include <unistd.h>
#include <wchar.h>
static void strtons(const char* str, char** endptr) static void strtons(const char* str, char** endptr)
{ {
@ -898,10 +899,15 @@ int mbtowc(wchar_t* wch, const char* data, [[maybe_unused]] size_t data_size)
return 0; return 0;
} }
int wctomb(char*, wchar_t) int wctomb(char* s, wchar_t wc)
{ {
dbgln("FIXME: Implement wctomb()"); static mbstate_t _internal_state = {};
TODO();
// nullptr asks whether we have state-dependent encodings, but we don't have any.
if (s == nullptr)
return 0;
return static_cast<int>(wcrtomb(s, wc, &_internal_state));
} }
size_t wcstombs(char* dest, const wchar_t* src, size_t max) size_t wcstombs(char* dest, const wchar_t* src, size_t max)