setlocale.c 456 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * setlocale - set the programs locale
  3. */
  4. /* $Id$ */
  5. #include <locale.h>
  6. #include <string.h>
  7. struct lconv _lc;
  8. char *
  9. setlocale(int category, const char *locale)
  10. {
  11. if (!locale) return "C";
  12. if (*locale && strcmp(locale, "C")) return (char *)NULL;
  13. switch(category) {
  14. case LC_ALL:
  15. case LC_CTYPE:
  16. case LC_COLLATE:
  17. case LC_TIME:
  18. case LC_NUMERIC:
  19. case LC_MONETARY:
  20. return *locale ? (char *)locale : "C";
  21. default:
  22. return (char *)NULL;
  23. }
  24. }