OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man3 / getenv.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .\" References consulted:
25 .\"     Linux libc source code
26 .\"     Lewine's "POSIX Programmer's Guide" (O'Reilly & Associates, 1991)
27 .\"     386BSD man pages
28 .\" Modified Sat Jul 24 19:30:29 1993 by Rik Faith (faith@cs.unc.edu)
29 .\" Modified Fri Feb 14 21:47:50 1997 by Andries Brouwer (aeb@cwi.nl)
30 .\"
31 .TH GETENV 3  2008-03-17 "GNU" "Linux Programmer's Manual"
32 .SH NAME
33 getenv \- get an environment variable
34 .SH SYNOPSIS
35 .nf
36 .B #include <stdlib.h>
37 .sp
38 .BI "char *getenv(const char *" name );
39 .fi
40 .SH DESCRIPTION
41 The
42 .BR getenv ()
43 function searches the environment list to find the
44 environment variable
45 .IR name ,
46 and returns a pointer to the corresponding
47 .I value
48 string.
49 .SH "RETURN VALUE"
50 The
51 .BR getenv ()
52 function returns a pointer to the value in the
53 environment, or NULL if there is no match.
54 .SH "CONFORMING TO"
55 SVr4, POSIX.1-2001, 4.3BSD, C89, C99.
56 .SH NOTES
57 The strings in the environment list are of the form \fIname=value\fP.
58
59 As typically implemented,
60 .BR getenv ()
61 returns a pointer to a string within the environment list.
62 The caller must take care not to modify this string,
63 since that would change the environment of the process.
64
65 The implementation of
66 .BR getenv ()
67 is not required to be reentrant.
68 The string pointed to by the return value of
69 .BR getenv ()
70 may be statically allocated,
71 and can be modified by a subsequent call to
72 .BR getenv (),
73 .BR putenv (3),
74 .BR setenv (3),
75 or
76 .BR unsetenv (3).
77 .SH "SEE ALSO"
78 .BR clearenv (3),
79 .BR putenv (3),
80 .BR setenv (3),
81 .BR unsetenv (3),
82 .BR environ (7)