2004-04-10 18:53:55 +00:00
|
|
|
.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
|
2005-01-03 06:40:20 +00:00
|
|
|
fetches the environment value associated with
|
|
|
|
.I name
|
2004-04-10 18:53:55 +00:00
|
|
|
into memory allocated with
|
2020-08-16 00:07:38 +00:00
|
|
|
.MR malloc (3) ,
|
2004-04-10 18:53:55 +00:00
|
|
|
0-terminates it,
|
|
|
|
and returns a pointer to that area.
|
|
|
|
If no file exists, 0
|
|
|
|
is returned.
|
|
|
|
.PP
|
|
|
|
.I Putenv
|
2005-01-03 06:40:20 +00:00
|
|
|
sets the environment value associated with
|
|
|
|
.I name
|
|
|
|
to
|
|
|
|
.IR val .
|
2004-04-10 18:53:55 +00:00
|
|
|
.SH SOURCE
|
2005-01-11 17:37:33 +00:00
|
|
|
.B \*9/src/lib9/getenv.c
|
2004-04-10 18:53:55 +00:00
|
|
|
.SH DIAGNOSTICS
|
|
|
|
Sets
|
|
|
|
.IR errstr .
|
2005-01-03 06:40:20 +00:00
|
|
|
.SH BUGS
|
2005-01-13 04:49:19 +00:00
|
|
|
To avoid name conflicts with the underlying system,
|
|
|
|
.I getenv
|
|
|
|
and
|
|
|
|
.I putenv
|
|
|
|
are preprocessor macros defined as
|
2005-01-03 06:40:20 +00:00
|
|
|
.I p9getenv
|
|
|
|
and
|
2005-01-13 04:49:19 +00:00
|
|
|
.IR p9putenv ;
|
|
|
|
see
|
2020-08-16 00:07:38 +00:00
|
|
|
.MR intro (3) .
|