IEEE P1003.2 Draft 11.2 - September 1991 Copyright (c) 1991 by the Institute of Electrical and Electronics Engineers, Inc. 345 East 47th Street New York, NY 10017, USA All rights reserved as an unpublished work. This is an unapproved and unpublished IEEE Standards Draft, subject to change. The publication, distribution, or copying of this draft, as well as all derivative works based on this draft, is expressly prohibited except as set forth below. Permission is hereby granted for IEEE Standards Committee participants to reproduce this document for purposes of IEEE standardization activities only, and subject to the restrictions contained herein. Permission is hereby also granted for member bodies and technical committees of ISO and IEC to reproduce this document for purposes of developing a national position, subject to the restrictions contained herein. Permission is hereby also granted to the preceding entities to make limited copies of this document in an electronic form only for the stated activities. The following restrictions apply to reproducing or transmitting the document in any form: 1) all copies or portions thereof must identify the document's IEEE project number and draft number, and must be accompanied by this entire notice in a prominent location; 2) no portion of this document may be redistributed in any modified or abridged form without the prior approval of the IEEE Standards Department. Other entities seeking permission to reproduce this document, or any portion thereof, for standardization or other activities, must contact the IEEE Standards Department for the appropriate license. Use of information contained in this unapproved draft is at your own risk. IEEE Standards Department Copyright and Permissions 445 Hoes Lane, P.O. Box 1331 Piscataway, NJ 08855-1331, USA +1 (908) 562-3800 +1 (908) 562-1571 [FAX] Part 2: SHELL AND UTILITIES P1003.2/D11.2 decimal_point The operand is a string containing the symbol that 2 shall be used as the decimal delimiter in numeric, 2 nonmonetary formatted quantities. This keyword 2 cannot be omitted and cannot be set to the empty 2 string. In contexts where other standards limit 2 the decimal_point to a single byte, the result of 2 specifying a multibyte operand is unspecified. 2 thousands_sep The operand is a string containing the symbol that 2 shall be used as a separator for groups of digits 2 to the left of the decimal delimiter in numeric, 2 nonmonetary formatted monetary quantities. In 2 contexts where other standards limit the 2 thousands_sep to a single byte, the result of 2 specifying a multibyte operand is unspecified. 2 grouping Define the size of each group of digits in formatted nonmonetary quantities. The operand is a sequence of integers separated by semicolons. Each integer specifies the number of digits in each group, with the initial integer defining the size of the group immediately preceding the decimal delimiter, and the following integers defining the preceding groups. If the last integer is not -1, 2 then the size of the previous group (if any) shall 2 be repeatedly used for the remainder of the digits. 2 If the last integer is -1, then no further grouping 2 shall be performed. 2 Table 2-9 - LC_NUMERIC Category Definition in the POSIX Locale __________________________________________________________________________________________________________________________________________________ LC_NUMERIC # This is the POSIX Locale definition for # the LC_NUMERIC category. # decimal_point "" 2 thousands_sep "" grouping 0 # END LC_NUMERIC __________________________________________________________________________________________________________________________________________________ BEGIN_RATIONALE Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 101 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX 2.5.2.4.1 LC_NUMERIC Rationale. (_T_h_i_s _s_u_b_c_l_a_u_s_e _i_s _n_o_t _a _p_a_r_t _o_f _P_1_0_0_3._2) See the rationale for LC_MONETARY (2.5.2.3.1) for a description of the 1 behavior of grouping. 1 END_RATIONALE 1 2.5.2.5 LC_TIME The LC_TIME category shall define the interpretation of the field descriptors supported by the date utility (see 4.15). Table 2-10 - LC_TIME Category Definition in the POSIX Locale __________________________________________________________________________________________________________________________________________________ LC_TIME # This is the POSIX Locale definition for # the LC_TIME category. # # Abbreviated weekday names (%a) abday "";"";"";"";\ "";"";"" # # Full weekday names (%A) day "";"";\ "";"";\ "";"";\ "" # # Abbreviated month names (%b) abmon "";"";"";\ "

";"";"";\ "";"";"

";\ "";"";"" # # Full month names (%B) mon "";"";\ "";"

";\ "";"";\ "";"";\ "

