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

@ -306,6 +306,7 @@ cimag NOSIGFE
cimagf NOSIGFE cimagf NOSIGFE
cimagl NOSIGFE cimagl NOSIGFE
cleanup_glue NOSIGFE cleanup_glue NOSIGFE
clearenv SIGFE
clearerr SIGFE clearerr SIGFE
clearerr_unlocked SIGFE clearerr_unlocked SIGFE
clock SIGFE clock SIGFE

View File

@ -720,6 +720,26 @@ unsetenv (const char *name)
return -1; 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. /* Minimal list of Windows vars which must be converted to uppercase.
Either for POSIX compatibility of for backward compatibility with Either for POSIX compatibility of for backward compatibility with
existing applications. */ existing applications. */

View File

@ -26,6 +26,9 @@ char *canonicalize_file_name (const char *);
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112
int unsetenv (const char *); int unsetenv (const char *);
#endif #endif
#if __MISC_VISIBLE
int clearenv (void);
#endif
#if __XSI_VISIBLE #if __XSI_VISIBLE
char *ptsname (int); char *ptsname (int);
int grantpt (int); int grantpt (int);