Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

env(1)

login(1)

sh(1)

exec(2)

catopen(3C)

ctime(3C)

getenv(3C)

nl_init(3C)

profile(4)

lang(5)

term(5)

tztab(4)

environ(5)

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)).

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_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, and LC_TIME
Internationalization environment variables corresponding to setlocale categories of the same name.  They define the user’s requirements for language, territory, and codeset with respect to character collation, character classification and conversion, currency symbol and monetary value format, numeric data presentation, and time formats, respectively.  If any of these are not defined in the environment, LANG provides the defaults. 

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

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

The @modifier field allows the user to select between more than one value of a category within the same language definition.  For example, to interact with the system in Dutch, but sort German files, the following environment variables must be set in the environment :

LANG=dutch
LC_COLLATE=german

The example could be extended to select "unfolded" collation (see hpnls(5)) by use of the @modifier field :

LC_COLLATE=german@nofold

At run-time, these values are bound to a program’s locale by the setlocale() function. See nlsinfo(1) for a list of valid modifiers associated with each available language.

The modifier component of the internationalization environment variables can be a maximum of MOD_NAME_SIZE bytes.  The remainder of each environment variable can be up to LC_NAME_SIZE bytes in length (see <locale.h>). 

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/man:/usr/contrib/man:usr/local/man. 

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(1)).

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, given:

NLSPATH="/system/nlslib/msg.cat"

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

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 LANG. 

%l The language element from LANG. 

%t The territory element from LANG. 

%c The codeset element from LANG. 

%% Replaced by a single %. 

For example, given:

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

catopen(3C) attempts to open the file /system/nlslib/$LANG/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 LANG 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) will attempt to open the following files in the indicated order: ./name, ./name.cat, and /nlslib/$LANG/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/%l/%t/%c/%N.cat

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 (:).  Login(1) sets PATH=:/bin:/usr/bin. 

LANG The internationalization environment variable LANG identifies the user’s requirements for native language, local customs and coded character set, in the form:

LANG=language[_territory][.codeset]

Values of LANG are given in English as an ASCII character string and should be a supported language name (see lang(5)). Native Language Support (NLS) operation 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.  In addition, data exists which belongs only to the LC_ALL category; it will always be initialized by LANG. 

The LANG environment variable is also used to locate message catalogues.  See NLSPATH below. 

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

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.  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:

char ∗∗environ;

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

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. 

NOTES

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

AUTHOR

Environ was developed by AT&T and HP. 

SEE ALSO

env(1), login(1), sh(1), exec(2), catopen(3C), ctime(3C), getenv(3C), nl_init(3C), profile(4), lang(5), term(5), tztab(4). 

STANDARDS CONFORMANCE

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

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026