mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibC: stdlib: Add clearenv() function
This commit is contained in:
parent
3436317c08
commit
853664bd3c
Notes:
sideshowbarker
2024-07-19 00:46:36 +09:00
Author: https://github.com/bcoles
Commit: 853664bd3c
Pull-request: https://github.com/SerenityOS/serenity/pull/4439
4 changed files with 46 additions and 1 deletions
|
@ -289,6 +289,16 @@ int unsetenv(const char* name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int clearenv()
|
||||
{
|
||||
size_t environ_size = 0;
|
||||
for (; environ[environ_size]; ++environ_size) {
|
||||
environ[environ_size] = NULL;
|
||||
}
|
||||
*environ = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setenv(const char* name, const char* value, int overwrite)
|
||||
{
|
||||
if (!overwrite && getenv(name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue