Blob


1 .TH GETENV 3
2 .SH NAME
3 getenv, putenv \- access environment variables
4 .SH SYNOPSIS
5 .B #include <u.h>
6 .br
7 .B #include <libc.h>
8 .PP
9 .nf
10 .B
11 char* getenv(char *name)
12 .br
13 .B
14 int putenv(char *name, char *val)
15 .fi
16 .SH DESCRIPTION
17 .I Getenv
18 fetches the environment value associated with
19 .I name
20 into memory allocated with
21 .MR malloc (3) ,
22 0-terminates it,
23 and returns a pointer to that area.
24 If no file exists, 0
25 is returned.
26 .PP
27 .I Putenv
28 sets the environment value associated with
29 .I name
30 to
31 .IR val .
32 .SH SOURCE
33 .B \*9/src/lib9/getenv.c
34 .SH DIAGNOSTICS
35 Sets
36 .IR errstr .
37 .SH BUGS
38 To avoid name conflicts with the underlying system,
39 .I getenv
40 and
41 .I putenv
42 are preprocessor macros defined as
43 .I p9getenv
44 and
45 .IR p9putenv ;
46 see
47 .MR intro (3) .