Make putenv and getenv match the userland definition of these

functions, tweak man page and one variable that shouldn't be const
anymore.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-12-06 02:00:00 +00:00
parent db357f584a
commit e8e6a5f920
7 changed files with 8 additions and 8 deletions

View File

@ -162,7 +162,7 @@ setenv(const char *name, const char *value, int overwrite)
}
int
putenv(const char *string)
putenv(char *string)
{
char *value, *copy;
int result;

View File

@ -110,7 +110,7 @@ for set/unset hook functions.
.Xc
.It Xo
.Ft int
.Fn putenv "const char *string"
.Fn putenv "char *string"
.Xc
.It Xo
.Ft int

View File

@ -330,7 +330,7 @@ extern int env_setenv(const char *name, int flags,
extern char *getenv(const char *name);
extern int setenv(const char *name, const char *value,
int overwrite);
extern int putenv(const char *string);
extern int putenv(char *string);
extern int unsetenv(const char *name);
extern ev_sethook_t env_noset; /* refuse set operation */

View File

@ -367,10 +367,10 @@ test_getmem(void *arg, uint64_t *lowmem, uint64_t *highmem)
*highmem = 0;
}
const char *
char *
test_getenv(void *arg, int idx)
{
static const char *vars[] = {
static char *vars[] = {
"foo=bar",
"bar=barbar",
NULL

View File

@ -202,7 +202,7 @@ struct loader_callbacks {
* environment variable to return next. It will begin at 0 and
* each invocation will add 1 to the previous value of 'num'.
*/
const char * (*getenv)(void *arg, int num);
char * (*getenv)(void *arg, int num);
/*
* Version 4 additions.

View File

@ -78,7 +78,7 @@ void
loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks)
{
static char mallocbuf[MALLOCSZ];
const char *var;
char *var;
int i;
if (version < USERBOOT_VERSION)

View File

@ -529,7 +529,7 @@ addenv(const char *str)
SLIST_INSERT_HEAD(&envhead, env, next);
}
static const char *
static char *
cb_getenv(void *arg, int num)
{
int i;