From 2acd35f94fbb2abe039eff3580672fc2dc5a517f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Groenvall?= Date: Wed, 1 May 1996 16:23:49 +0000 Subject: [PATCH] Add unsetenv to libroken. Fix telnet(d) to link with libroken. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@455 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/telnet/config.h.in | 3 -- appl/telnet/configure | 84 +++++++-------------------------- appl/telnet/configure.in | 6 +-- appl/telnet/telnet/Makefile.in | 4 +- appl/telnet/telnetd/Makefile.in | 4 +- lib/roken/unsetenv.c | 35 ++++++++++++++ 6 files changed, 59 insertions(+), 77 deletions(-) create mode 100644 lib/roken/unsetenv.c diff --git a/appl/telnet/config.h.in b/appl/telnet/config.h.in index a9869e669..af29cea14 100644 --- a/appl/telnet/config.h.in +++ b/appl/telnet/config.h.in @@ -68,9 +68,6 @@ /* Define if you have the logout function. */ #undef HAVE_LOGOUT -/* Define if you have the mktime function. */ -#undef HAVE_MKTIME - /* Define if you have the ptsname function. */ #undef HAVE_PTSNAME diff --git a/appl/telnet/configure b/appl/telnet/configure index 82befe22d..6b3d32c90 100755 --- a/appl/telnet/configure +++ b/appl/telnet/configure @@ -1024,7 +1024,7 @@ KRBLIBPATH="" LIBKRB='-L$(libtop)/lib/krb -lkrb' LIBDES='-L$(libtop)/lib/des -ldes' LIBKAFS='-L$(libtop)/lib/kafs -lkafs' -LIBCOM_ERR='-L$(libtop)/util/et -lcom_err' +LIBROKEN='-L$(libtop)/lib/roken -lroken' KRBINCPATH='-I$(libtop)/include -I$(srcdir)/$(libtop)/include' telnet_msg="default" @@ -1043,7 +1043,7 @@ KRBLIBPATH='-L$(libtop)/lib' LIBKRB="-lkrb" LIBDES="-ldes" LIBKAFS="-lkafs" -LIBCOM_ERR="-lcom_err" +LIBROKEN="-lroken" KRBINCPATH='-I$(libtop)/include' telnet_msg="$telnet_athena_default" @@ -1457,7 +1457,7 @@ esac -for ac_func in getent herror memmove setenv strdup strerror strftime +for ac_func in cgetent getstr cgetstr uname vhangup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then @@ -1495,55 +1495,6 @@ else fi rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -LIBOBJS="$LIBOBJS ${ac_func}.o" -fi - -done - -for ac_func in cgetent getstr cgetstr uname vhangup -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -char $ac_func(); - -int main() { return 0; } -int t() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* - fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 @@ -1564,7 +1515,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1608,14 +1559,14 @@ else fi done -for ac_func in tgetent setupterm mktime ptsname ttyname unlockpt grantpt +for ac_func in tgetent setupterm ptsname ttyname unlockpt grantpt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1675,7 +1626,7 @@ if eval "test \"\$ac_cv_func_logout\" != yes" ; then LIBS="$ac_lib $ac_save_LIBS" fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "if test -n \"$ac_lib\";then ac_cv_funclib_logout=$ac_lib; else ac_cv_funclib_logout=yes; fi";break fi @@ -1749,12 +1700,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1786,12 +1737,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1823,12 +1774,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2021,12 +1972,11 @@ s%@KRBLIBPATH@%$KRBLIBPATH%g s%@LIBKRB@%$LIBKRB%g s%@LIBDES@%$LIBDES%g s%@LIBKAFS@%$LIBKAFS%g -s%@LIBCOM_ERR@%$LIBCOM_ERR%g +s%@LIBROKEN@%$LIBROKEN%g s%@USE_IM@%$USE_IM%g s%@DIAGNOSTICS@%$DIAGNOSTICS%g s%@KLUDGELINEMODE@%$KLUDGELINEMODE%g s%@OLD_ENVIRON@%$OLD_ENVIRON%g -s%@LIBOBJS@%$LIBOBJS%g s%@HAVE_LIBTERMCAP@%$HAVE_LIBTERMCAP%g s%@STREAMSPTY@%$STREAMSPTY%g diff --git a/appl/telnet/configure.in b/appl/telnet/configure.in index 293390915..ff5bc378c 100644 --- a/appl/telnet/configure.in +++ b/appl/telnet/configure.in @@ -142,7 +142,7 @@ KRBLIBPATH="" LIBKRB='-L$(libtop)/lib/krb -lkrb' LIBDES='-L$(libtop)/lib/des -ldes' LIBKAFS='-L$(libtop)/lib/kafs -lkafs' -LIBCOM_ERR='-L$(libtop)/util/et -lcom_err' +LIBROKEN='-L$(libtop)/lib/roken -lroken' KRBINCPATH='-I$(libtop)/include -I$(srcdir)/$(libtop)/include' telnet_msg="default" @@ -161,7 +161,7 @@ KRBLIBPATH='-L$(libtop)/lib' LIBKRB="-lkrb" LIBDES="-ldes" LIBKAFS="-lkafs" -LIBCOM_ERR="-lcom_err" +LIBROKEN="-lroken" KRBINCPATH='-I$(libtop)/include' telnet_msg="$telnet_athena_default" @@ -173,7 +173,7 @@ AC_SUBST(KRBLIBPATH) AC_SUBST(LIBKRB) AC_SUBST(LIBDES) AC_SUBST(LIBKAFS) -AC_SUBST(LIBCOM_ERR) +AC_SUBST(LIBROKEN) AC_MSG_RESULT($telnet_msg) diff --git a/appl/telnet/telnet/Makefile.in b/appl/telnet/telnet/Makefile.in index a54649a28..b3f3dc2b1 100644 --- a/appl/telnet/telnet/Makefile.in +++ b/appl/telnet/telnet/Makefile.in @@ -34,9 +34,9 @@ libtop=@libtop@ KRBLIBPATH = @KRBLIBPATH@ LIBKRB = @LIBKRB@ LIBDES = @LIBDES@ -LIBCOM_ERR = @LIBCOM_ERR@ +LIBROKEN = @LIBROKEN@ -KLIB=$(KRBLIBPATH) $(LIBKRB) $(LIBDES) +KLIB=$(KRBLIBPATH) $(LIBKRB) $(LIBDES) $(LIBROKEN) all: telnet diff --git a/appl/telnet/telnetd/Makefile.in b/appl/telnet/telnetd/Makefile.in index f85cde3d9..1d504dc60 100644 --- a/appl/telnet/telnetd/Makefile.in +++ b/appl/telnet/telnetd/Makefile.in @@ -37,9 +37,9 @@ KRBINCPATH = @KRBINCPATH@ LIBKRB = @LIBKRB@ LIBDES = @LIBDES@ LIBKAFS = @LIBKAFS@ -LIBCOM_ERR = @LIBCOM_ERR@ +LIBROKEN = @LIBROKEN@ -KLIB=$(KRBLIBPATH) $(LIBKAFS) $(LIBKRB) $(LIBDES) +KLIB=$(KRBLIBPATH) $(LIBKAFS) $(LIBKRB) $(LIBDES) $(LIBROKEN) all: telnetd diff --git a/lib/roken/unsetenv.c b/lib/roken/unsetenv.c new file mode 100644 index 000000000..bcf7966e5 --- /dev/null +++ b/lib/roken/unsetenv.c @@ -0,0 +1,35 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +RCSID("$Id$"); + +extern char **environ; + +/* + * unsetenv -- + */ +void +unsetenv(const char *name) +{ + int len; + const char *np; + char **p; + + if (name == 0 || environ == 0) + return; + + for (np = name; *np && *np != '='; np++) + /* nop */; + len = np - name; + + for (p = environ; *p != 0; p++) + if (strncmp(*p, name, len) == 0 && (*p)[len] == '=') + break; + + for (; *p != 0; p++) + *p = *(p + 1); +} +