1getenv(3C)               Standard C Library Functions               getenv(3C)
2
3
4

NAME

6       getenv - return value for environment name
7

SYNOPSIS

9       #include <stdlib.h>
10
11       char *getenv(const char *name);
12
13

DESCRIPTION

15       The  getenv()  function  searches the environment list (see environ(5))
16       for a string of the form name=value and,  if  the  string  is  present,
17       returns a pointer to the value in the current environment.
18

RETURN VALUES

20       If  successful,  getenv() returns a pointer to the value in the current
21       environment; otherwise, it returns a null pointer.
22

USAGE

24       The getenv() function can be safely called from a multithreaded  appli‐
25       cation.    Care   must  be  exercised  when  using  both  getenv()  and
26       putenv(3C) in a multithreaded application.  These functions examine and
27       modify  the  environment  list,  which  is  shared by all threads in an
28       application.  The system prevents the list from being accessed simulta‐
29       neously  by  two  different threads.  It does not, however, prevent two
30       threads  from  successively  accessing  the  environment   list   using
31       getenv() or putenv(3C).
32

ATTRIBUTES

34       See attributes(5) for descriptions of the following attributes:
35
36
37
38
39       ┌─────────────────────────────┬─────────────────────────────┐
40       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
41       ├─────────────────────────────┼─────────────────────────────┤
42       │Interface Stability          │Standard                     │
43       ├─────────────────────────────┼─────────────────────────────┤
44       │MT-Level                     │Safe                         │
45       └─────────────────────────────┴─────────────────────────────┘
46

SEE ALSO

48       exec(2), putenv(3C), attributes(5), environ(5), standards(5)
49
50
51
52SunOS 5.11                        24 Jul 2002                       getenv(3C)
Impressum