It's in POSIX.1-2001 and available on all modern systems.
dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
- strcasecmp stricmp vsyslog writev pread uname unsetenv \
+ strcasecmp stricmp vsyslog writev pread uname \
setrlimit setproctitle seteuid setreuid setegid setresgid \
getmntinfo setpriority quotactl getmntent kqueue kevent \
backtrace_symbols walkcontext dirfd clearenv \
DOVECOT_SENDFILE
-DOVECOT_UNSETENV_RET_INT
-
DOVECOT_CRYPT_XPG6
DOVECOT_CRYPT
+++ /dev/null
-AC_DEFUN([DOVECOT_UNSETENV_RET_INT], [
- AC_CACHE_CHECK([if unsetenv returns int],i_cv_unsetenv_ret_int,[
- AC_TRY_COMPILE([
- #include <stdlib.h>
- ], [
- if (unsetenv("env") < 0) { }
- ], [
- i_cv_unsetenv_ret_int=yes
- ], [
- i_cv_unsetenv_ret_int=no
- ])
- ])
- if test $i_cv_unsetenv_ret_int = yes; then
- AC_DEFINE(UNSETENV_RET_INT,, [Define if unsetenv() returns int])
- fi
-])
void env_remove(const char *name)
{
-#ifdef HAVE_UNSETENV
-#ifdef UNSETENV_RET_INT
if (unsetenv(name) < 0)
i_fatal("unsetenv(%s) failed: %m", name);
-#else
- unsetenv(name);
-#endif
-#else
- extern char **environ;
- size_t len;
- char **envp;
-
- len = strlen(name);
- for (envp = environ; *envp != NULL; envp++) {
- if (strncmp(name, *envp, len) == 0 &&
- (*envp)[len] == '=') {
- do {
- envp[0] = envp[1];
- } while (*++envp != NULL);
- break;
- }
- }
-#endif
}
void env_clean(void)