Files
RedBear-OS/local/recipes/tools/diffutils/source/lib/localeconv.c
T
vasilito 068a1ca63e bootloader: rebase onto upstream 1.0.0, sync firmware-loader version
Bootloader fork rebase:
- Base changed from 0.1.0 pre-patched archive to upstream 1.0.0 tag (c7eeb9f)
- Applied 0001-redbear-local-forks.patch (Cargo.toml crate path redirects)
- Applied fix-uefi-alloc-panic.patch equivalents (4 panic!() -> graceful
  error handling in src/main.rs)
- Applied P5-live-preload-cap-1gib.patch (1 GiB cap on live image preload)
- Skipped: P0 GPT partition scan (requires new module + integration),
  P1 timeout/default-resolution, P2 live preload guard (subsumed by
  panic fixes + cap), P3 live image safe read, P4 large ISO boot,
  redox.patch — to be applied in dedicated rebase session.

firmware-loader/Cargo.toml: version 0.1.0 -> 0.3.0 (sync with other
Red Bear custom crates which are at 0.3.0).

fork-upstream-map.toml: bootloader back from PENDING_REBASE to 1.0.0
since the partial rebase matches upstream 1.0.0 content.

fork-upstream-map.toml: base restored to 'main' tracked (was correctly
tracked by build-redbear.sh).
2026-07-11 09:47:59 +03:00

115 lines
4.2 KiB
C

/* Query locale dependent information for formatting numbers.
Copyright (C) 2012-2025 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <locale.h>
#include <limits.h>
#if HAVE_STRUCT_LCONV_DECIMAL_POINT
# define FIX_CHAR_VALUE(x) ((x) >= 0 ? (x) : CHAR_MAX)
/* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_*
members or where fields of type 'char' are set to -1 instead of CHAR_MAX. */
struct lconv *
localeconv (void)
{
static struct lconv result;
# undef lconv
# undef localeconv
struct lconv *sys_result = localeconv ();
result.decimal_point = sys_result->decimal_point;
result.thousands_sep = sys_result->thousands_sep;
result.grouping = sys_result->grouping;
result.mon_decimal_point = sys_result->mon_decimal_point;
result.mon_thousands_sep = sys_result->mon_thousands_sep;
result.mon_grouping = sys_result->mon_grouping;
result.positive_sign = sys_result->positive_sign;
result.negative_sign = sys_result->negative_sign;
result.currency_symbol = sys_result->currency_symbol;
result.frac_digits = FIX_CHAR_VALUE (sys_result->frac_digits);
result.p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes);
result.p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn);
result.p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space);
result.n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes);
result.n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn);
result.n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space);
result.int_curr_symbol = sys_result->int_curr_symbol;
result.int_frac_digits = FIX_CHAR_VALUE (sys_result->int_frac_digits);
# if HAVE_STRUCT_LCONV_INT_P_CS_PRECEDES
result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->int_p_cs_precedes);
result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->int_p_sign_posn);
result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->int_p_sep_by_space);
result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->int_n_cs_precedes);
result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->int_n_sign_posn);
result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->int_n_sep_by_space);
# else
result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes);
result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn);
result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space);
result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes);
result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn);
result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space);
# endif
return &result;
}
#else
/* Override for platforms where 'struct lconv' is a dummy. */
struct lconv *
localeconv (void)
{
static /*const*/ struct lconv result =
{
/* decimal_point */ ".",
/* thousands_sep */ "",
/* grouping */ "",
/* mon_decimal_point */ "",
/* mon_thousands_sep */ "",
/* mon_grouping */ "",
/* positive_sign */ "",
/* negative_sign */ "",
/* currency_symbol */ "",
/* frac_digits */ CHAR_MAX,
/* p_cs_precedes */ CHAR_MAX,
/* p_sign_posn */ CHAR_MAX,
/* p_sep_by_space */ CHAR_MAX,
/* n_cs_precedes */ CHAR_MAX,
/* n_sign_posn */ CHAR_MAX,
/* n_sep_by_space */ CHAR_MAX,
/* int_curr_symbol */ "",
/* int_frac_digits */ CHAR_MAX,
/* int_p_cs_precedes */ CHAR_MAX,
/* int_p_sign_posn */ CHAR_MAX,
/* int_p_sep_by_space */ CHAR_MAX,
/* int_n_cs_precedes */ CHAR_MAX,
/* int_n_sign_posn */ CHAR_MAX,
/* int_n_sep_by_space */ CHAR_MAX
};
return &result;
}
#endif