Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > E

environ(5)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

environ — user environment

DESCRIPTION

An array of strings called the environment is made available by exec(2) when a process begins. By convention, these strings have the form name=value. The following names are used by various commands (listed in alphabetical order):

HOME

Name of the user's login directory, set by login(1) from the password file (see passwd(4)).

LANG

Identifies the user's requirements for native language, local customs and coded character set, if the environment variables LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, and LC_TIME are unset or null.

The format of LANG is:

LANG=language[_territory][.codeset]

The valid values for LANG are supported locales. (See lang(5).) Native Language Support (NLS) is initiated at run-time by calling setlocale(3C). The following call to setlocale() binds the execution of a program to the user's language requirements:

setlocale(LC_ALL,"");

This setlocale() call initializes the program locale from the environment variables associated with setlocale(). LANG provides the necessary defaults if any of the category-specific environment variables are not set or set to the empty string.

The LANG environment variable can have a maximum length of SL_NAME_SIZE bytes (see header file <locale.h>).

LANGOPTS

Defines language options for mode and data order in the form:

LANGOPTS=[mode][_order]

LANGOPTS values are given in English as an ASCII character string. mode describes the mode of a file where l (ell) represents Latin mode and n represents non-Latin mode. Non-Latin mode is assumed for values other than l and n. order describes the data order of a file where k is keyboard order and s is screen order.

LC_ALL

Determines the values for all locale categories. The value of LC_ALL has precedence over any of the other environment variables LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME, and LANG.

LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, and LC_TIME

Determines the user's requirements for language, territory, and codeset with respect to character collation, character classification and conversion, output messages, currency symbol and monetary value format, numeric data presentation, and time formats, respectively. If LC_ALL and any of these are not defined in the environment, LANG provides the defaults.

Syntax for the environment variables LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, and LC_TIME is:

language[_territory][.codeset][@modifier]

The language field conforms with ISO 639 standard for language names and the territory field conforms with the ISO 3166 territory names. For a list of the locale names, see lang(5).

The @modifier field allows the user to select between more than one value of a category within the same language definition. HP-UX does not currently provide locales with modifiers.

The values of the locale categories are determined by a precedence order; the first condition met below determines the value:

1.

If the LC_ALL environment variable is defined and is not null, the value of LC_ALL is used.

2.

If the LC_* environment variable (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) is defined and is not null, the value of the environment variable is used to initialize the category that corresponds to the environment variable.

3.

If the LANG environment variable is defined and is not null, the value of the LANG environment variable is used.

4.

If the LANG environment variable is not set or is set to the empty string, the POSIX/C default locale is used. (See lang(5).)

LC_COLLATE

Determines 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 strcoll(3C) and strxfrm(3C) (see string(3C)).

LC_CTYPE

Determines the locale category for character classification (such as alphabetic, digit, upper-case.) See isalpha(3C), isdigit(3C), and isupper(3C), character conversion in ctype(3C). See toupper(3C), tolower(3C), and the interpretation of text as single-byte or multi-byte characters in conv(3C).

LC_MESSAGES

Determines the locale category for processing affirmative and negative responses and the language and cultural conventions in which diagnostic and informative messages should be written. It may also affect the behavior of catopen(3C) in determining the message catalog to open.

LC_MONETARY

Determines the locale category for monetary-related numeric formatting information.

LC_NUMERIC

Determines the locale category for numeric formatting information (such as the thousands separator and the radix character) in various utilities as well as the formatted I/O operations in printf(3S) and scanf(3S) and the string conversion functions in strtod(3C).

LC_TIME

Determines the locale category for date and time formatting information. It affects the behavior of time functions in strftime(3C).

MANPATH

Contains a colon-separated list of directory prefixes to be searched by man(1) for manual entries. Upon logging in, /etc/profile (or /etc/csh.login) sets MANPATH=/usr/share/man:/usr/contrib/man:usr/local/man. If the file /etc/MANPATH exists, the default settings are taken from this file.

MANPATH uses the same syntax as the PATH environment variable, with the addition of recognizing the specifiers %L, %l, %t, and %c as used in the NLSPATH environment variable. See NLSPATH below for a description of these specifiers. This provides a way to specify paths to locale-specific manual entries.

It is assumed that each of the prefixes given in MANPATH contain subdirectories of the form man*, man*.Z, cat* and cat*.Z. (See man(1), catman(1M), and fixman(1M).)

NLSPATH

Contains a sequence of pseudo-pathnames used by catopen(3C) when attempting to locate message catalogs. Each pseudo-pathname contains a name template consisting of an optional path prefix, one or more substitution field descriptors, a file name and an optional file name suffix. For example:

NLSPATH="/system/nlslib/%N.cat"

defines that catopen(3C) should look for all message catalogs in the directory /system/nlslib , where the catalog name should be constructed from the name parameter passed to catopen (3C) (%N) with the suffix .cat.

Field descriptors consist of a % followed by a single character. Field descriptors and their substitution values are:

%N

The value of the name parameter passed to catopen(3C).

%L

The value of LC_MESSAGES.

%l

The language element from LC_MESSAGES.

%t

The territory element from LC_MESSAGES.

%c

The codeset element from LC_MESSAGES.

%%

Replaced by a single %.

For example, given:

NLSPATH="/system/nlslib/%L/%N.cat"

catopen(3C) attempts to open the file /system/nlslib/$LC_MESSAGES/name.cat as a message catalog.

