aboutsummaryrefslogtreecommitdiff
path: root/man/man3/getenv.3
blob: 15ad6f3e71e2a0102f8b4be74e59990cefea88b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
.TH GETENV 3
.SH NAME
getenv, putenv \- access environment variables
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.nf
.B
char* getenv(char *name)
.br
.B
int   putenv(char *name, char *val)
.fi
.SH DESCRIPTION
.I Getenv
reads the contents of
.BI /env/ name
(see
.IR env (3))
into memory allocated with
.IR malloc (3),
0-terminates it,
and returns a pointer to that area.
If no file exists, 0
is returned.
.PP
.I Putenv
creates the file
.BI /env/ name
and writes the string
.I val
to it.  The terminating
.B 0
is not written.
If the file value cannot be written, \-1 is returned.
.SH SOURCE
.B /sys/src/libc/9sys
.SH SEE ALSO
.IR env (3)
.SH DIAGNOSTICS
Sets
.IR errstr .