Searches the environment array for the current process and returns
the value associated with a specified environment name.
Format
#include <stdlib.h>
char *getenv (const char *name);
Argument
- name
- One of the following values:
- HOME-Your login directory
- TERM-The type of terminal being used
- PATH-The default device and directory
- USER-The name of the user who initiated the process
- Logical name or CLI symbolic name
- An environment variable set with setenv or putenv.
Description
In certain situations, this function attempts to perform a
logical name translation on the user-specified argument:
- If the argument to getenv does not match any of the
environment strings present in your environment array, getenv
attempts to translate your argument as a logical name by
searching the logical name tables indicated by the LNM$FILE_DEV
logical, as is done for file processing.
getenv first does a case-sensitive lookup. If that fails, it does
a case-insensitive lookup. In most instances, logical names are
defined in uppercase, but getenv can also find logical names that
include lowercase letters.
- If no logical name exists, getenv attempts to translate
the argument string as a command-language interpreter (CLI)
symbol. If it succeeds, it returns the translated symbol text.
If it fails, the return value is NULL.
If your CLI is the DEC/Shell, the function does not attempt a
logical name translation since Shell environment symbols are
implemented as DCL symbols.
Return Values
x | Pointer to an array containing
the translated symbol. |
NULL |
Indicates that the translation failed. |
Previous Page | Next Page | Table of Contents | Index