mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
4cd45f5875
By returning nullptr we're telling the caller that setlocale() failed. Some programs expect setlocale() to succeed so let's pretend that it did.
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <locale.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
extern "C" {
|
|
|
|
static char default_decimal_point[] = ".";
|
|
static char default_thousands_sep[] = ",";
|
|
static char default_grouping[] = "\x03\x03";
|
|
|
|
static char default_empty_string[] = "";
|
|
static char default_empty_value = 127;
|
|
|
|
static struct lconv default_locale = {
|
|
default_decimal_point,
|
|
default_thousands_sep,
|
|
default_grouping,
|
|
default_empty_string,
|
|
default_empty_string,
|
|
default_empty_string,
|
|
default_empty_string,
|
|
default_empty_string,
|
|
default_empty_string,
|
|
default_empty_string,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value,
|
|
default_empty_value
|
|
};
|
|
|
|
char* setlocale(int, const char*)
|
|
{
|
|
static char locale[2];
|
|
memcpy(locale, "C", 2);
|
|
return locale;
|
|
}
|
|
|
|
struct lconv* localeconv()
|
|
{
|
|
return &default_locale;
|
|
}
|
|
}
|