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, int flag);
void localelistfree(lclist_t *list);
The localelist() function checks on the current system and returns a list of installed locales by allocating a memory for the list and data field of lclist_t type components as needed.
The localelist() 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, the localelist() function deallocates any memory blocks so far allocated in the list and instead sets NULL to the corresponding addresses, as needed, before returning -1 and setting errno to ENOMEM.
The data field of lclist_t type is like the following:
Locale name as a string that can be used to set LANG environment variable.
The following values can be bitwise-inclusive-OR combined and requested to the function via flag 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.)
When LCLIST_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 calling localelist() multiple times with LCLIST_VALIDATE and if you have enough memory space, using this flag may yield a better performance in the subsequent calls to the function.
When LCLIST_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 an LC_MESSAGES directory in the locale database directory hierarchy. In this case, setlocale(3C) with LC_MESSAGES can be successful.
The localelistfree() deallocates any allocated and associated memory blocks with the list by the localelist() function.
Upon successful completion, the localelist() function returns the number of locales in the list. Otherwise, the localelist() returns -1 and sets an errno to indicate the error. The localelistfree() neither returns a specific value nor sets an errno.
The localelist() 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 but LC_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
See attributes(5) for descriptions of the following attributes:
|
locale(1), setlocale(3C), attributes(5), environ(5), locale(5), standards(5)