mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 21:45:20 +00:00
LibC: Allow detection of supported locales through setlocale
Closes #14690
This commit is contained in:
parent
3353f89e22
commit
767b23c4aa
Notes:
sideshowbarker
2024-07-18 00:41:35 +09:00
Author: https://github.com/implicitfield Commit: https://github.com/SerenityOS/serenity/commit/767b23c4aa Pull-request: https://github.com/SerenityOS/serenity/pull/15385 Issue: https://github.com/SerenityOS/serenity/issues/14690 Reviewed-by: https://github.com/ADKaster ✅
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
Reference in a new issue