Only build and use the compat.c bsd_setenv/bsd_putenv/bsd_unsetenv on systems

that don't provide the POSIX setenv().

This fixes building plugins that link to compat.c on OS X (shared libraries on
OS X don't have direct access to environ).  It also reduces the binary size on
platforms which provide setenv(), which these days is most of them.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@382 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2013-10-09 21:40:55 +00:00
parent 040c6abbe4
commit 3de05c07c1
6 changed files with 13 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2c01] [Changes 1.2c01]
* Use system setenv() in preference to compat bsd_setenv(). (caf)
* Allow selection of alternate hashing methods with $crypt(). (caf) * Allow selection of alternate hashing methods with $crypt(). (caf)
* Improve the initial seeding of the randm() fallback RNG. (caf) * Improve the initial seeding of the randm() fallback RNG. (caf)

5
configure vendored
View File

@@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 273 . # From configure.in Revision: 381 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59. # Generated by GNU Autoconf 2.59.
# #
@@ -7162,7 +7162,8 @@ done
for ac_func in socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove scandir
for ac_func in socket gethostname gettimeofday strtoul strlcpy strlcat stpcpy vsnprintf snprintf setsid strerror uname getrusage sysconf getpgid killpg getlogin realpath fchdir getpass fpathconf getpwent setvbuf select mkstemp memmove scandir setenv
do do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5 echo "$as_me:$LINENO: checking for $ac_func" >&5

View File

@@ -195,6 +195,9 @@
/* Define to 1 if you have the `select' function. */ /* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT #undef HAVE_SELECT
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `setsid' function. */ /* Define to 1 if you have the `setsid' function. */
#undef HAVE_SETSID #undef HAVE_SETSID

View File

@@ -263,10 +263,13 @@ char *ulongcomma (unsigned long);
unsigned long strtoul (const char *, char **, int); unsigned long strtoul (const char *, char **, int);
#endif #endif
#ifndef HAVE_SETENV
char * bsd_getenv (const char *); char * bsd_getenv (const char *);
int bsd_putenv (const char *); int bsd_putenv (const char *);
int bsd_setenv (const char *, const char *, int); int bsd_setenv (const char *, const char *, int);
void bsd_unsetenv (const char *); void bsd_unsetenv (const char *);
#define setenv bsd_setenv
#endif
#ifndef HAVE_INET_ATON #ifndef HAVE_INET_ATON
int inet_aton (const char *, struct in_addr *); int inet_aton (const char *, struct in_addr *);

View File

@@ -3078,7 +3078,7 @@ BUILT_IN_COMMAND(setenvcmd)
char *env_var; char *env_var;
if ((env_var = next_arg(args, &args)) != NULL) if ((env_var = next_arg(args, &args)) != NULL)
bsd_setenv(env_var, args, 1); setenv(env_var, args, 1);
else else
say("Usage: SETENV <var-name> <value>"); say("Usage: SETENV <var-name> <value>");
} }

View File

@@ -1000,7 +1000,7 @@ int scandir (const char *name,
/* --- end of scandir.c --- */ /* --- end of scandir.c --- */
/* --- start of env.c --- */ /* --- start of env.c --- */
#if 1 #ifndef HAVE_SETENV
/* /*
* Copyright (c) 1987, 1988, 1993 * Copyright (c) 1987, 1988, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.