Cygwin: Implement the GNU extension clearenv

This commit is contained in:
Ken Brown
2018-06-06 11:45:56 -04:00
committed by Corinna Vinschen
parent 9234545e3d
commit defaa2ca31
3 changed files with 24 additions and 0 deletions

View File

@ -720,6 +720,26 @@ unsetenv (const char *name)
return -1;
}
/* Clear the environment. */
extern "C" int
clearenv (void)
{
__try
{
if (cur_environ () == lastenviron)
{
free (lastenviron);
lastenviron = NULL;
}
__cygwin_environ = NULL;
update_envptrs ();
return 0;
}
__except (EFAULT) {}
__endtry
return -1;
}
/* Minimal list of Windows vars which must be converted to uppercase.
Either for POSIX compatibility of for backward compatibility with
existing applications. */