";"";\ "";"" # # Equivalent of AM/PM (%p) "AM";"PM" am_pm "";"

" # # Appropriate date and time representation (%c) # "%a %b %e %H:%M:%S %Y" 1 d_t_fmt "\1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 102 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 \ " # # Appropriate date representation (%x) "%m/%d/%y" d_fmt "" # # Appropriate time representation (%X) "%H:%M:%S" t_fmt "" # # Appropriate 12-hour time representation (%r) "%I:%M:%S %p" t_fmt_ampm "\

" # END LC_TIME __________________________________________________________________________________________________________________________________________________ The following mandatory keywords shall be recognized: copy Specify the name of an existing locale to be used as the source for the definition of this category. If this keyword is specified, no other keyword shall be specified. abday Define the abbreviated weekday names, corresponding to the %a field descriptor. The operand shall consist of seven semicolon-separated strings. The first string shall be the abbreviated name of the first day of the week (Sunday), the second the abbreviated name of the second day, and so on. day Define the full weekday names, corresponding to the %A field descriptor. The operand shall consist of seven semicolon-separated strings. The first string shall be the full name of the first day of the week (Sunday), the second the full name of the second day, and so on. abmon Define the abbreviated month names, corresponding to the %b field descriptor. The operand shall consist of twelve semicolon-separated strings. The first string shall be the abbreviated name of the first month of the year (January), the second the abbreviated name of the second month, and so on. mon Define the full month names, corresponding to the %B field descriptor. The operand shall consist of twelve semicolon-separated strings. The first string shall be the full name of the first month of the year (January), the Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 103 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX second the full name of the second month, and so on. d_t_fmt Define the appropriate date and time representation, corresponding to the %c field descriptor. The operand shall consist of a string, and can contain any combination of characters and field descriptors. In addition, the string can contain escape sequences defined in Table 2-15. 1 d_fmt Define the appropriate date representation, corresponding to the %x field descriptor. The operand shall consist of a string, and can contain any combination of characters and field descriptors. In addition, the string can contain escape sequences defined in Table 2-15. 1 t_fmt Define the appropriate time representation, corresponding to the %X field descriptor. The operand shall consist of a string, and can contain any combination of characters and field descriptors. In addition, the string can contain escape sequences defined in Table 2-15. 1 am_pm Define the appropriate representation of the _a_n_t_e _m_e_r_i_d_i_e_m and _p_o_s_t _m_e_r_i_d_i_e_m strings, corresponding to the %p field descriptor. The operand shall consist of two strings, separated by a semicolon. The first string shall represent the _a_n_t_e _m_e_r_i_d_i_e_m designation, the last string the _p_o_s_t _m_e_r_i_d_i_e_m designation. t_fmt_ampm Define the appropriate time representation in the 12-hour clock format with am_pm, corresponding to the %r field descriptor. The operand shall consist of a string and can contain any combination of characters and field descriptors. If the string is empty, the 12-hour format is not supported in the locale. It is implementation defined whether the following optional keywords shall be recognized. If they are not supported, but present in a localedef source, they shall be ignored. era Shall be used to define alternate Eras, corresponding to the %E field descriptor modifier. The format of the operand is unspecified, but shall support the definition of the %EC and %Ey field descriptors, and may also define the era_year format (%EY). era_year Shall be used to define the format of the year in alternate Era format, corresponding to the %EY field descriptor. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 104 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 era_d_fmt Shall be used to define the format of the date in alternate Era notation, corresponding to the %Ex field descriptor. alt_digits Shall be used to define alternate symbols for digits, corresponding to the %O field descriptor modifier. The operand shall consist of semicolon-separated strings. The first string shall be the alternate symbol corresponding with zero, the second string the symbol corresponding with one, and so on. Up to 100 alternate symbol strings can be specified. The %O modifier indicates that the string corresponding to the value specified via the field descriptor shall be used instead of the value. BEGIN_RATIONALE 2.5.2.5.1 LC_TIME Rationale. (_T_h_i_s _s_u_b_c_l_a_u_s_e _i_s _n_o_t _a _p_a_r_t _o_f _P_1_0_0_3._2) Although certain of the field descriptors in the POSIX Locale (such as the name of the month) are shown with initial capital letters, this need not be the case in other locales. Programs using these fields may need to adjust the capitalization if the output is going to be used at the beginning of a sentence. The LC_TIME descriptions of abday, daya, and abmon imply a Gregorian 1 style calendar (7-day weeks, 12-month years, leap years, etc.). 1 Formatting time strings for other types of calendars is outside the scope 1 of this standard. 1 As specified under the date command, the field descriptors corresponding to the optional keywords consist of a modifier followed by a traditional field descriptor (for instance %Ex). If the optional keywords are not supported by the implementation or are unspecified for the current locale, these field descriptors shall be treated as the traditional field descriptor. For instance, assume the following keywords: alt_digits "0th";"1st";"2nd";"3rd";"4th";"5th";\ 1 "6th";"7th";"8th";"9th";"10th" 1 d_fmt "The %Od day of %B in %Y" 1 On 7/4/1776, the %x field descriptor would result in ``The 4th day of 1 July in 1776,'' while 7/14/1789 would come out as ``The 14 day of July in 1789.'' It can be noted that the above example is for illustrative purposes only; the %O modifier is primarily intended to provide for Kanji or Hindi digits in date formats. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 105 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX While it is clear that an alternate year format is required, there is no consensus on the format or the requirements. As a result, while these keywords are reserved, the details are left unspecified. It is expected that National Standards Bodies will provide specifications. END_RATIONALE 2.5.2.6 LC_MESSAGES The LC_MESSAGES category shall define the format and values for affirmative and negative responses. The operands shall be strings or extended regular expressions; see 2.8.4. The following keywords shall be recognized: copy Specify the name of an existing locale to be used as the source for the definition of this category. If this keyword is specified, no other keyword shall be specified. yesexpr The operand shall consist of an extended regular expression that describes the acceptable affirmative response to a question expecting an affirmative or negative response. noexpr The operand shall consist of an extended regular expression that describes the acceptable negative response to a question expecting an affirmative or negative response. Table 2-11 - LC_MESSAGES Category Definition in the POSIX Locale __________________________________________________________________________________________________________________________________________________ LC_MESSAGES # This is the POSIX Locale definition for # the LC_MESSAGES category. # yesexpr "" # noexpr "" END LC_MESSAGES __________________________________________________________________________________________________________________________________________________ BEGIN_RATIONALE 2.5.2.6.1 LC_MESSAGES Rationale. (_T_h_i_s _s_u_b_c_l_a_u_s_e _i_s _n_o_t _a _p_a_r_t _o_f _P_1_0_0_3._2) The LC_MESSAGES category is described in 2.6 as affecting the language used by utilities for their output. The mechanism used by the implementation to accomplish this, other than the responses shown here in the locale definition file, is not specified by this version of this standard. The POSIX.1 working group is developing an interface that Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 106 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 would allow applications (and, presumably some of the standard utilities) to access messages from various message catalogs, tailored to a user's LC_MESSAGES value. END_RATIONALE 2.5.3 Locale Definition Grammar 1 The grammar and lexical conventions in this subclause shall together 1 describe the syntax for the locale definition source. The general 1 conventions for this style of grammar are described in 2.1.2. Any 1 discrepancies found between this grammar and other descriptions in this 1 clause shall be resolved in favor of this grammar. 1 2.5.3.1 Locale Lexical Conventions 1 The lexical conventions for the locale definition grammar are described 1 in this subclause. 1 The following tokens shall be processed (in addition to those string 1 constants shown in the grammar): 1 LOC_NAME A string of characters representing the name of a 1 locale. 1 CHAR Any single character. 1 NUMBER A decimal number, represented by one or more decimal 2 digits. 2 COLLSYMBOL A symbolic name, enclosed between angle brackets. The 1 string shall not duplicate any charmap symbol defined 1 in the current charmap (if any), or a COLLELEMENT 1 symbol. 1 COLLELEMENT A symbolic name, enclosed between angle brackets, which 1 shall not duplicate either any charmap symbol or a 1 CHARSYMBOL symbol. 1 CHARSYMBOL A symbolic name, enclosed between angle brackets, from 1 the current charmap (if any). 1 OCTAL_CHAR One or more octal representations of the encoding of 1 each byte in a single character. The octal 1 representation consists of an escape_char (normally a 1 backslash) followed by two or more octal digits. 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 107 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX HEX_CHAR One or more hexadecimal representations of the encoding 1 of each byte in a single character. The hexadecimal 1 representation consists of an escape_char followed by 1 the constant 'x' and two or more hexadecimal digits. 1 DECIMAL_CHAR One or more decimal representations of the encoding of 1 each byte in a single character. The decimal 1 representation consists of an escape_char and followed 1 by a 'd' and two or more decimal digits. 1 ELLIPSIS The string ``...''. 1 2 EXTENDED_REG_EXP 1 An extended regular expression as defined in the 1 grammar in 2.8.5.2. 1 2 EOL The line termination character . 1 2.5.3.2 Locale Grammar 1 This subclause presents the grammar for the locale definition. 1 %token LOC_NAME 1 %token CHAR 1 %token NUMBER 2 %token COLLSYMBOL COLLELEMENT 1 %token CHARSYMBOL OCTAL_CHAR HEX_CHAR DECIMAL_CHAR 1 %token ELLIPSIS 1 %token EXTENDED_REG_EXP 2 %token EOL 1 %start locale_definition 1 %% 1 locale_definition : global_statements locale_categories 2 | locale_categories 2 ; 1 global_statements : global_statements symbol_redefine 2 | symbol_redefine 2 ; 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 108 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 symbol_redefine : '#escape_char' CHAR EOL 1 | '#comment_char' CHAR EOL 1 ; 1 locale_categories : locale_categories locale_category 2 | locale_category 2 ; 1 locale_category : lc_ctype | lc_collate | lc_messages 1 | lc_monetary | lc_numeric | lc_time 1 ; 1 /* The following grammar rules are common to all categories */ 1 char_list : char_list char_symbol 2 | char_symbol 2 ; 1 char_symbol : CHAR | CHARSYMBOL 1 | OCTAL_CHAR | HEX_CHAR | DECIMAL_CHAR 1 ; 1 locale_name : LOC_NAME 1 | '"' LOC_NAME '"' 1 ; 1 /* The following is the LC_CTYPE category grammar */ 1 lc_ctype : ctype_hdr ctype_keywords ctype_tlr 2 | ctype_hdr 'copy' locale_name EOL ctype_tlr 2 ; 2 ctype_hdr : 'LC_CTYPE' EOL 2 ; 2 ctype_keywords : ctype_keywords ctype_keyword 2 | ctype_keyword 2 ; 1 ctype_keyword : charclass_keyword charclass_list EOL 1 | charconv_keyword charconv_list EOL 1 ; 1 charclass_keyword : 'upper' | 'lower' | 'alpha' | 'digit' 1 | 'alnum' | 'xdigit' | 'space' | 'print' 1 | 'graph' | 'blank' | 'cntrl' 1 ; 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 109 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX charclass_list : charclass_list ';' char_symbol 2 | charclass_list ';' ELLIPSIS ';' char_symbol 1 | char_symbol 2 ; 1 charconv_keyword : 'toupper' 1 | 'tolower' 1 ; 1 charconv_list : charconv_list ';' charconv_entry 2 | charconv_entry 2 ; 1 charconv_entry : '(' char_symbol ',' char_symbol ')' 1 ; 1 ctype_tlr : 'END' 'LC_CTYPE' EOL 2 ; 1 /* The following is the LC_COLLATE category grammar */ 1 lc_collate : collate_hdr collate_keywords collate_tlr 2 | collate_hdr 'copy' locale_name EOL collate_tlr 2 ; 2 collate_hdr : 'LC_COLLATE' EOL 2 ; 2 collate_keywords : order_statements 2 | opt_statements order_statements 2 ; 1 opt_statements : opt_statements collating_symbols 2 | opt_statements collating_elements 2 | collating_symbols 1 | collating_elements 1 ; 1 collating_symbols : 'collating-symbol' COLLSYMBOL EOL 1 ; 1 collating_elements : 'collating-element' COLLELEMENT 1 'from' '"' char_list '"' EOL 2 ; 1 2 order_statements : order_start collation_order order_end 1 ; 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 110 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 order_start : 'order_start' EOL 1 | 'order_start' order_opts EOL 1 ; 1 order_opts : order_opts ';' order_opt 2 | order_opt 2 ; 1 order_opt : order_opt ',' opt_word 2 | opt_word 2 ; 1 opt_word : 'forward' | 'backward' | 'position' 2 ; 1 collation_order : collation_order collation_entry 2 | collation_entry 2 ; 1 collation_entry : COLLSYMBOL EOL 1 | collation_element weight_list EOL 1 | collation_element EOL 2 ; 1 collation_element : char_symbol 1 | COLLELEMENT 1 | ELLIPSIS 1 | 'UNDEFINED' 1 ; 1 weight_list : weight_list ';' weight_symbol 2 | weight_list ';' 2 | weight_symbol 2 ; 1 weight_symbol : char_symbol 2 | COLLSYMBOL 1 | '"' char_list '"' 1 | ELLIPSIS 1 | 'IGNORE' 1 ; 1 order_end : 'order_end' EOL 1 ; 1 collate_tlr : 'END' 'LC_COLLATE' EOL 2 ; 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 111 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX /* The following is the LC_MESSAGES category grammar */ 1 lc_messages : messages_hdr messages_keywords messages_tlr 2 | messages_hdr 'copy' locale_name EOL messages_tlr 2 ; 2 messages_hdr : 'LC_MESSAGES' EOL 2 ; 2 messages_keywords : messages_keywords messages_keyword 2 | messages_keyword 2 ; 1 messages_keyword : 'yesexpr' '"' EXTENDED_REG_EXP '"' EOL 2 | 'noexpr' '"' EXTENDED_REG_EXP '"' EOL 2 ; 2 messages_tlr : 'END' 'LC_MESSAGES' EOL 2 ; 1 /* The following is the LC_MONETARY category grammar */ 1 lc_monetary : monetary_hdr monetary_keywords monetary_tlr2 | monetary_hdr 'copy' locale_name EOL monetary_tlr2 ; 2 monetary_hdr : 'LC_MONETARY' EOL 2 ; 2 monetary_keywords : monetary_keywords monetary_keyword 2 | monetary_keyword 2 ; 1 monetary_keyword : mon_keyword_string mon_string EOL 1 | mon_keyword_char NUMBER EOL 2 | mon_keyword_char '-1' EOL 2 | mon_keyword_grouping mon_group_list EOL 1 ; 1 mon_keyword_string : 'int_curr_symbol' | 'currency_symbol' 1 | 'mon_decimal_point' | 'mon_thousands_sep' 1 | 'positive_sign' | 'negative_sign' 1 ; 1 mon_string : '"' char_list '"' 1 | '""' 1 ; 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 112 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 mon_keyword_char : 'int_frac_digits' | 'frac_digits' 1 | 'p_cs_precedes' | 'p_sep_by_space' 1 | 'n_cs_precedes' | 'n_sep_by_space' 1 | 'p_sign_posn' | 'n_sign_posn' 1 ; 1 2 mon_keyword_grouping : 'mon_grouping' 1 ; 1 mon_group_list : NUMBER 2 | mon_group_list ';' NUMBER 2 ; 2 monetary_tlr : 'END' 'LC_MONETARY' EOL 2 ; 2 /* The following is the LC_NUMERIC category grammar */ 2 lc_numeric : numeric_hdr numeric_keywords numeric_tlr 2 | numeric_hdr 'copy' locale_name EOL numeric_tlr 2 ; 2 numeric_hdr : 'LC_NUMERIC' EOL 2 ; 2 numeric_keywords : numeric_keywords numeric_keyword 2 | numeric_keyword 2 ; 1 numeric_keyword : num_keyword_string num_string EOL 1 | num_keyword_grouping num_group_list EOL 1 ; 1 num_keyword_string : 'decimal_point' 1 | 'thousands_sep' 1 ; 1 num_string : '"' char_list '"' 1 | '""' 1 ; 1 num_keyword_grouping : 'num_grouping' 1 ; 1 num_group_list : NUMBER 2 | num_group_list ';' NUMBER 2 ; 1 2 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 113 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX numeric_tlr : 'END' 'LC_NUMERIC' EOL 2 ; 1 /* The following is the LC_TIME category grammar */ 1 lc_time : time_hdr time_keywords time_tlr 2 | time_hdr 'copy' locale_name EOL time_tlr 2 ; 1 time_hdr : 'LC_TIME' EOL 2 ; 1 time_keywords : time_keywords time_keyword 2 | time_keyword 2 ; 1 time_keyword : time_keyword_name time_list EOL 2 | time_keyword_fmt time_string EOL 1 | time_keyword_opt time_list EOL 1 ; 1 time_keyword_name : 'abday' | 'day' | 'abmon' | 'mon' 2 ; 1 time_keyword_fmt : 'd_t_fmt' | 'd_fmt' | 't_fmt' | 'am_pm' | 't_fmt_ampm'1 ; 1 time_keyword_opt : 'era' | 'era_year' | 'era_d_fmt' | 'alt_digits' 1 ; 1 time_list : time_list ';' time_string 2 | time_string 2 ; 1 time_string : '"' char_list '"' 1 ; 1 time_tlr : 'END' 'LC_TIME' EOL 2 ; 1 BEGIN_RATIONALE 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 114 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 2.5.4 Locale Definition Example. (_T_h_i_s _s_u_b_c_l_a_u_s_e _i_s _n_o_t _a _p_a_r_t _o_f _P_1_0_0_3._2) The following is an example of a locale definition file that could be used as input to the localedef utility. It assumes that the utility is executed with the -f option, naming a _c_h_a_r_m_a_p file with (at least) the following content: CHARMAP \x20 \x24 \101 \141 \346 \365 \300 1 \366 \142 \103 \143 \347 \x64 \110 \150 \xb7 \x73 \x7a END CHARMAP It should not be taken as complete or to represent any actual locale, but only to illustrate the syntax. A further set of examples is offered as part of Annex F. # LC_CTYPE lower ;;;;;...; upper A;B;C;C,;...;Z space \x20;\x09;\x0a;\x0b;\x0c;\x0d 1 blank \040;\011 toupper (,);(b,B);(c,C);(c,,C,);(d,D);(z,Z) END LC_CTYPE # LC_COLLATE # # The following example of collation is based on the proposed 1 # Canadian standard Z243.4.1-1990, "Canadian Alphanumeric 1 # Ordering Standard For Character sets of CSA Z234.4 Standard". 1 # (Other parts of this example locale definition file do not 1 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 115 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX # purport to relate to Canada, or to any other real culture.) 1 # The proposed standard defines a 4-weight collation, such that # in the first pass, characters are compared without regard to # case or accents; in second pass, backwards compare without # regard to case; in the third pass, forward compare without # regard to diacriticals. In the 3 first passes, non-alphabetic 2 # characters are ignored; in the fourth pass, only special # characters are considered, such that "The string that has a # special character in the lowest position comes first. If two # strings have a special character in the same position, the # collation value of the special character determines ordering. # # Only a subset of the character set is used here; mostly to # illustrate the set-up. # 2 # collating-symbol 2 collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol collating-symbol # Further collating-symbols follow. # # Properly, the standard does not include any multi-character # collating elements; the one below is added for completeness. # collating_element from collating_element from collating_element from # order_start forward;backward;forward;forward,position # # Collating symbols are specified first in the sequence to allocate # basic collation values to them, lower that than of any character. 2 Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 116 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 # Further collating symbols are given a basic collating value here. # # Here follows special characters. IGNORE;IGNORE;IGNORE; # Other special characters follow here. # # Here comes the regular characters. ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE # # As an example, the strings "Bach" and "bach" could be encoded (for # compare purposes) as: # "Bach" ;;;;;;\ 2 # ;;;;; 2 # "bach" ;;;;;;\ 2 # ;;;;; 2 # # The two strings are equal in pass 1 and 2, but differ in pass 3. # # Further characters follow. # UNDEFINED IGNORE;IGNORE;IGNORE;IGNORE # order_end # END LC_COLLATE # LC_MONETARY int_curr_symbol "USD " currency_symbol "$" mon_decimal_point "." Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.5 Locale 117 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX mon_grouping 3;0 positive_sign "" negative_sign "-" p_cs_precedes 1 n_sign_posn 0 END LC_MONETARY # LC_NUMERIC copy "US_en.ASCII" 1 END LC_NUMERIC # LC_TIME abday "Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat" # day "Sunday";"Monday";"Tuesday";"Wednesday";\ "Thursday";"Friday";"Saturday" # abmon "Jan";"Feb";"Mar";"Apr";"May";"Jun";\ "Jul";"Aug";"Sep";"Oct";"Nov";"Dec" # mon "January";"February";"March";"April";\ "May";"June";"July";"August";"September";\ "October";"November";"December" # d_t_fmt "%a %b %d %T %Z %Y\n" END LC_TIME # LC_MESSAGES yesexpr "^([yY][[:alpha:]]*)|(OK)" 1 # noexpr "^[nN][[:alpha:]]*" 1 END LC_MESSAGES END_RATIONALE Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 118 2 Terminology and General Requirements Part 2: SHELL AND UTILITIES P1003.2/D11.2 2.6 Environment Variables Environment variables defined in this clause affect the operation of multiple utilities and applications. There are other environment variables that are of interest only to specific utilities. Environment variables that apply to a single utility only are defined as part of the utility description. See the Environment Variables subclause of the utility descriptions for information on environment variable usage. The value of an environment variable is a string of characters, as described in 2.7 in POSIX.1 {8}. Environment variable names used by the standard utilities shall consist solely of uppercase letters, digits, and the _ (underscore) from the characters defined in 2.4. The namespace of environment variable names containing lowercase letters shall be reserved for applications. Applications can define any environment variables with names from this namespace without modifying the behavior of the standard utilities. If the following variables are present in the environment during the execution of an application or utility, they are given the meaning described below. They may be put into the environment, or changed, by either the implementation or the user. If they are defined in the utility's environment, the standard utilities assume they have the specified meaning. Conforming applications shall not set these environment variables to have meanings other than as described. See 7.2 and 3.12 for methods of accessing these variables. HOME A pathname of the user's home directory. LANG This variable shall determine the locale category for 1 any category not specifically selected via a variable 1 starting with LC_. LANG and the LC_ variables can be 1 used by applications to determine the language for messages and instructions, collating sequences, date formats, etc. Additional semantics of this variable, if any, are implementation defined. LC_ALL This variable shall override the value of the LANG variable and the value of any of the other variables starting with LC_. LC_COLLATE This variable shall determine the locale category for character collation information within bracketed regular expressions and for sorting. This environment variable determines the behavior of ranges, equivalence classes, and multicharacter collating elements. Additional semantics of this variable, if any, are implementation defined. Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 2.6 Environment Variables 119 P1003.2/D11.2 INFORMATION TECHNOLOGY--POSIX LC_CTYPE This variable shall determine the locale category for character handling functions. This environment variable shall determine the interpretation of sequences of bytes of text data as characters (e.g., single- versus multibyte characters), the classification of characters (e.g., alpha, digit, graph), and the behavior of character classes. Additional semantics of this variable, if any, are implementation defined. LC_MESSAGES This variable shall determine the locale category for processing affirmative and negative responses and the language and cultural conventions in which messages should be written. Additional semantics of this variable, if any, are implementation defined. The language and cultural conventions of diagnostic and informative messages whose format is unspecified by this standard should be affected by the setting of LC_MESSAGES. LC_MONETARY This variable shall determine the locale category for monetary-related numeric formatting information. Additional semantics of this variable, if any, are implementation defined. LC_NUMERIC This variable shall determine the locale category for numeric formatting (for example, thousands separator and radix character) information. Additional semantics of this variable, if any, are implementation defined. LC_TIME This variable shall determine the locale category for date and time formatting information. Additional semantics of this variable, if any, are implementation defined. LOGNAME The user's login name. PATH The sequence of path prefixes that certain functions and utilities apply in searching for an executable file known only by a filename. The prefixes shall be separated by a colon (:). When a nonzero-length prefix is applied to this filename, a slash shall be inserted between the prefix and the filename. A zero-length prefix is an obsolescent feature that indicates the current working directory. It appears as two adjacent colons (::), as an initial colon preceding the rest of the list, or as a trailing colon following the rest of the list. A Strictly Copyright c 1991 IEEE. All rights reserved. This is an unapproved IEEE Standards Draft, subject to change. 120 2 Terminology and General Requirements