standards.5 (2010 09)
s
standards(5) standards(5)
NAME
standards - UNIX standards behavior on HP-UX
DESCRIPTION
HP-UX conforms to various UNIX standards. In some cases, these standards conflict. This manpage
describes the methods that programmers and users must follow to have an application conform and exe-
cute according to a particular UNIX standard.
UNIX Standard Conformant Programmer Environment
The following table lists feature test macros and environment variables that must be defined while com-
piling an application. Both a feature test macro and an environment variable must be defined while com-
piling the application so that the application conforms and executes according to a particular UNIX stan-
dard. Otherwise, the behavior is undefined.
Standard Feature Test Macros to be Environment variable
defined during compilation to be set
UNIX 95 _XOPEN_SOURCE_EXTENDED=1 UNIX95 or
UNIX_STD=95 or
UNIX_STD=1995
UNIX 2003 _XOPEN_SOURCE=600 UNIX_STD=2003
The compiler uses the feature test macros to obtain the appropriate namespace from the header files.
The compiler uses the environment variable to link in an appropriate object file to the executable. Using
the environment variable customizes libc to match UNIX standards for various functions.
If an application has already been compiled for default HP-UX behavior or for one particular standard,
and needs to change to a particular UNIX standard behavior, recompile the application as specified in the
above table.
For an HP-UX command to conform to a particular UNIX standard behavior, the application has to set
the corresponding environment variable as specified in the above table before executing that command.
UNIX Standard Conformant User Environment
To enable a particular UNIX standard conformant user environment, set the corresponding environment
variable as defined in the above table.
EXAMPLES
The following examples shows an application example. To have the system be conformant to UNIX2003
behavior, set the
UNIX_STD environment variable to 2003 and define the _XOPEN_SOURCE=600
feature test macro before compilation.
$ export UNIX_STD=2003
$ c99 -D_XOPEN_SOURCE=600 foo.c
The following example changes the ls command to have UNIX95 behavior by setting one of the environ-
ment variables to UNIX95 or to UNIX_STD=95 before executing that command. There are three ways of
setting the environment variable for UNIX95:
$ export UNIX95=1
$lsoptions
or
$ export UNIX_STD=95
$lsoptions
or
$ export UNIX_STD=1995
$lsoptions
SEE ALSO
cc(1), stdsyms(5).
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1