From: Owen Shepherd Date: Tue, 1 Jan 2013 21:11:07 +0000 (+0000) Subject: PDCLIB-1 uselocale X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=commitdiff_plain;h=8084f3b23c945633d41697dd5d69079fab71c0e8 PDCLIB-1 uselocale --- diff --git a/functions/locale/uselocale.c b/functions/locale/uselocale.c new file mode 100644 index 0000000..718def7 --- /dev/null +++ b/functions/locale/uselocale.c @@ -0,0 +1,34 @@ +/* uselocale( locale_t ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include +#ifndef REGTEST +#include <_PDCLIB_locale.h> + +locale_t uselocale( locale_t newloc ) +{ + locale_t oldloc = _PDCLIB_threadlocale(); + + if(newloc == LC_GLOBAL_LOCALE) { + _PDCLIB_setthreadlocale(NULL); + } else if(newloc != NULL) { + _PDCLIB_setthreadlocale(newloc); + } + + return oldloc; +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE( NO_TESTDRIVER ); + return TEST_RESULTS; +} +#endif