Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/man/man3c/localelist.3c
Real path: /usr/share/man/man3c/localelist.3c
Zurück
'\" te .\" Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. .TH localelist 3C "23 May 2016" "Oracle Solaris 11.4" "Standard C Library Functions" .SH NAME localelist, localelistfree \- query installed locales .SH SYNOPSIS .LP .nf #include <locale.h> int localelist(lclist_t **\fIlist\fR, int \fIflag\fR); .fi .LP .nf void localelistfree(lclist_t *\fIlist\fR); .fi .SH DESCRIPTION .sp .LP The \fBlocalelist()\fR function checks on the current system and returns a list of installed locales by allocating a memory for the list and data field of \fBlclist_t\fR type components as needed. .sp .LP The \fBlocalelist()\fR function is always guaranteed to return at least the "C" locale in the list, unless there is an error. .sp .LP When there is no memory that can be allocated, the \fBlocalelist()\fR function deallocates any memory blocks so far allocated in the list and instead sets \fINULL\fR to the corresponding addresses, as needed, before returning -1 and setting \fIerrno\fR to \fBENOMEM\fR. .sp .LP The data field of \fBlclist_t\fR type is like the following: .sp .ne 2 .mk .na \fB\fBchar *\fR\fIlocale\fR\fR .ad .RS 16n .rt Locale name as a string that can be used to set \fBLANG\fR environment variable. .RE .sp .LP The following values can be bitwise-inclusive-OR combined and requested to the function via \fIflag\fR argument: .sp .ne 2 .mk .na \fB\fBLCLIST_QUERY\fR\fR .ad .br .sp .6 .RS 4n Check on the current system and return the list of installed locales. .sp By default, "C" and "POSIX" are always included in the list. .sp The list returned will be in ascending order based on 7-bit ASCII character codes of the locale name. .RE .sp .ne 2 .mk .na \fB\fBLCLIST_VALIDATE\fR\fR .ad .br .sp .6 .RS 4n Normally, when a locale is found from file system hierarchy, by default, it is not validated and added to the list of installed locales. .sp 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.) .RE .sp .ne 2 .mk .na \fB\fBLCLIST_KEEP\fR\fR .ad .br .sp .6 .RS 4n When \fBLCLIST_VALIDATE\fR 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. .sp When you're calling \fBlocalelist()\fR multiple times with \fBLCLIST_VALIDATE\fR and if you have enough memory space, using this flag may yield a better performance in the subsequent calls to the function. .sp When \fBLCLIST_VALIDATE\fR is not specified, this flag is ignored. .RE .sp .ne 2 .mk .na \fB\fBLCLIST_DO_NOT_INCLUDE_POSIX\fR\fR .ad .br .sp .6 .RS 4n If this flag is set, "POSIX" locale is not included in the list. .RE .sp .ne 2 .mk .na \fB\fBLCLIST_EXCLUDE_SYMBOLIC_LINKS\fR\fR .ad .br .sp .6 .RS 4n 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. .RE .sp .ne 2 .mk .na \fB\fBLCLIST_INCLUDE_LC_MESSAGES\fR\fR .ad .br .sp .6 .RS 4n If this flag is set, the function also includes locales in the list that do not have complete locale database components but have an \fBLC_MESSAGES\fR directory in the locale database directory hierarchy. In this case, \fBsetlocale\fR(3C) with \fBLC_MESSAGES\fR can be successful. .RE .sp .LP The \fBlocalelistfree()\fR deallocates any allocated and associated memory blocks with the list by the \fBlocalelist()\fR function. .SH RETURN VALUES .sp .LP Upon successful completion, the \fBlocalelist()\fR function returns the number of locales in the list. Otherwise, the \fBlocalelist()\fR returns -1 and sets an \fIerrno\fR to indicate the error. The \fBlocalelistfree()\fR neither returns a specific value nor sets an \fIerrno\fR. .SH ERRORS .sp .LP The \fBlocalelist()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 10n .rt Cannot allocate memory. .RE .SH EXAMPLES .LP \fBExample 1\fR Query and print installed locales. .sp .in +2 .nf #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\en", lclp[i].locale); } localelistfree(lclp); .fi .in -2 .sp .LP \fBExample 2\fR Query and print installed locales including locales that do not have locale shared object but \fBLC_MESSAGES\fR directory. .sp .in +2 .nf #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\en", lclp[i].locale); } localelistfree(lclp); .fi .in -2 .sp .LP \fBExample 3\fR Query and print installed locales but exclude any locales that are symbolic links to other locales. .sp .in +2 .nf #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\en", lclp[i].locale); } localelistfree(lclp); .fi .in -2 .sp .LP \fBExample 4\fR Query and print installed locales with locale validations. .sp .in +2 .nf #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++) printf("Locale name = %s\en", lclp[i].locale); } localelistfree(lclp); .fi .in -2 .sp .SH FILES .sp .ne 2 .mk .na \fB\fB/usr/lib/locale/\fIlocale\fR\fR\fR .ad .RS 26n .rt locale database directory for locale .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level MT-Safe .TE .sp .SH SEE ALSO .sp .LP \fBlocale\fR(1), \fBsetlocale\fR(3C), \fBattributes\fR(7), \fBenviron\fR(7), \fBlocale\fR(7), \fBstandards\fR(7)