Interpretations

Answering questions that may arise related to the meaning of portions of an IEEE standard concerning specific applications.

IEEE Standards Interpretations for IEEE Std 1003.1™-2001 IEEE Standard for Information Technology - Portable Operating System Interface (POSIX®)

Copyright © 2006 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.

Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.

IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA

Interpretation Request #22
Topic: locale Relevant Sections: STDOUT

There's an unclarity in the STDOUT section of the "setlocale" utility: http://www.opengroup.org/onlinepubs/007904975/utilities/locale.html Here's the relevant text: If locale is invoked without any options or operands, the names and values of the LANG and LC_* environment variables described in this volume of IEEE Std 1003.1-2001 shall be written to the standard output, one variable per line, with LANG first, and each line using the following format. Only those variables set in the environment and not overridden by LC_ALL shall be written using this format: "%s=%s\n", <variable_name>, <value> The names of those LC_* variables associated with locale categories< defined in this volume of IEEE Std 1003.1-2001 that are not set in the environment or are overridden by LC_ALL shall be written in the following format: "%s=\"%s\"\n", <variable_name>, <implied value> It is unclear should the value of LANG be output if it's not set in the environment, or if both LANG and LC_ALL are set in the environment, and it's unclear which format should be used to output LANG.

After some research on different operating systems, I think the intent is to always output the value of the LANG variable (even if unset), regardless of whether LC_ALL is set or not, using the first format. I suggest to change the text as follows: If locale is invoked without any options or operands, the names and values of the LANG and LC_* environment variables described in this volume of IEEE Std 1003.1-2001 shall be written to the standard output, one variable per line, with LANG first, and each line using the following format. The LANG variable, and only those LC_* variables set in the environment and not overridden by LC_ALL shall be written using this format: "%s=%s\n", <variable_name>, <value> If LANG is not set, it shall be written as: "LANG=\n" The names of those LC_* variables associated with locale categories defined in this volume of IEEE Std 1003.1-2001 that are not set in the environment or are overridden by LC_ALL shall be written in the following format: "%s=\"%s\"\n", <variable_name>, <implied value>

Interpretation Response
The standard is unclear on this issue about LANG when it has no value, and no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.

Rationale for Interpretation
None.