ggeetteennvv() -- General Function (libc)

Read environmental variable
#iinncclluuddee <ssttddlliibb.hh>
cchhaarr *ggeetteennvv(_V_A_R_I_A_B_L_E) cchhaarr *_V_A_R_I_A_B_L_E;

A program may read variables  from its _e_n_v_i_r_o_n_m_e_n_t. This allows the program
to accept information that is  specific to it.  The environment consists of
an array of strings, each  having the form _V_A_R_I_A_B_L_E=_V_A_L_U_E. When called with
the string _V_A_R_I_A_B_L_E, ggeetteennvv()  reads the environment, and returns a pointer
to the string _V_A_L_U_E.

_E_x_a_m_p_l_e
This example prints the environmental variable PPAATTHH.

#include <stdio.h>
#include <stdlib.h>

main()
{
    char *env;
    extern char *getenv();

    if ((env = getenv("PATH")) == NULL) {
        printf("Sorry, cannot find PATH\n");
        exit(1);
    }
    printf("PATH = %s\n", env);
}

_S_e_e _A_l_s_o
eennvviirroonnmmeennttaall vvaarriiaabblleess, eennvvpp, eexxeecc, lliibbcc, ppuutteennvv(), sshh, ssttddlliibb.hh
ANSI Standard, section 7.10.4.4
POSIX Standard, section 4.6.1

_D_i_a_g_n_o_s_t_i_c_s
When _V_A_R_I_A_B_L_E is not found or has no value, ggeetteennvv() returns NULL.
