| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- query installed locales
#include <locale.h>int localelist(lclist_t **list, intflag);
void localelistfree(lclist_t *list);
Thelocalelist() function checks on the current system and returns a listof installed locales by allocating a memory for the list and datafield oflclist_t type components as needed.
Thelocalelist() function is always guaranteed to return at least the “C”locale in the list, unless there is an error.
When there is no memory that can be allocated, thelocalelist() functiondeallocates any memory blocks so far allocated in the list and insteadsetsNULL to the corresponding addresses, as needed, before returning -1 andsettingerrno toENOMEM.
The data field oflclist_t type is like the following:
Locale name as a string that can be used to setLANG environment variable.
The following values can be bitwise-inclusive-OR combined and requested to the functionviaflag argument:
Check on the current system and return the list of installed locales.
By default, “C” and “POSIX” are always included in the list.
The list returned will be in ascending order based on 7-bit ASCII character codes of the locale name.
Normally, when a locale is found from file system hierarchy, by default, it is not validated and added to the list of installed locales.
If this flag value is specified, however, the function actually validates the locale to find out if the locale is actually usable or not and add to the list only if it is actually usable. (This prevents any possible bogus locales being added to the list.)
WhenLCLIST_VALIDATE is used, after a locale is validated, the locale loaded into system memory is marked to be unloaded from the memory. However, if this flag value is specified, the function does not do that so that the locale can be reused later.
When you're callinglocalelist() multiple times withLCLIST_VALIDATE and if you have enough memory space, using this flag may yield a better performance in the subsequent calls to the function.
WhenLCLIST_VALIDATE is not specified, this flag is ignored.
By default, after a locale is validated, the function unloads the locale. If this flag value is specified, however, the function does not unload the locale.
This will yield a better performance if you have enough free memory space and frequently reuse locales in your running program.
If this flag is set, “POSIX” locale is not included in the list.
Occasionally, locales are presented by using a symbolic link to other locales as an alias. When this flag value is specified, such locales are excluded from the list.
If this flag is set, the function also includes locales in the list that do not have complete locale database components but have anLC_MESSAGES directory in the locale database directory hierarchy. In this case,setlocale(3C) withLC_MESSAGES can be successful.
Thelocalelistfree() deallocates any allocated and associated memory blocks with the listby thelocalelist() function.
Upon successful completion, thelocalelist() function returns the number of locales inthe list. Otherwise, thelocalelist() returns -1 and sets anerrno toindicate the error. Thelocalelistfree() neither returns a specific value nor sets anerrno.
Thelocalelist() function will fail if:
Cannot allocate memory.
Example 1 Query and print installed locales.
#include <locale.h> :lclist_t *lclp;int count;int i; :count = localelist(&lclp, LCLIST_QUERY);if (count > 0) { for (i = 0; i < count; i++) printf("Locale name = %s\", lclp[i].locale);}localelistfree(lclp);Example 2 Query and print installed locales including locales that do not have locale shared object butLC_MESSAGES directory.
#include <locale.h> :lclist_t *lclp;int count;int i; :count = localelist(&lclp, LCLIST_QUERY | LCLIST_INCLUDE_LC_MESSAGES);if (count > 0) { for (i = 0; i < count; i++) printf("Locale name = %s\", lclp[i].locale);}localelistfree(lclp);Example 3 Query and print installed locales but exclude any locales that are symbolic links to other locales.
#include <locale.h> :lclist_t *lclp;int count;int i; :count = localelist(&lclp, LCLIST_QUERY | LCLIST_EXCLUDE_SYMBOLIC_LINKS);if (count > 0) { for (i = 0; i < count; i++) printf("Locale name = %s\", lclp[i].locale);}localelistfree(lclp);Example 4 Query and print installed locales with locale validations.
#include <locale.h> :lclist_t *lclp;int count;int i; :count = localelist(&lclp, LCLIST_QUERY | LCLIST_VALIDATE);if (count > 0) { for (i = 0; i < count; i++)}localelistfree(lclp);locale database directory for locale
Seeattributes(5) for descriptions of the following attributes:
|
locale(1),setlocale(3C),attributes(5),environ(5),locale(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |