854 lines
34 KiB
HTML
854 lines
34 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>Environment Variables</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h2><a name="tag_08"></a>Environment Variables</h2>
|
|
|
|
<h3><a name="tag_08_01"></a>Environment Variable Definition</h3>
|
|
|
|
<p>Environment variables defined in this chapter affect the operation of multiple utilities, functions, 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 section of the utility descriptions in the Shell
|
|
and Utilities volume of IEEE Std 1003.1-2001 for information on environment variable usage.</p>
|
|
|
|
<p>The value of an environment variable is a string of characters. For a C-language program, an array of strings called the
|
|
environment shall be made available when a process begins. The array is pointed to by the external variable <i>environ</i>, which
|
|
is defined as:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>extern char **environ;
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>These strings have the form <i>name</i>=<i>value</i>; <i>name</i>s shall not contain the character <tt>'='</tt> . For values to
|
|
be portable across systems conforming to IEEE Std 1003.1-2001, the value shall be composed of characters from the
|
|
portable character set (except NUL and as indicated below). There is no meaning associated with the order of strings in the
|
|
environment. If more than one string in a process' environment has the same <i>name</i>, the consequences are undefined.</p>
|
|
|
|
<p>Environment variable names used by the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 consist
|
|
solely of uppercase letters, digits, and the <tt>'_'</tt> (underscore) from the characters defined in <a href=
|
|
"xbd_chap06.html#tagtcjh_3"><i>Portable Character Set</i></a> and do not begin with a digit. Other characters may be permitted by
|
|
an implementation; applications shall tolerate the presence of such names. Uppercase and lowercase letters shall retain their
|
|
unique identities and shall not be folded together. The name space of environment variable names containing lowercase letters is
|
|
reserved for applications. Applications can define any environment variables with names from this name space without modifying the
|
|
behavior of the standard utilities. <basefont size="2"></p>
|
|
|
|
<dl>
|
|
<dt><b>Note:</b></dt>
|
|
|
|
<dd>Other applications may have difficulty dealing with environment variable names that start with a digit. For this reason, use of
|
|
such names is not recommended anywhere.</dd>
|
|
</dl>
|
|
|
|
<basefont size="3">
|
|
|
|
<p>The <i>values</i> that the environment variables may be assigned are not restricted except that they are considered to end with
|
|
a null byte and the total space used to store the environment and the arguments to the process is limited to {ARG_MAX} bytes.</p>
|
|
|
|
<p>Other <i>name</i>= <i>value</i> pairs may be placed in the environment by, for example, calling any of the <a href=
|
|
"../functions/setenv.html"><i>setenv</i>()</a>, <a href="../functions/unsetenv.html"><i>unsetenv</i>()</a>, <sup>[<a href=
|
|
"javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> or <a href=
|
|
"../functions/putenv.html"><i>putenv</i>()</a> <img src="../images/opt-end.gif" alt="[Option End]" border="0"> functions,
|
|
manipulating the <i>environ</i> variable, or by using <i>envp</i> arguments when creating a process; see <i>exec</i> in the System
|
|
Interfaces volume of IEEE Std 1003.1-2001.</p>
|
|
|
|
<p>It is unwise to conflict with certain variables that are frequently exported by widely used command interpreters and
|
|
applications:</p>
|
|
|
|
<center>
|
|
<table cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>ARFLAGS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>IFS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MAILPATH</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PS1</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>CC</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LANG</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MAILRC</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PS2</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>CDPATH</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LC_ALL</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MAKEFLAGS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PS3</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>CFLAGS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LC_COLLATE</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MAKESHELL</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PS4</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>CHARSET</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LC_CTYPE</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MANPATH</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PWD</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>COLUMNS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LC_MESSAGES</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MBOX</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>RANDOM</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>DATEMSK</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LC_MONETARY</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MORE</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>SECONDS</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>DEAD</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LC_NUMERIC</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MSGVERB</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>SHELL</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>EDITOR</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LC_TIME</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>NLSPATH</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>TERM</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>ENV</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LDFLAGS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>NPROC</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>TERMCAP</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>EXINIT</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LEX</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>OLDPWD</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>TERMINFO</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>FC</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LFLAGS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>OPTARG</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>TMPDIR</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>FCEDIT</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LINENO</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>OPTERR</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>TZ</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>FFLAGS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LINES</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>OPTIND</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>USER</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>GET</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LISTER</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PAGER</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>VISUAL</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>GFLAGS</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LOGNAME</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PATH</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>YACC</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>HISTFILE</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>LPDEST</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PPID</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>YFLAGS</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>HISTORY</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MAIL</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PRINTER</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i> </i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>HISTSIZE</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MAILCHECK</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PROCLANG</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i> </i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><i>HOME</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>MAILER</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>PROJECTDIR</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i> </i></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>If the variables in the following two sections are present in the environment during the execution of an application or utility,
|
|
they shall be given the meaning described below. Some are placed into the environment by the implementation at the time the user
|
|
logs in; all can be added or changed by the user or any ancestor of the current process. The implementation adds or changes
|
|
environment variables named in IEEE Std 1003.1-2001 only as specified in IEEE Std 1003.1-2001. If they are
|
|
defined in the application's environment, the utilities in the Shell and Utilities volume of IEEE Std 1003.1-2001 and the
|
|
functions in the System Interfaces volume of IEEE Std 1003.1-2001 assume they have the specified meaning. Conforming
|
|
applications shall not set these environment variables to have meanings other than as described. See <a href=
|
|
"../functions/getenv.html"><i>getenv</i>()</a> and the Shell and Utilities volume of IEEE Std 1003.1-2001, <a href=
|
|
"../utilities/xcu_chap02.html#tag_02_12">Section 2.12, Shell Execution Environment</a> for methods of accessing these
|
|
variables.</p>
|
|
|
|
<h3><a name="tag_08_02"></a>Internationalization Variables</h3>
|
|
|
|
<p>This section describes environment variables that are relevant to the operation of internationalized interfaces described in
|
|
IEEE Std 1003.1-2001.</p>
|
|
|
|
<p>Users may use the following environment variables to announce specific localization requirements to applications. Applications
|
|
can retrieve this information using the <a href="../functions/setlocale.html"><i>setlocale</i>()</a> function to initialize the
|
|
correct behavior of the internationalized interfaces. The descriptions of the internationalization environment variables describe
|
|
the resulting behavior only when the application locale is initialized in this way. The use of the internationalization variables
|
|
by utilities described in the Shell and Utilities volume of IEEE Std 1003.1-2001 is described in the ENVIRONMENT
|
|
VARIABLES section for those utilities in addition to the global effects described in this section.</p>
|
|
|
|
<dl compact>
|
|
<dt><i>LANG</i></dt>
|
|
|
|
<dd>This variable shall determine the locale category for native language, local customs, and coded character set in the absence of
|
|
the <i>LC_ALL</i> and other <i>LC_*</i> ( <i>LC_COLLATE ,</i> <i>LC_CTYPE ,</i> <i>LC_MESSAGES ,</i> <i>LC_MONETARY ,</i>
|
|
<i>LC_NUMERIC ,</i> <i>LC_TIME )</i> environment variables. This can be used by applications to determine the language to use for
|
|
error messages and instructions, collating sequences, date formats, and so on.</dd>
|
|
|
|
<dt><i>LC_ALL</i></dt>
|
|
|
|
<dd>This variable shall determine the values for all locale categories. The value of the <i>LC_ALL</i> environment variable has
|
|
precedence over any of the other environment variables starting with <i>LC_</i> ( <i>LC_COLLATE ,</i> <i>LC_CTYPE ,</i>
|
|
<i>LC_MESSAGES ,</i> <i>LC_MONETARY ,</i> <i>LC_NUMERIC ,</i> <i>LC_TIME )</i> and the <i>LANG</i> environment variable.</dd>
|
|
|
|
<dt><i>LC_COLLATE</i></dt>
|
|
|
|
<dd>This variable shall determine the locale category for character collation. It determines collation information for regular
|
|
expressions and sorting, including equivalence classes and multi-character collating elements, in various utilities and the <a
|
|
href="../functions/strcoll.html"><i>strcoll</i>()</a> and <a href="../functions/strxfrm.html"><i>strxfrm</i>()</a> functions.
|
|
Additional semantics of this variable, if any, are implementation-defined.</dd>
|
|
|
|
<dt><i>LC_CTYPE</i></dt>
|
|
|
|
<dd>This variable shall determine the locale category for character handling functions, such as <a href=
|
|
"../functions/tolower.html"><i>tolower</i>()</a>, <a href="../functions/toupper.html"><i>toupper</i>()</a>, and <a href=
|
|
"../functions/isalpha.html"><i>isalpha</i>()</a>. This environment variable determines the interpretation of sequences of bytes of
|
|
text data as characters (for example, single as opposed to multi-byte characters), the classification of characters (for example,
|
|
alpha, digit, graph), and the behavior of character classes. Additional semantics of this variable, if any, are
|
|
implementation-defined.</dd>
|
|
|
|
<dt><i>LC_MESSAGES</i></dt>
|
|
|
|
<dd>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. <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
|
|
"../images/opt-start.gif" alt="[Option Start]" border="0"> It also affects the behavior of the <a href=
|
|
"../functions/catopen.html"><i>catopen</i>()</a> function in determining the message catalog. <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"> 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 IEEE Std 1003.1-2001 should be affected
|
|
by the setting of <i>LC_MESSAGES .</i></dd>
|
|
|
|
<dt><i>LC_MONETARY</i></dt>
|
|
|
|
<dd>This variable shall determine the locale category for monetary-related numeric formatting information. Additional semantics of
|
|
this variable, if any, are implementation-defined.</dd>
|
|
|
|
<dt><i>LC_NUMERIC</i></dt>
|
|
|
|
<dd>This variable shall determine the locale category for numeric formatting (for example, thousands separator and radix character)
|
|
information in various utilities as well as the formatted I/O operations in <a href="../functions/printf.html"><i>printf</i>()</a>
|
|
and <a href="../functions/scanf.html"><i>scanf</i>()</a> and the string conversion functions in <a href=
|
|
"../functions/strtod.html"><i>strtod</i>()</a>. Additional semantics of this variable, if any, are implementation-defined.</dd>
|
|
|
|
<dt><i>LC_TIME</i></dt>
|
|
|
|
<dd>This variable shall determine the locale category for date and time formatting information. It affects the behavior of the time
|
|
functions in <a href="../functions/strftime.html"><i>strftime</i>()</a>. Additional semantics of this variable, if any, are
|
|
implementation-defined.</dd>
|
|
|
|
<dt><i>NLSPATH</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
This variable shall contain a sequence of templates that the <a href="../functions/catopen.html"><i>catopen</i>()</a> function uses
|
|
when attempting to locate message catalogs. Each template consists of an optional prefix, one or more conversion specifications, a
|
|
filename, and an optional suffix.
|
|
|
|
<p>For example:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>NLSPATH="/system/nlslib/%N.cat"
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>defines that <a href="../functions/catopen.html"><i>catopen</i>()</a> should look for all message catalogs in the directory
|
|
<b>/system/nlslib</b>, where the catalog name should be constructed from the <i>name</i> parameter passed to <a href=
|
|
"../functions/catopen.html"><i>catopen</i>()</a> ( <tt>%N</tt> ), with the suffix <b>.cat</b>.</p>
|
|
|
|
<p>Conversion specifications consist of a <tt>'%'</tt> symbol, followed by a single-letter keyword. The following keywords are
|
|
currently defined:</p>
|
|
|
|
<dl compact>
|
|
<dt><tt>%N</tt></dt>
|
|
|
|
<dd>The value of the <i>name</i> parameter passed to <a href="../functions/catopen.html"><i>catopen</i>()</a>.</dd>
|
|
|
|
<dt><tt>%L</tt></dt>
|
|
|
|
<dd>The value of the <i>LC_MESSAGES</i> category.</dd>
|
|
|
|
<dt><tt>%l</tt></dt>
|
|
|
|
<dd>The <i>language</i> element from the <i>LC_MESSAGES</i> category.</dd>
|
|
|
|
<dt><tt>%t</tt></dt>
|
|
|
|
<dd>The <i>territory</i> element from the <i>LC_MESSAGES</i> category.</dd>
|
|
|
|
<dt><tt>%c</tt></dt>
|
|
|
|
<dd>The <i>codeset</i> element from the <i>LC_MESSAGES</i> category.</dd>
|
|
|
|
<dt><tt>%%</tt></dt>
|
|
|
|
<dd>A single <tt>'%'</tt> character.</dd>
|
|
</dl>
|
|
|
|
<p>An empty string is substituted if the specified value is not currently defined. The separators underscore ( <tt>'_'</tt> ) and
|
|
period ( <tt>'.'</tt> ) are not included in the <tt>%t</tt> and <tt>%c</tt> conversion specifications.</p>
|
|
|
|
<p>Templates defined in <i>NLSPATH</i> are separated by colons ( <tt>':'</tt> ). A leading or two adjacent colons <tt>"::"</tt> is
|
|
equivalent to specifying <tt>%N</tt> . For example:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>NLSPATH=":%N.cat:/nlslib/%L/%N.cat"
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>indicates to <a href="../functions/catopen.html"><i>catopen</i>()</a> that it should look for the requested message catalog in
|
|
<i>name</i>, <i>name</i><b>.cat</b>, and <b>/nlslib/</b><i>category</i><b>/</b><i>name</i><b>.cat</b>, where <i>category</i> is the
|
|
value of the <i>LC_MESSAGES</i> category of the current locale.</p>
|
|
|
|
<p>Users should not set the <i>NLSPATH</i> variable unless they have a specific reason to override the default system path. Setting
|
|
<i>NLSPATH</i> to override the default system path produces undefined results in the standard utilities and in applications with
|
|
appropriate privileges. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>The environment variables <i>LANG ,</i> <i>LC_ALL ,</i> <i>LC_COLLATE ,</i> <i>LC_CTYPE ,</i> <i>LC_MESSAGES ,</i>
|
|
<i>LC_MONETARY ,</i> <i>LC_NUMERIC ,</i> <i>LC_TIME ,</i> <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src=
|
|
"../images/opt-start.gif" alt="[Option Start]" border="0"> and <i>NLSPATH</i> <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"> provide for the support of internationalized applications. The standard utilities shall make use
|
|
of these environment variables as described in this section and the individual ENVIRONMENT VARIABLES sections for the utilities. If
|
|
these variables specify locale categories that are not based upon the same underlying codeset, the results are unspecified.</p>
|
|
|
|
<p>The values of locale categories shall be determined by a precedence order; the first condition met below determines the
|
|
value:</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<p>If the <i>LC_ALL</i> environment variable is defined and is not null, the value of <i>LC_ALL</i> shall be used.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If the <i>LC_*</i> environment variable ( <i>LC_COLLATE ,</i> <i>LC_CTYPE ,</i> <i>LC_MESSAGES ,</i> <i>LC_MONETARY ,</i>
|
|
<i>LC_NUMERIC ,</i> <i>LC_TIME )</i> is defined and is not null, the value of the environment variable shall be used to initialize
|
|
the category that corresponds to the environment variable.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If the <i>LANG</i> environment variable is defined and is not null, the value of the <i>LANG</i> environment variable shall be
|
|
used.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If the <i>LANG</i> environment variable is not set or is set to the empty string, the implementation-defined default locale
|
|
shall be used.</p>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>If the locale value is <tt>"C"</tt> or <tt>"POSIX"</tt> , the POSIX locale shall be used and the standard utilities behave in
|
|
accordance with the rules in <a href="xbd_chap07.html#tag_07_02"><i>POSIX Locale</i></a> for the associated category.</p>
|
|
|
|
<p>If the locale value begins with a slash, it shall be interpreted as the pathname of a file that was created in the output format
|
|
used by the <a href="../utilities/localedef.html"><i>localedef</i></a> utility; see OUTPUT FILES under <a href=
|
|
"../utilities/localedef.html"><i>localedef</i></a>. Referencing such a pathname shall result in that locale being used for the
|
|
indicated category.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
If the locale value has the form:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<i>language</i><b>[</b><i>_territory</i><b>][</b><i>.codeset</i><b>]
|
|
</b>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>it refers to an implementation-provided locale, where settings of language, territory, and codeset are
|
|
implementation-defined.</p>
|
|
|
|
<p><i>LC_COLLATE ,</i> <i>LC_CTYPE ,</i> <i>LC_MESSAGES ,</i> <i>LC_MONETARY ,</i> <i>LC_NUMERIC ,</i> and <i>LC_TIME</i> are
|
|
defined to accept an additional field @ <i>modifier</i>, which allows the user to select a specific instance of localization data
|
|
within a single category (for example, for selecting the dictionary as opposed to the character ordering of data). The syntax for
|
|
these environment variables is thus defined as:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<b>[</b><i>language</i><b>[</b><i>_territory</i><b>][</b><i>.codeset</i><b>][</b><tt>@</tt><i>modifier</i><b>]]
|
|
</b>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>For example, if a user wanted to interact with the system in French, but required to sort German text files, <i>LANG</i> and
|
|
<i>LC_COLLATE</i> could be defined as:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>LANG=Fr_FR
|
|
LC_COLLATE=De_DE
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>This could be extended to select dictionary collation (say) by use of the @ <i>modifier</i> field; for example:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>LC_COLLATE=De_DE@dict
|
|
</tt>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0">
|
|
|
|
<p>An implementation may support other formats.</p>
|
|
|
|
<p>If the locale value is not recognized by the implementation, the behavior is unspecified.</p>
|
|
|
|
<p>At runtime, these values are bound to a program's locale by calling the <a href=
|
|
"../functions/setlocale.html"><i>setlocale</i>()</a> function.</p>
|
|
|
|
<p>Additional criteria for determining a valid locale name are implementation-defined.</p>
|
|
|
|
<h3><a name="tag_08_03"></a>Other Environment Variables</h3>
|
|
|
|
<dl compact>
|
|
<dt><i>COLUMNS</i></dt>
|
|
|
|
<dd>This variable shall represent a decimal integer >0 used to indicate the user's preferred width in column positions for the
|
|
terminal screen or window; see <a href="xbd_chap03.html#tag_03_103"><i>Column Position</i></a> . If this variable is unset or null,
|
|
the implementation determines the number of columns, appropriate for the terminal or window, in an unspecified manner. When
|
|
<i>COLUMNS</i> is set, any terminal-width information implied by <i>TERM</i> is overridden. Users and conforming applications
|
|
should not set <i>COLUMNS</i> unless they wish to override the system selection and produce output unrelated to the terminal
|
|
characteristics.
|
|
|
|
<p>Users should not need to set this variable in the environment unless there is a specific reason to override the implementation's
|
|
default behavior, such as to display data in an area arbitrarily smaller than the terminal or window.</p>
|
|
</dd>
|
|
|
|
<dt><i>DATEMSK</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Indicates the pathname of the template file used by <a href="../functions/getdate.html"><i>getdate</i>()</a>. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><i>HOME</i></dt>
|
|
|
|
<dd>The system shall initialize this variable at the time of login to be a pathname of the user's home directory. See <a href=
|
|
"pwd.h.html"><i><pwd.h></i></a> .</dd>
|
|
|
|
<dt><i>LINES</i></dt>
|
|
|
|
<dd>This variable shall represent a decimal integer >0 used to indicate the user's preferred number of lines on a page or the
|
|
vertical screen or window size in lines. A line in this case is a vertical measure large enough to hold the tallest character in
|
|
the character set being displayed. If this variable is unset or null, the implementation determines the number of lines,
|
|
appropriate for the terminal or window (size, terminal baud rate, and so on), in an unspecified manner. When <i>LINES</i> is set,
|
|
any terminal-height information implied by <i>TERM</i> is overridden. Users and conforming applications should not set <i>LINES</i>
|
|
unless they wish to override the system selection and produce output unrelated to the terminal characteristics.
|
|
|
|
<p>Users should not need to set this variable in the environment unless there is a specific reason to override the implementation's
|
|
default behavior, such as to display data in an area arbitrarily smaller than the terminal or window.</p>
|
|
</dd>
|
|
|
|
<dt><i>LOGNAME</i></dt>
|
|
|
|
<dd>The system shall initialize this variable at the time of login to be the user's login name. See <a href=
|
|
"pwd.h.html"><i><pwd.h></i></a> . For a value of <i>LOGNAME</i> to be portable across implementations of
|
|
IEEE Std 1003.1-2001, the value should be composed of characters from the portable filename character set.</dd>
|
|
|
|
<dt><i>MSGVERB</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Describes which message components shall be used in writing messages by <a href="../functions/fmtmsg.html"><i>fmtmsg</i>()</a>.
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt><i>PATH</i></dt>
|
|
|
|
<dd>This variable shall represent 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 ( <tt>':'</tt> ). When a non-zero-length
|
|
prefix is applied to this filename, a slash shall be inserted between the prefix and the filename. A zero-length prefix is a legacy
|
|
feature that indicates the current working directory. It appears as two adjacent colons ( <tt>"::"</tt> ), as an initial colon
|
|
preceding the rest of the list, or as a trailing colon following the rest of the list. A strictly conforming application shall use
|
|
an actual pathname (such as <b>.</b>) to represent the current working directory in <i>PATH .</i> The list shall be searched from
|
|
beginning to end, applying the filename to each prefix, until an executable file with the specified name and appropriate execution
|
|
permissions is found. If the pathname being sought contains a slash, the search through the path prefixes shall not be performed.
|
|
If the pathname begins with a slash, the specified path is resolved (see <a href="xbd_chap04.html#tag_04_11"><i>Pathname
|
|
Resolution</i></a> ). If <i>PATH</i> is unset or is set to null, the path search is implementation-defined.</dd>
|
|
|
|
<dt><i>PWD</i></dt>
|
|
|
|
<dd>This variable shall represent an absolute pathname of the current working directory. It shall not contain any filename
|
|
components of dot or dot-dot. The value is set by the <a href="../utilities/cd.html"><i>cd</i></a> utility.</dd>
|
|
|
|
<dt><i>SHELL</i></dt>
|
|
|
|
<dd>This variable shall represent a pathname of the user's preferred command language interpreter. If this interpreter does not
|
|
conform to the Shell Command Language in the Shell and Utilities volume of IEEE Std 1003.1-2001, <a href=
|
|
"../utilities/xcu_chap02.html">Chapter 2, Shell Command Language</a>, utilities may behave differently from those described in
|
|
IEEE Std 1003.1-2001.</dd>
|
|
|
|
<dt><i>TMPDIR</i></dt>
|
|
|
|
<dd>This variable shall represent a pathname of a directory made available for programs that need a place to create temporary
|
|
files.</dd>
|
|
|
|
<dt><i>TERM</i></dt>
|
|
|
|
<dd>This variable shall represent the terminal type for which output is to be prepared. This information is used by utilities and
|
|
application programs wishing to exploit special capabilities specific to a terminal. The format and allowable values of this
|
|
environment variable are unspecified.</dd>
|
|
|
|
<dt><i>TZ</i></dt>
|
|
|
|
<dd>This variable shall represent timezone information. The contents of the environment variable named <i>TZ</i> shall be used by
|
|
the <a href="../functions/ctime.html"><i>ctime</i>()</a>, <a href="../functions/localtime.html"><i>localtime</i>()</a>, <a href=
|
|
"../functions/strftime.html"><i>strftime</i>()</a>, and <a href="../functions/mktime.html"><i>mktime</i>()</a> functions, and by
|
|
various utilities, to override the default timezone. The value of <i>TZ</i> has one of the two forms (spaces inserted for clarity):
|
|
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<tt>:</tt><i>characters</i>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>or:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<i>std offset dst offset</i><tt>,</tt> <i>rule</i>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>If <i>TZ</i> is of the first format (that is, if the first character is a colon), the characters following the colon are handled
|
|
in an implementation-defined manner.</p>
|
|
|
|
<p>The expanded format (for all <i>TZ s</i> whose value does not have a colon as the first character) is as follows:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<i>stdoffset</i><b>[</b><i>dst</i><b>[</b><i>offset</i><b>][</b><tt>,</tt><i>start</i><b>[</b><tt>/</tt><i>time</i><b>]</b><tt>,</tt><i>end</i><b>[</b><tt>/</tt><i>time</i><b>]]]
|
|
</b>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>Where:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>std</i> and <i>dst</i></dt>
|
|
|
|
<dd>Indicate no less than three, nor more than {TZNAME_MAX}, bytes that are the designation for the standard ( <i>std</i>) or the
|
|
alternative ( <i>dst</i> -such as Daylight Savings Time) timezone. Only <i>std</i> is required; if <i>dst</i> is missing, then the
|
|
alternative time does not apply in this locale.
|
|
|
|
<p>Each of these fields may occur in either of two formats quoted or unquoted:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>In the quoted form, the first character shall be the less-than ( <tt>'<'</tt> ) character and the last character shall be the
|
|
greater-than ( <tt>'>'</tt> ) character. All characters between these quoting characters shall be alphanumeric characters from
|
|
the portable character set in the current locale, the plus-sign ( <tt>'+'</tt> ) character, or the minus-sign ( <tt>'-'</tt> )
|
|
character. The <i>std</i> and <i>dst</i> fields in this case shall not include the quoting characters.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>In the unquoted form, all characters in these fields shall be alphabetic characters from the portable character set in the
|
|
current locale.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The interpretation of these fields is unspecified if either field is less than three bytes (except for the case when <i>dst</i>
|
|
is missing), more than {TZNAME_MAX} bytes, or if they contain characters other than those specified.</p>
|
|
</dd>
|
|
|
|
<dt><i>offset</i></dt>
|
|
|
|
<dd>Indicates the value added to the local time to arrive at Coordinated Universal Time. The <i>offset</i> has the form:
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<i>hh</i><b>[</b><tt>:</tt><i>mm</i><b>[</b><tt>:</tt><i>ss</i><b>]]
|
|
</b>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>The minutes ( <i>mm</i>) and seconds ( <i>ss</i>) are optional. The hour ( <i>hh</i>) shall be required and may be a single
|
|
digit. The <i>offset</i> following <i>std</i> shall be required. If no <i>offset</i> follows <i>dst</i>, the alternative time is
|
|
assumed to be one hour ahead of standard time. One or more digits may be used; the value is always interpreted as a decimal number.
|
|
The hour shall be between zero and 24, and the minutes (and seconds)-if present-between zero and 59. The result of using values
|
|
outside of this range is unspecified. If preceded by a <tt>'-'</tt> , the timezone shall be east of the Prime Meridian; otherwise,
|
|
it shall be west (which may be indicated by an optional preceding <tt>'+'</tt> ).</p>
|
|
</dd>
|
|
|
|
<dt><i>rule</i></dt>
|
|
|
|
<dd>Indicates when to change to and back from the alternative time. The <i>rule</i> has the form:
|
|
|
|
<blockquote>
|
|
<pre>
|
|
<i>date</i><b>[</b><tt>/</tt><i>time</i><b>]</b><tt>,</tt><i>date</i><b>[</b><tt>/</tt><i>time</i><b>]
|
|
</b>
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>where the first <i>date</i> describes when the change from standard to alternative time occurs and the second <i>date</i>
|
|
describes when the change back happens. Each <i>time</i> field describes when, in current local time, the change to the other time
|
|
is made.</p>
|
|
|
|
<p>The format of <i>date</i> is one of the following:</p>
|
|
|
|
<dl compact>
|
|
<dt>J<i>n</i></dt>
|
|
|
|
<dd>The Julian day <i>n</i> (1 <= <i>n</i> <= 365). Leap days shall not be counted. That is, in all years-including leap
|
|
years-February 28 is day 59 and March 1 is day 60. It is impossible to refer explicitly to the occasional February 29.</dd>
|
|
|
|
<dt><i>n</i></dt>
|
|
|
|
<dd>The zero-based Julian day (0 <= <i>n</i> <= 365). Leap days shall be counted, and it is possible to refer to February
|
|
29.</dd>
|
|
|
|
<dt>M<i>m</i>.<i>n</i>.<i>d</i></dt>
|
|
|
|
<dd>The <i>d</i>'th day (0 <= <i>d</i> <= 6) of week <i>n</i> of month <i>m</i> of the year (1 <= <i>n</i> <= 5, 1
|
|
<= <i>m</i> <= 12, where week 5 means "the last <i>d</i> day in month <i>m</i>" which may occur in either the fourth or the
|
|
fifth week). Week 1 is the first week in which the <i>d</i>'th day occurs. Day zero is Sunday.</dd>
|
|
</dl>
|
|
|
|
<p>The <i>time</i> has the same format as <i>offset</i> except that no leading sign ( <tt>'-'</tt> or <tt>'+'</tt> ) is allowed.
|
|
The default, if <i>time</i> is not given, shall be 02:00:00.</p>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|