locale.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <assert.h>
  7. #include <locale.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. extern "C" {
  11. static char default_decimal_point[] = ".";
  12. static char default_thousands_sep[] = ",";
  13. static char default_grouping[] = "\x03\x03";
  14. static char default_empty_string[] = "";
  15. static char default_empty_value = 127;
  16. static struct lconv default_locale = {
  17. default_decimal_point,
  18. default_thousands_sep,
  19. default_grouping,
  20. default_empty_string,
  21. default_empty_string,
  22. default_empty_string,
  23. default_empty_string,
  24. default_empty_string,
  25. default_empty_string,
  26. default_empty_string,
  27. default_empty_value,
  28. default_empty_value,
  29. default_empty_value,
  30. default_empty_value,
  31. default_empty_value,
  32. default_empty_value,
  33. default_empty_value,
  34. default_empty_value,
  35. default_empty_value,
  36. default_empty_value,
  37. default_empty_value,
  38. default_empty_value,
  39. default_empty_value,
  40. default_empty_value
  41. };
  42. char* setlocale(int, const char*)
  43. {
  44. static char locale[2];
  45. memcpy(locale, "C", 2);
  46. return locale;
  47. }
  48. struct lconv* localeconv()
  49. {
  50. return &default_locale;
  51. }
  52. }