ack/lang/cem/libcc.ansi/core/locale/setlocale.c
David Given d1cdb07719 Realise that the libc core can safely call other libc core functions, even if
they're not defined in the core: so putw() can call stdio stuff, for example.
So the earlier concept of pureness isn't necessary. Rename accordingly.
2018-06-21 23:24:23 +02:00

31 lines
466 B
C

/*
* setlocale - set the programs locale
*/
/* $Id$ */
#include <locale.h>
#include <string.h>
struct lconv _lc;
char* setlocale(int category, const char* locale)
{
if (!locale)
return "C";
if (*locale && strcmp(locale, "C"))
return (char*)NULL;
switch (category)
{
case LC_ALL:
case LC_CTYPE:
case LC_COLLATE:
case LC_TIME:
case LC_NUMERIC:
case LC_MONETARY:
return *locale ? (char*)locale : "C";
default:
return (char*)NULL;
}
}