mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:14:58 +00:00
LibC: Allow detection of supported locales through setlocale
Closes #14690
This commit is contained in:
parent
3353f89e22
commit
767b23c4aa
1 changed files with 12 additions and 4 deletions
|
@ -45,11 +45,19 @@ static struct lconv default_locale = {
|
|||
default_empty_value
|
||||
};
|
||||
|
||||
char* setlocale(int, char const*)
|
||||
char* setlocale(int, char const* locale)
|
||||
{
|
||||
static char locale[2];
|
||||
memcpy(locale, "C", 2);
|
||||
return locale;
|
||||
static char c_locale_string[2];
|
||||
memcpy(c_locale_string, "C", 2);
|
||||
|
||||
// If we get a null pointer, return the current locale as per POSIX spec.
|
||||
if (locale == nullptr)
|
||||
return c_locale_string;
|
||||
|
||||
if (strcmp(locale, "POSIX") == 0 || strcmp(locale, "C") == 0 || strcmp(locale, "") == 0)
|
||||
return c_locale_string;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct lconv* localeconv()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue