Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (g - i) getenv_r(3)
NAME
getenv_r - Returns the value of an environment variable
LIBRARY
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stlib.h>
int getenv_r(
const char *name,
char *buffer,
size_t buflen
);
PARAMETERS
name Specifies the name of an environment variable.
buffer Points to the buffer supplied where the value associated with name is stored.
buflen Specifies the size of the buffer passed in bytes.
DESCRIPTION
The getenv_r( ) function searches the environment list for a string of the form name = value.If
a string whose portion preceding the "=" character matches name is present, the value portion is
copied into the buffer. If no such string is present, or its size (including the terminating null char-
acter) exceeds the size of the buffer, no copy occurs. Note that all characters comprising the
string name participate in the search.
Use From the Guardian Environment
In Guardian processes, the environment list always contains the following four run-time parame-
ters:
STDIN Specifies the filename of the standard input file.
STDOUT Specifies the filename of the standard output file.
STDERR Specifies the filename of the standard error file.
DEFAULTS Specifies the default volume and subvolume names used to qualify partial
filenames.
RETURN VALUES
The getenv_r( ) function returns the value 0 (zero) if a value is copied into the buffer; otherwise,
the value -1 is returned.
RELATED INFORMATION
Functions: getenv(3), putenv(3).
Miscellaneous: environ(5).
STANDARDS CONFORMANCE
Interfaces documented on this reference page conform to the following industry standards:
• IEEE Std 1003.1-2004, POSIX System Application Program Interface
527192-018 Hewlett-Packard Company 3−23