/*
* Copyright (c) 2000-2003, 2007 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
/*
** PUTENV -- emulation of putenv() in terms of setenv()
**
** Not needed on Posix-compliant systems.
** This doesn't have full Posix semantics, but it's good enough
** for sendmail.
**
** Parameter:
** env -- the environment to put.
**
** Returns:
** 0 on success, < 0 on failure.
*/
#if NEEDPUTENV
int
char *str;
{
char **current;
char *tmp;
char **newenv;
static bool first = true;
extern char **environ;
/*
** find out how much of str to match when searching
** for a string to replace.
*/
else
++matchlen;
/*
** Search for an existing string in the environment and find the
** length of environ. If found, replace and exit.
*/
{
++envlen;
{
/* found it, now insert the new version */
return 0;
}
}
/*
** There wasn't already a slot so add space for a new slot.
** If this is our first time through, use malloc(), else realloc().
*/
if (first)
{
return -1;
first = false;
}
else
{
sizeof(char *) * (envlen + 2));
return -1;
}
/* actually add in the new entry */
return 0;
}
# else /* NEEDPUTENV == 2 */
int
char *env;
{
char *p;
int l;
char nbuf[100];
if (p == NULL)
return 0;
l = p - env;
if (l > sizeof nbuf - 1)
l = sizeof nbuf - 1;
nbuf[l] = '\0';
}
# endif /* NEEDPUTENV == 2 */
#endif /* NEEDPUTENV */
/*
** UNSETENV -- remove a variable from the environment
**
** Not needed on newer systems.
**
** Parameters:
** name -- the string name of the environment variable to be
** deleted from the current environment.
**
** Returns:
** none.
**
** Globals:
** environ -- a pointer to the current environment.
**
** Side Effects:
** Modifies environ.
*/
#if !HASUNSETENV
void
char *name;
{
extern char **environ;
register char **pp;
{
break;
}
}
#endif /* !HASUNSETENV */
char *SmCompileOptions[] =
{
"SM_CONF_BROKEN_STRTOD",
#endif /* SM_CONF_BROKEN_STRTOD */
#if SM_CONF_GETOPT
"SM_CONF_GETOPT",
#endif /* SM_CONF_GETOPT */
"SM_CONF_LDAP_INITIALIZE",
#endif /* SM_CONF_LDAP_INITIALIZE */
"SM_CONF_LDAP_MEMFREE",
#endif /* SM_CONF_LDAP_MEMFREE */
#if SM_CONF_LONGLONG
"SM_CONF_LONGLONG",
#endif /* SM_CONF_LONGLONG */
#if SM_CONF_MEMCHR
"SM_CONF_MEMCHR",
#endif /* SM_CONF_MEMCHR */
#if SM_CONF_MSG
"SM_CONF_MSG",
#endif /* SM_CONF_MSG */
#if SM_CONF_QUAD_T
"SM_CONF_QUAD_T",
#endif /* SM_CONF_QUAD_T */
#if SM_CONF_SEM
"SM_CONF_SEM",
#endif /* SM_CONF_SEM */
"SM_CONF_SETITIMER",
#endif /* SM_CONF_SETITIMER */
"SM_CONF_SIGSETJMP",
#endif /* SM_CONF_SIGSETJMP */
#if SM_CONF_SHM
"SM_CONF_SHM",
#endif /* SM_CONF_SHM */
"SM_CONF_SHM_DELAY",
#endif /* SM_CONF_SHM_DELAY */
#if SM_CONF_SSIZE_T
"SM_CONF_SSIZE_T",
#endif /* SM_CONF_SSIZE_T */
"SM_CONF_STDBOOL_H",
#endif /* SM_CONF_STDBOOL_H */
#if SM_CONF_STDDEF_H
"SM_CONF_STDDEF_H",
#endif /* SM_CONF_STDDEF_H */
#if 0
/* XXX this is always enabled (for now) */
#if SM_CONF_STRL
"SM_CONF_STRL",
#endif /* SM_CONF_STRL */
#endif /* 0 */
"SM_CONF_SYS_CDEFS_H",
#endif /* SM_CONF_SYS_CDEFS_H */
"SM_CONF_SYSEXITS_H",
#endif /* SM_CONF_SYSEXITS_H */
#if SM_CONF_UID_GID
"SM_CONF_UID_GID",
#endif /* SM_CONF_UID_GID */
"DO_NOT_USE_STRCPY",
#endif /* DO_NOT_USE_STRCPY */
#if SM_HEAP_CHECK
"SM_HEAP_CHECK",
#endif /* SM_HEAP_CHECK */
#if defined(SM_OS_NAME) && defined(__STDC__)
"SM_OS=sm_os_" SM_OS_NAME,
#endif /* defined(SM_OS_NAME) && defined(__STDC__) */
#if SM_VA_STD
"SM_VA_STD",
#endif /* SM_VA_STD */
#if USEKSTAT
"USEKSTAT",
#endif /* USEKSTAT */
#if USEPROCMEMINFO
"USEPROCMEMINFO",
#endif /* USEPROCMEMINFO */
#if USESWAPCTL
"USESWAPCTL",
#endif /* USESWAPCTL */
};