posix: env: create z_getenv()..z_setenv() convenience functions
To facilitate adding putenv in a separate compilation unit, make z_getenv(), z_getenv_r(), z_setenv(), and z_unsetenv() convenience functions. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
ebfc7db380
commit
4137c489d8
1 changed files with 20 additions and 4 deletions
|
@ -64,7 +64,7 @@ static int findenv(const char *name, size_t namelen)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
char *getenv(const char *name)
|
||||
char *z_getenv(const char *name)
|
||||
{
|
||||
int ret;
|
||||
size_t nsize;
|
||||
|
@ -83,8 +83,12 @@ char *getenv(const char *name)
|
|||
|
||||
return val;
|
||||
}
|
||||
char *getenv(const char *name)
|
||||
{
|
||||
return z_getenv(name);
|
||||
}
|
||||
|
||||
int getenv_r(const char *name, char *buf, size_t len)
|
||||
int z_getenv_r(const char *name, char *buf, size_t len)
|
||||
{
|
||||
int ret = 0;
|
||||
size_t vsize;
|
||||
|
@ -117,8 +121,12 @@ int getenv_r(const char *name, char *buf, size_t len)
|
|||
|
||||
return ret;
|
||||
}
|
||||
int getenv_r(const char *name, char *buf, size_t len)
|
||||
{
|
||||
return z_getenv_r(name, buf, len);
|
||||
}
|
||||
|
||||
int setenv(const char *name, const char *val, int overwrite)
|
||||
int z_setenv(const char *name, const char *val, int overwrite)
|
||||
{
|
||||
int ret = 0;
|
||||
char *env;
|
||||
|
@ -203,8 +211,12 @@ int setenv(const char *name, const char *val, int overwrite)
|
|||
|
||||
return ret;
|
||||
}
|
||||
int setenv(const char *name, const char *val, int overwrite)
|
||||
{
|
||||
return z_setenv(name, val, overwrite);
|
||||
}
|
||||
|
||||
int unsetenv(const char *name)
|
||||
int z_unsetenv(const char *name)
|
||||
{
|
||||
int ret = 0;
|
||||
char **envp;
|
||||
|
@ -265,3 +277,7 @@ int unsetenv(const char *name)
|
|||
|
||||
return ret;
|
||||
}
|
||||
int unsetenv(const char *name)
|
||||
{
|
||||
return z_unsetenv(name);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue