From 8084f3b23c945633d41697dd5d69079fab71c0e8 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Tue, 1 Jan 2013 21:11:07 +0000 Subject: [PATCH] PDCLIB-1 uselocale --- functions/locale/uselocale.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 functions/locale/uselocale.c 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 -- 2.40.0