From dbe10cdc0642dedb147da3e92e0a1d618ea594ec Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Wed, 4 Apr 2001 02:31:12 +0000 Subject: [PATCH] * configure.in: Check for setenv, unsetenv, and getenv. Compile setenv.c if at least of these is undefined. [pullup from krb5-1-2-2-branch] * setenv.c: Add conditionals for compilation of setenv, unsetenv, and getenv such that they only get compiled if they don't already exist. [pullup from krb5-1-2-2-branch] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13140 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/telnet/libtelnet/ChangeLog | 10 ++++++++++ src/appl/telnet/libtelnet/configure.in | 8 ++++++-- src/appl/telnet/libtelnet/setenv.c | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index 52c203a74..3695791e2 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,3 +1,13 @@ +2001-04-03 Tom Yu + + * configure.in: Check for setenv, unsetenv, and getenv. Compile + setenv.c if at least of these is undefined. [pullup from + krb5-1-2-2-branch] + + * setenv.c: Add conditionals for compilation of setenv, unsetenv, + and getenv such that they only get compiled if they don't already + exist. [pullup from krb5-1-2-2-branch] + 2000-11-01 Ezra Peisach * configure.in: Use AC_C_CONST instead of AC_CONST. diff --git a/src/appl/telnet/libtelnet/configure.in b/src/appl/telnet/libtelnet/configure.in index 29fdbbd9e..343bc051b 100644 --- a/src/appl/telnet/libtelnet/configure.in +++ b/src/appl/telnet/libtelnet/configure.in @@ -3,10 +3,14 @@ CONFIG_RULES AC_PROG_ARCHIVE AC_PROG_ARCHIVE_ADD AC_PROG_RANLIB -AC_REPLACE_FUNCS([strcasecmp strdup setenv setsid strerror strftime getopt herror parsetos]) -AC_CHECK_FUNCS(gettosbyname cgetent) +AC_REPLACE_FUNCS([strcasecmp strdup setsid strerror strftime getopt herror parsetos]) +AC_CHECK_FUNCS(setenv unsetenv getenv gettosbyname cgetent) AC_CHECK_HEADERS(stdlib.h string.h) LIBOBJS="$LIBOBJS getent.o" +if test $ac_cv_func_setenv = no || test $ac_cv_func_unsetenv = no \ + || test $ac_cv_func_getenv = no; then + LIBOBJS="$LIBOBJS setenv.o" +fi AC_C_CONST if test "$KRB4_LIB" = ''; then AC_MSG_RESULT(No Kerberos 4 authentication) diff --git a/src/appl/telnet/libtelnet/setenv.c b/src/appl/telnet/libtelnet/setenv.c index 70695a361..bc4f22da9 100644 --- a/src/appl/telnet/libtelnet/setenv.c +++ b/src/appl/telnet/libtelnet/setenv.c @@ -52,6 +52,7 @@ static char *__findenv __P((const char *, int *)); * Set the value of the environmental variable "name" to be * "value". If rewrite is set, replace any current value. */ +#ifndef HAVE_SETENV setenv(name, value, rewrite) register const char *name; register const char *value; @@ -102,11 +103,13 @@ setenv(name, value, rewrite) for (*c++ = '='; *c++ = *value++;); return (0); } +#endif /* * unsetenv(name) -- * Delete environmental variable "name". */ +#ifndef HAVE_UNSETENV void unsetenv(name) const char *name; @@ -120,11 +123,13 @@ unsetenv(name) if (!(*p = *(p + 1))) break; } +#endif /* * getenv -- * Returns ptr to value associated with name, if any, else NULL. */ +#ifndef HAVE_GETENV char * getenv(name) const char *name; @@ -133,6 +138,7 @@ getenv(name) return (__findenv(name, &offset)); } +#endif /* * __findenv -- -- 2.26.2