File:  [MW Coherent from dump] / coherent / a / usr / man / MULTI / getenv
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent



getenv()                 General Function                getenv()




Read environmental variable

cchhaarr *ggeetteennvv(_V_A_R_I_A_B_L_E) cchhaarr *_V_A_R_I_A_B_L_E;

A program  may read variables from  its environment.  This allows
the program  to accept information  that is specific  to it.  The
environment consists of an array of strings, each having the form
VARIABLE=VALUE.   When called  with the  string  VARIABLE, getenv
reads the environment, and returns a pointer to the string VALUE.

***** Example *****

This example prints the environmental variable PATH.


#include <stdio.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);
}


***** See Also *****

environmental variables, envp, exec, sh

***** Diagnostics *****

When VARIABLE is not found or has no value, getenv returns NULL.

















COHERENT Lexicon                                           Page 1



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.