OpenBSD manual page server

Manual Page Search Parameters

USELOCALE(3) Library Functions Manual USELOCALE(3)

uselocaleselect the locale for the current thread

#include <locale.h>

locale_t
uselocale(locale_t newloc);

The function () selects newloc for use by functions in the current thread that do not take a locale_t argument. Neither the global locale set by setlocale(3) nor locales used by other threads change.

The current thread uses newloc until () is called again successfully with a non-null argument in the same thread, and passing newloc to freelocale(3) or newlocale(3) before that results in undefined behaviour.

To revoke the use of newloc in the current thread without installing another thread-specific locale, instead reverting to the global locale, call () with the special argument LC_GLOBAL_LOCALE.

When called with the argument (locale_t)0, the thread-specific locale remains unchanged.

The function uselocale() returns the thread-specific locale which is in use right before the call, or the special return value LC_GLOBAL_LOCALE if the thread used the global locale before the call.

The function uselocale() fails if:

[]
The newloc argument is neither a valid locale object nor (locale_t)0.

iswalnum(3), iswctype(3), newlocale(3), towctrans(3), towlower(3), wcscasecmp(3), wctrans(3), wctype(3)

The function uselocale() conforms to IEEE Std 1003.1-2008 (“POSIX.1”).

The function uselocale() has been available since OpenBSD 6.2.

September 5, 2017 OpenBSD-7.1