A null string is substituted if the specified value is not defined. Separators are not included in %t and %c substitutions. Note that a default value is not supplied for %L. If LC_MESSAGES is not set and NLSPATH had the value in the previous example, catopen(3C) would attempt to open the file /system/nlslib/name.cat as a message catalog.

Path names defined in NLSPATH are separated by colons (:). A leading colon or two adjacent colons (::) is equivalent to specifying %N. For example, given:

NLSPATH=":%N.cat:/nlslib/%L/%N.cat"

catopen(3C) with the oflag parameter set to NL_CAT_LOCALE will attempt to open the following files in the indicated order: ./name, ./name.cat, and /nlslib/$LC_MESSAGES/name.cat. The first file successfully opened is taken as the message catalog.

A default pseudo-pathname defined by the system is effectively appended to NLSPATH and used by catopen(3C) whenever a message catalog cannot be opened in any of the user defined pseudo-pathnames. This system-wide default path is:

/usr/lib/nls/msg/%L/%N.cat:/usr/lib/nls/%l/%t/%c/%N.cat

If catopen(3C) is invoked from a setuid or setgid application with owner root, the environment variable NLSPATH is not used. Instead the system file /etc/default/nlspath is used to locate the message catalogs. See nlspath(4) for details.

PAGER

PAGER indicates the paginator through which output from certain commands is piped. Its value must be a string specifying the complete command line of the desired paginator. Two examples are:

PAGER="more -cs" PAGER="pg -c"

PAGER affects several commands, including man(1) and the interactive mailers. Some of the affected commands provide alternate means of selecting a pager in case there is a conflict. See the individual manual entries for details.

PATH

PATH indicates the sequence of directory prefixes that sh(1), time(1), nice(1), nohup(1), and others search when looking for a file known by an incomplete path name. Prefixes are separated by colons (:). The login(1) command sets PATH/usr/bin.

TERM

TERM identifies the kind of terminal for which output is to be prepared. This information is used by commands such as vi(1) and mm(1), which can exploit special capabilities of that terminal.

TZ

TZ sets time zone information. TZ can be set using the format:

[:]STDoffset[DST[offset][,rule]]

where:

STD and DST

Three or more bytes that designate the standard time zone (STD) and summer (or daylight-savings) time zone (DST). STD is required. If DST is not specified, summer time does not apply in this locale. Each of these fields may occur in either of two formats quoted or unquoted.

In the quoted form, the first character shall be the less-than (<) character and the last character shall be the greater-than (>) character. All characters between these quoting characters shall be alphanumeric characters from the portable character set in the current locale, the plus-sign (+) character, or the minus-sign (-) character. The STD and DST fields in this case shall not include the quoting characters.

In the unquoted form, any characters other than digits, comma (,), minus (-), plus (+), or ASCII NUL are allowed.

offset

offset is the value that must be added to local time to arrive at Coordinated Universal Time (UTC). Offset is of the form :

hh[:mm[:ss]]

Hour (hh) is any value from 0 through 23. The optional minutes (mm) and seconds (ss) fields are a value from 0 through 59. The hour field is required. If offset is preceded by a -, the time zone is east of the Prime Meridian. A + preceding offset indicates that the time zone is west of the Prime Meridian. The default case is west of the Prime Meridian.

rule

rule indicates when to change to and from summer (daylight-savings) time. The rule has the form :

date/time,date/time

where the first date/time specifies when to change from standard to summer time, and the second date/time specifies when to change back. The time field is expressed in current local time.

The form of date should be one of the following :

Jn

Julian day n (1 through 365). Leap days are not counted. February 29 cannot be referenced.

n

The zero-based Julian day (0 through 365). Leap days are counted. February 29 can be referenced.

Mm.n.d

The d day (0 through 6) of week n (1 through 5) of month m (1 through 12) of the year. Week 5 refers to the last day d of month m. Week 1 is the week in which the first day of the month falls. Day 0 is Sunday.

time

Time has the same format as offset except that no leading sign (- or +) is allowed. The default, if time is not given, is 02:00:00.

While the STD field and the offset field for STD must be specified, if the DST field is also provided, the system will supply default values for other fields not specified. These default values come from file /usr/lib/tztab (see tztab(4)), and, in general, reflect the various historical dates for start and end of summer time.

Additional names may be placed in the environment by the export command and name=value arguments in sh(1), or by exec(2). It is unwise to add names that conflict with the following shell variables frequently exported by .profile files: MAIL, PS1, PS2 and IFS.

The environment of a process is accessible from C by using the global variable:

  • #include <unistd.h>

    extern char **environ;

which points to an array of pointers to the strings that comprise the environment. The array is terminated by a null pointer.

Notes

Coordinated Universal Time (UTC) is equivalent to Greenwich Mean Time (GMT).

EXTERNAL INFLUENCES

International Code Set Support

The LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME, and NLSPATH environment variables provide support for internationalized applications. The standard utilities make use of these environment variables as described here and in the individual Environment Variables subsection of the utilities.

If these variables specify locale categories that are not based upon the same underlying codeset, the results are unspecified, and the behavior of regular expressions APIs', such as, regcomp, glob, and fnmatch may be affected.

WARNINGS

Some HP-UX commands and library routines do not use the LANG, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, or LANGOPTS environment variables. Some commands do not use message catalogs, so NLSPATH does not affect their behavior. See the EXTERNAL INFLUENCES section of specific commands and library routines for implementation details.

AUTHOR

environ was developed by AT&T and HP.

STANDARDS CONFORMANCE

environ: AES, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.