LibC: Implement setlocale() for C locale

This commit is contained in:
Bananymous 2024-07-30 11:33:02 +03:00
parent 681d8327f5
commit ca774dfeb5
2 changed files with 17 additions and 1 deletions

View File

@ -5,7 +5,9 @@ set(LIBC_SOURCES
dirent.cpp
fcntl.cpp
grp.cpp
locale.cpp
malloc.cpp
math.cpp
netdb.cpp
printf_impl.cpp
pwd.cpp
@ -25,7 +27,6 @@ set(LIBC_SOURCES
termios.cpp
time.cpp
unistd.cpp
math.cpp
icxxabi.cpp
../../../BAN/BAN/Assert.cpp

View File

@ -0,0 +1,15 @@
#include <locale.h>
#include <string.h>
// FIXME: Actually support locales
char* setlocale(int category, const char* locale)
{
(void)category;
static char s_locale[] = "C";
if (locale == nullptr)
return s_locale;
if (strcmp(locale, "") == 0 || strcmp(locale, "C") == 0 || strcmp(locale, "POSIX") == 0)
return s_locale;
return nullptr;
}