Lines Matching refs:code
80 is to use @code{strcoll} or @code{strxfrm} to compare strings.
97 environment variable @code{LANG}. This specifies a single locale to use
107 user can set the @code{LC_ALL} environment variable to @samp{C}.
134 use as the first argument to @code{setlocale}.
137 argument to @code{setlocale}) has to be a valid locale name.
140 @vtable @code
143 This category applies to collation of strings (functions @code{strcoll}
144 and @code{strxfrm}); see @ref{Collation Functions}.
176 with @code{setlocale} to set a single locale for all purposes. Setting
178 @code{LC_*} variables or @code{LANG}.
194 possible with the variable @code{LANGUAGE}. For further description of
205 @code{setlocale}. Call it as follows:
217 You can also use @code{setlocale} to specify a particular locale, for
355 The function @code{setlocale} sets the current locale for category
358 If @var{category} is @code{LC_ALL}, this specifies the locale for all
364 @code{setlocale} returns a string that is the name of the locale
367 The string returned by @code{setlocale} can be overwritten by subsequent
370 @code{setlocale}. (The standard library is guaranteed never to call
371 @code{setlocale} itself.)
373 You should not modify the string returned by @code{setlocale}. It might
375 @code{setlocale}. One requirement is that the @var{category} must be
379 When you read the current locale for category @code{LC_ALL}, the value
381 If you specify the same ``locale name'' with @code{LC_ALL} in a
382 subsequent call to @code{setlocale}, it restores the same combination
390 by @code{setlocale} reflects the newly-modified locale.
400 @code{setlocale}, or if the argument is an empty string, the name
404 If you specify an invalid locale name, @code{setlocale} returns a null
408 Here is an example showing how you might use @code{setlocale} to
427 /* @r{Copy the name so it won't be clobbered by @code{setlocale}.} */
453 @table @code
526 path relative to the configured locale directories; see @code{LOCPATH}
528 the name is invalid, and @code{setlocale} will fail.
533 in @code{LOCPATH} (or the default locale directory if @code{LOCPATH}
537 invalid and cause @code{setlocale} to fail.
539 As a special case, locale names used with @code{LC_ALL} can combine
542 A4 paper format, so you set @code{LANG} to @samp{en_US.UTF-8}, and
543 @code{LC_PAPER} to @samp{de_DE.UTF-8}. In this case, the
544 @code{LC_ALL}-style combined locale name is
554 @code{LOCPATH} environment variable. This variable lists the
559 value for the @code{LOCPATH} default is:
565 The value of @code{LOCPATH} is ignored by privileged programs for
577 As an example take the @code{strftime} function, which is meant to nicely
579 Part of the standard information contained in the @code{LC_TIME}
582 @code{strftime} function does this all by itself. @code{%A}
584 name of the locale currently selected by @code{LC_TIME}. This is an
592 two functions: @code{localeconv} and @code{nl_langinfo}. The former is
598 * The Lame Way to Locale Data:: ISO C's @code{localeconv}.
599 * The Elegant and Fast Way:: X/Open's @code{nl_langinfo}.
603 @subsection @code{localeconv}: It is portable but @dots{}
605 Together with the @code{setlocale} function the @w{ISO C} people
606 invented the @code{localeconv} function. It is a masterpiece of poor
608 usable as it provides access to only @code{LC_MONETARY} and
609 @code{LC_NUMERIC} related information. Nevertheless, if it is
611 portable. The function @code{strfmon} formats monetary amounts
623 The @code{localeconv} function returns a pointer to a structure whose
628 be overwritten by subsequent calls to @code{localeconv}, or by calls to
629 @code{setlocale}, but no other function in the library overwrites this
635 @code{localeconv}'s return value is of this data type. Its elements are
639 If a member of the structure @code{struct lconv} has type @code{char},
640 and the value is @code{CHAR_MAX}, it means that the current locale has
655 These are the standard members of @code{struct lconv}; there may be
658 @table @code
663 value of @code{decimal_point} is @code{"."}, and the value of
664 @code{mon_decimal_point} is @code{""}.
672 @code{""} (the empty string).
677 the decimal point. @code{grouping} applies to non-monetary quantities
678 and @code{mon_grouping} applies to monetary quantities. Use either
679 @code{thousands_sep} or @code{mon_thousands_sep} to separate the digit
684 type @code{char}. Successive numbers (from left to right) give the
686 point.) The last member is either @code{0}, in which case the previous
688 @code{CHAR_MAX}, in which case there is no more grouping---or, put
692 For example, if @code{grouping} is @code{"\04\03\02"}, the correct
693 grouping for the number @code{123456787654321} is @samp{12}, @samp{34},
699 A value of @code{"\03"} indicates repeated groups of three digits, as
702 In the standard @samp{C} locale, both @code{grouping} and
703 @code{mon_grouping} have a value of @code{""}. This value specifies no
714 @code{CHAR_MAX}, meaning ``unspecified''. The ISO standard doesn't say
717 @code{mon_decimal_point}, so printing any fractional digits would be
725 These members of the @code{struct lconv} structure specify how to print
742 @table @code
746 In the standard @samp{C} locale, this member has a value of @code{""}
755 The value of @code{int_curr_symbol} should normally consist of a
760 In the standard @samp{C} locale, this member has a value of @code{""}
769 These members are @code{1} if the @code{currency_symbol} or
770 @code{int_curr_symbol} strings should precede the value of a monetary
771 amount, or @code{0} if the strings should follow the value. The
772 @code{p_cs_precedes} and @code{int_p_cs_precedes} members apply to
773 positive amounts (or zero), and the @code{n_cs_precedes} and
774 @code{int_n_cs_precedes} members apply to negative amounts.
777 @code{CHAR_MAX}, meaning ``unspecified''. The ISO standard doesn't say
782 The members with the @code{int_} prefix apply to the
783 @code{int_curr_symbol} while the other two apply to
784 @code{currency_symbol}.
790 These members are @code{1} if a space should appear between the
791 @code{currency_symbol} or @code{int_curr_symbol} strings and the
792 amount, or @code{0} if no space should appear. The
793 @code{p_sep_by_space} and @code{int_p_sep_by_space} members apply to
794 positive amounts (or zero), and the @code{n_sep_by_space} and
795 @code{int_n_sep_by_space} members apply to negative amounts.
798 @code{CHAR_MAX}, meaning ``unspecified''. The ISO standard doesn't say
803 The members with the @code{int_} prefix apply to the
804 @code{int_curr_symbol} while the other two apply to
805 @code{currency_symbol}. There is one specialty with the
806 @code{int_curr_symbol}, though. Since all legal values contain a space
816 These members of the @code{struct lconv} structure specify how to print
819 @table @code
826 @code{""} (the empty string), meaning ``unspecified''.
829 recommend printing @code{positive_sign} as you find it, even if it is
830 empty. For a negative value, print @code{negative_sign} as you find it
831 unless both it and @code{positive_sign} are empty, in which case print
842 @code{positive_sign} or @code{negative_sign}.) The possible values are
845 @table @code
867 @code{CHAR_MAX}. We recommend you print the sign after the currency
870 The members with the @code{int_} prefix apply to the
871 @code{int_curr_symbol} while the other two apply to
872 @code{currency_symbol}.
879 @code{localeconv} function is not enough to provide reasonable access to
882 ways to access it. Therefore the @code{nl_langinfo} function
890 The @code{nl_langinfo} function can be used to access individual
891 elements of the locale categories. Unlike the @code{localeconv}
892 function, which returns all the information, @code{nl_langinfo}
898 @code{LC_TIME} and @code{LC_MESSAGES} categories is available.
901 The type @code{nl_item} is defined in @file{nl_types.h}. The argument
905 @vtable @code
907 @code{nl_langinfo} returns a string with the name of the coded character
917 @code{nl_langinfo} returns the abbreviated weekday name. @code{ABDAY_1}
926 Similar to @code{ABDAY_1}, etc.,@: but here the return value is the
942 @code{ABMON_1} corresponds to January.
955 Similar to @code{ABMON_1}, etc.,@: but here the month names are not
956 abbreviated. Here the first value @code{MON_1} also corresponds to
970 Similar to @code{MON_1}, etc.,@: but here the month names are in the
972 @code{strftime} functions use these month names for the conversion
973 specifier @code{%OB} (@pxref{Formatting Calendar Time}).
976 so the strings returned for @code{MON_@dots{}} and @code{ALTMON_@dots{}}
979 @strong{NB:} @code{ABALTMON_@dots{}} constants corresponding to the
980 @code{%Ob} conversion specifier are not currently provided, but are
982 to use @code{_NL_ABALTMON_@dots{}}.
992 The return value can be used as a format string for @code{strftime} to
995 The return value can be used as a format string for @code{strftime} to
998 The return value can be used as a format string for @code{strftime} to
1001 The return value can be used as a format string for @code{strftime} to
1006 @code{T_FMT}.
1016 Specifying the @code{E} modifier in their format strings causes the
1017 @code{strftime} functions to use this information. The format of the
1022 As for @code{ERA} it should not be necessary to use this value directly.
1024 This return value can be used as a format string for @code{strftime} to
1027 This return value can be used as a format string for @code{strftime} to
1030 This return value can be used as a format string for @code{strftime} to
1034 represent the values @math{0} to @math{99}. As for @code{ERA} this
1036 through the @code{strftime} function. When the modifier @code{O} is
1041 The same as the value returned by @code{localeconv} in the
1042 @code{int_curr_symbol} element of the @code{struct lconv}.
1045 The same as the value returned by @code{localeconv} in the
1046 @code{currency_symbol} element of the @code{struct lconv}.
1048 @code{CRNCYSTR} is a deprecated alias still required by Unix98.
1050 The same as the value returned by @code{localeconv} in the
1051 @code{mon_decimal_point} element of the @code{struct lconv}.
1053 The same as the value returned by @code{localeconv} in the
1054 @code{mon_thousands_sep} element of the @code{struct lconv}.
1056 The same as the value returned by @code{localeconv} in the
1057 @code{mon_grouping} element of the @code{struct lconv}.
1059 The same as the value returned by @code{localeconv} in the
1060 @code{positive_sign} element of the @code{struct lconv}.
1062 The same as the value returned by @code{localeconv} in the
1063 @code{negative_sign} element of the @code{struct lconv}.
1065 The same as the value returned by @code{localeconv} in the
1066 @code{int_frac_digits} element of the @code{struct lconv}.
1068 The same as the value returned by @code{localeconv} in the
1069 @code{frac_digits} element of the @code{struct lconv}.
1071 The same as the value returned by @code{localeconv} in the
1072 @code{p_cs_precedes} element of the @code{struct lconv}.
1074 The same as the value returned by @code{localeconv} in the
1075 @code{p_sep_by_space} element of the @code{struct lconv}.
1077 The same as the value returned by @code{localeconv} in the
1078 @code{n_cs_precedes} element of the @code{struct lconv}.
1080 The same as the value returned by @code{localeconv} in the
1081 @code{n_sep_by_space} element of the @code{struct lconv}.
1083 The same as the value returned by @code{localeconv} in the
1084 @code{p_sign_posn} element of the @code{struct lconv}.
1086 The same as the value returned by @code{localeconv} in the
1087 @code{n_sign_posn} element of the @code{struct lconv}.
1090 The same as the value returned by @code{localeconv} in the
1091 @code{int_p_cs_precedes} element of the @code{struct lconv}.
1093 The same as the value returned by @code{localeconv} in the
1094 @code{int_p_sep_by_space} element of the @code{struct lconv}.
1096 The same as the value returned by @code{localeconv} in the
1097 @code{int_n_cs_precedes} element of the @code{struct lconv}.
1099 The same as the value returned by @code{localeconv} in the
1100 @code{int_n_sep_by_space} element of the @code{struct lconv}.
1102 The same as the value returned by @code{localeconv} in the
1103 @code{int_p_sign_posn} element of the @code{struct lconv}.
1105 The same as the value returned by @code{localeconv} in the
1106 @code{int_n_sign_posn} element of the @code{struct lconv}.
1110 The same as the value returned by @code{localeconv} in the
1111 @code{decimal_point} element of the @code{struct lconv}.
1113 The name @code{RADIXCHAR} is a deprecated alias still used in Unix98.
1116 The same as the value returned by @code{localeconv} in the
1117 @code{thousands_sep} element of the @code{struct lconv}.
1119 The name @code{THOUSEP} is a deprecated alias still used in Unix98.
1121 The same as the value returned by @code{localeconv} in the
1122 @code{grouping} element of the @code{struct lconv}.
1125 @code{regex} function to recognize a positive response to a yes/no
1126 question. @Theglibc{} provides the @code{rpmatch} function for
1130 @code{regex} function to recognize a negative response to a yes/no
1144 to a yes/no question. What is said for @code{YESSTR} is also true here.
1158 appropriate category, @code{nl_langinfo} returns the information from the
1159 @code{"C"} locale. It is therefore possible to use this function as
1166 An example of @code{nl_langinfo} usage is a function which has to
1168 might think that, since @code{strftime} internally uses the locale
1181 @code{"hh:mm:ss MM/DD/YY"}. This format is only recognizable in the
1201 We have seen that the structure returned by @code{localeconv} as well as
1202 the values given to @code{nl_langinfo} allow you to retrieve the various
1217 The @code{strfmon} function is similar to the @code{strftime} function
1220 by the format string. Like @code{strftime}, the function
1223 There are two differences: @code{strfmon} can take more than one
1225 @code{strftime}, the format string consists of normal text, which is
1229 similar way to @code{printf}:
1249 exact format is determined by the values of the @code{LC_MONETARY}
1269 So far the format looks familiar, being similar to the @code{printf} and
1270 @code{strftime} formats. However, the next two optional fields
1285 from the current locale (@code{frac_digits}, @code{int_frac_digits}, see
1291 As a GNU extension, the @code{strfmon} implementation in @theglibc{}
1293 is given, the argument is expected to be a @code{long double} instead of
1294 a @code{double} value.
1309 As for @code{printf}, the function reads the format string
1312 @code{double} or @code{long double}, depending on the presence of the
1317 @var{s}, including the terminating @code{NULL} byte. If the number of
1320 case @code{errno} is set to @code{E2BIG}.
1324 assumed that all the following pieces of code are executed in a program
1325 which uses the USA locale (@code{en_US}). The simplest
1342 @code{en_US} locale is a comma. The number is also rounded.
1408 @code{"USD "}. The last point is that since the precision right of the
1422 @Theglibc{} contains @code{rpmatch} to give applications easy
1431 The function @code{rpmatch} checks the string in @var{response} for whether
1433 check uses the @code{YESEXPR} and @code{NOEXPR} data in the
1434 @code{LC_MESSAGES} category of the currently selected locale. The
1437 @table @code
1445 The answer matched neither the @code{YESEXPR} nor the @code{NOEXPR}
1463 /* @r{Prepare the @code{getline} call.} */
1478 /* @r{Free what @code{getline} allocated.} */