1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

LibC: Add setenv().

If I'm understanding the standard C library correctly, setenv() copies while
putenv() does not. That's really confusing and putenv() basically sucks.
To know which environment variables to free on replacement and which ones to
leave alone, we keep track of the ones malloced by setenv in a side table.

This patch also moves Shell to using setenv() instead of putenv().

Fixes #29.
This commit is contained in:
Andreas Kling 2019-05-30 02:51:15 +02:00
parent d31ce9eccd
commit 96db775ac1
3 changed files with 27 additions and 10 deletions

View file

@ -18,6 +18,7 @@ void* realloc(void* ptr, size_t);
char* getenv(const char* name);
int putenv(char*);
int unsetenv(const char*);
int setenv(const char* name, const char* value, int overwrite);
int atoi(const char*);
long atol(const char*);
long long atoll(const char*);