Index: mtr/.cvsignore
diff -u /dev/null mtr/.cvsignore:1.2
--- /dev/null	Wed Jul 19 23:40:34 2000
+++ mtr/.cvsignore	Fri Sep  3 00:29:06 1999
@@ -0,0 +1,6 @@
+Makefile
+config.log
+config.status
+config.cache
+config.h
+stamp-h
Index: mtr/Makefile
diff -u mtr/Makefile:1.1.1.1 mtr/Makefile:removed
--- mtr/Makefile:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/Makefile	Wed Jul 19 23:40:34 2000
@@ -1,16 +0,0 @@
-
-#
-# This is an attempt on simplifying the compilation of mtr to a simple "make". 
-#
-
-firstrule: 
-	./configure
-	$(MAKE)
-
-clean: 
-	rm -f *.o *~ core
-
-distclean: clean
-	rm -f mtr config.cache config.status config.log \
-	          stamp-h stamp-h[0-9]* TAGS ID
-
Index: mtr/Makefile.in
diff -u mtr/Makefile.in:1.1.1.2 mtr/Makefile.in:1.5
--- mtr/Makefile.in:1.1.1.2	Wed Mar  8 09:58:50 2000
+++ mtr/Makefile.in	Sun May  7 23:17:26 2000
@@ -58,6 +58,7 @@
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 CC = @CC@
+CPP = @CPP@
 CURSES_OBJ = @CURSES_OBJ@
 GTK_CFLAGS = @GTK_CFLAGS@
 GTK_CONFIG = @GTK_CONFIG@
@@ -104,25 +105,25 @@
 MANS = $(man_MANS)
 
 NROFF = nroff
-DIST_COMMON =  README ./stamp-h.in AUTHORS COPYING INSTALL Makefile.am \
-Makefile.in NEWS TODO acconfig.h aclocal.m4 config.h.in configure \
-configure.in install-sh missing mkinstalldirs
+DIST_COMMON =  README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
+Makefile.am Makefile.in NEWS TODO acconfig.h aclocal.m4 config.h.in \
+configure configure.in install-sh missing mkinstalldirs
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
 TAR = tar
 GZIP_ENV = --best
+DEP_FILES =  .deps/curses.P .deps/display.P .deps/dns.P .deps/getopt.P \
+.deps/getopt1.P .deps/gtk.P .deps/mtr.P .deps/net.P .deps/raw.P \
+.deps/report.P .deps/select.P .deps/split.P
 SOURCES = $(mtr_SOURCES) $(EXTRA_mtr_SOURCES)
 OBJECTS = $(mtr_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
 .SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
-	cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile
-
-Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
 	cd $(top_builddir) \
 	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
@@ -187,9 +188,6 @@
 	  rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
 	done
 
-.c.o:
-	$(COMPILE) -c $<
-
 .s.o:
 	$(COMPILE) -c $<
 
@@ -376,6 +374,11 @@
 	-rm -rf $(distdir)
 	mkdir $(distdir)
 	-chmod 777 $(distdir)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
 	@for file in $(DISTFILES); do \
 	  d=$(srcdir); \
 	  if test -d $$d/$$file; then \
@@ -396,6 +399,38 @@
 	      || exit 1; \
 	  fi; \
 	done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+	-rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+	@echo '$(COMPILE) -c $<'; \
+	$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-cp .deps/$(*F).pp .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm .deps/$(*F).pp
+
+%.lo: %.c
+	@echo '$(LTCOMPILE) -c $<'; \
+	$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+	@-sed -e 's/^\([^:]*\)\.o[ 	]*:/\1.lo \1.o :/' \
+	  < .deps/$(*F).pp > .deps/$(*F).P; \
+	tr ' ' '\012' < .deps/$(*F).pp \
+	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+	    >> .deps/$(*F).P; \
+	rm -f .deps/$(*F).pp
 info-am:
 info: info-recursive
 dvi-am:
@@ -438,26 +473,27 @@
 
 maintainer-clean-generic:
 mostlyclean-am:  mostlyclean-hdr mostlyclean-sbinPROGRAMS \
-		mostlyclean-compile mostlyclean-tags \
+		mostlyclean-compile mostlyclean-tags mostlyclean-depend \
 		mostlyclean-generic
 
 mostlyclean: mostlyclean-recursive
 
 clean-am:  clean-hdr clean-sbinPROGRAMS clean-compile clean-tags \
-		clean-generic mostlyclean-am
+		clean-depend clean-generic mostlyclean-am
 
 clean: clean-recursive
 
 distclean-am:  distclean-hdr distclean-sbinPROGRAMS distclean-compile \
-		distclean-tags distclean-generic clean-am \
-		distclean-local
+		distclean-tags distclean-depend distclean-generic \
+		clean-am distclean-local
 
 distclean: distclean-recursive
 	-rm -f config.status
 
 maintainer-clean-am:  maintainer-clean-hdr maintainer-clean-sbinPROGRAMS \
 		maintainer-clean-compile maintainer-clean-tags \
-		maintainer-clean-generic distclean-am
+		maintainer-clean-depend maintainer-clean-generic \
+		distclean-am
 	@echo "This command is intended for maintainers to use;"
 	@echo "it deletes files that may require special tools to rebuild."
 
@@ -475,10 +511,12 @@
 all-recursive check-recursive installcheck-recursive info-recursive \
 dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
 maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
-dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
-install-exec-am install-exec install-data-am install-data install-am \
-install uninstall-am uninstall all-redirect all-am all installdirs-am \
+distclean-tags clean-tags maintainer-clean-tags distdir \
+mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck all-recursive-am install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs-am \
 installdirs mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
Index: mtr/acconfig.h
diff -u mtr/acconfig.h:1.1.1.1 mtr/acconfig.h:1.2
--- mtr/acconfig.h:1.1.1.1	Sat Aug 28 04:24:51 1999
+++ mtr/acconfig.h	Fri Sep  3 00:10:44 1999
@@ -49,3 +49,6 @@
 #else
 #error No 32 bit type
 #endif
+
+/* IPv6 support */
+#undef ENABLE_IPV6
Index: mtr/config.h.in
diff -u mtr/config.h.in:1.1.1.2 mtr/config.h.in:1.3
--- mtr/config.h.in:1.1.1.2	Wed Mar  8 09:58:51 2000
+++ mtr/config.h.in	Fri Jan 21 20:34:22 2000
@@ -34,6 +34,12 @@
 /* Define if you have the attron function.  */
 #undef HAVE_ATTRON
 
+/* Define if you have the getaddrinfo function.  */
+#undef HAVE_GETADDRINFO
+
+/* Define if you have the getnameinfo function.  */
+#undef HAVE_GETNAMEINFO
+
 /* Define if you have the seteuid function.  */
 #undef HAVE_SETEUID
 
@@ -108,3 +114,6 @@
 #else
 #error No 32 bit type
 #endif
+
+/* IPv6 support */
+#undef ENABLE_IPV6
Index: mtr/configure
diff -u mtr/configure:1.1.1.2 mtr/configure:1.4
--- mtr/configure:1.1.1.2	Wed Mar  8 09:58:54 2000
+++ mtr/configure	Thu Mar  9 01:06:36 2000
@@ -12,6 +12,9 @@
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
 ac_help="$ac_help
+  --enable-ipv6		Enable ipv6 (with ipv4) support
+  --disable-ipv6		Disable ipv6 support"
+ac_help="$ac_help
   --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)"
 ac_help="$ac_help
   --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)"
@@ -558,7 +561,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:562: checking for a BSD compatible install" >&5
+echo "configure:565: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -611,7 +614,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:615: checking whether build environment is sane" >&5
+echo "configure:618: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -668,7 +671,7 @@
 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:675: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -714,7 +717,7 @@
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:718: checking for working aclocal" >&5
+echo "configure:721: checking for working aclocal" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -727,7 +730,7 @@
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:731: checking for working autoconf" >&5
+echo "configure:734: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -740,7 +743,7 @@
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:744: checking for working automake" >&5
+echo "configure:747: checking for working automake" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -753,7 +756,7 @@
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:757: checking for working autoheader" >&5
+echo "configure:760: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -766,7 +769,7 @@
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:770: checking for working makeinfo" >&5
+echo "configure:773: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -789,7 +792,7 @@
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:793: checking for $ac_word" >&5
+echo "configure:796: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -819,7 +822,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:823: checking for $ac_word" >&5
+echo "configure:826: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -870,7 +873,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:874: checking for $ac_word" >&5
+echo "configure:877: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -902,7 +905,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:906: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:909: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -913,12 +916,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 917 "configure"
+#line 920 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -944,12 +947,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:948: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:951: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:953: checking whether we are using GNU C" >&5
+echo "configure:956: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -958,7 +961,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -977,7 +980,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:981: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:984: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1008,9 +1011,89 @@
   fi
 fi
 
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1016: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1031 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1037: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1048 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1065 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1071: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
 
 echo $ac_n "checking size of unsigned char""... $ac_c" 1>&6
-echo "configure:1014: checking size of unsigned char" >&5
+echo "configure:1097: checking size of unsigned char" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_char'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1018,7 +1101,7 @@
   ac_cv_sizeof_unsigned_char=1
 else
   cat > conftest.$ac_ext <<EOF
-#line 1022 "configure"
+#line 1105 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1029,7 +1112,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_char=`cat conftestval`
 else
@@ -1049,7 +1132,7 @@
 
 
 echo $ac_n "checking size of unsigned short""... $ac_c" 1>&6
-echo "configure:1053: checking size of unsigned short" >&5
+echo "configure:1136: checking size of unsigned short" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_short'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1057,7 +1140,7 @@
   ac_cv_sizeof_unsigned_short=2
 else
   cat > conftest.$ac_ext <<EOF
-#line 1061 "configure"
+#line 1144 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1068,7 +1151,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_short=`cat conftestval`
 else
@@ -1088,7 +1171,7 @@
 
 
 echo $ac_n "checking size of unsigned int""... $ac_c" 1>&6
-echo "configure:1092: checking size of unsigned int" >&5
+echo "configure:1175: checking size of unsigned int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1096,7 +1179,7 @@
   ac_cv_sizeof_unsigned_int=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 1100 "configure"
+#line 1183 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1107,7 +1190,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_int=`cat conftestval`
 else
@@ -1127,7 +1210,7 @@
 
 
 echo $ac_n "checking size of unsigned long""... $ac_c" 1>&6
-echo "configure:1131: checking size of unsigned long" >&5
+echo "configure:1214: checking size of unsigned long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1135,7 +1218,7 @@
   ac_cv_sizeof_unsigned_long=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 1139 "configure"
+#line 1222 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -1146,7 +1229,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:1150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_unsigned_long=`cat conftestval`
 else
@@ -1174,7 +1257,7 @@
 # We have to trust the linker not to mess things up... (It should not
 # pull in anything if we don't refer to anything in the lib). 
 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:1178: checking for tgetent in -ltermcap" >&5
+echo "configure:1261: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1182,7 +1265,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1186 "configure"
+#line 1269 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1193,7 +1276,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1222,12 +1305,12 @@
 
 
 echo $ac_n "checking for initscr""... $ac_c" 1>&6
-echo "configure:1226: checking for initscr" >&5
+echo "configure:1309: checking for initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1231 "configure"
+#line 1314 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char initscr(); below.  */
@@ -1250,7 +1333,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_initscr=yes"
 else
@@ -1268,7 +1351,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:1272: checking for initscr in -lncurses" >&5
+echo "configure:1355: checking for initscr in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1276,7 +1359,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1280 "configure"
+#line 1363 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1287,7 +1370,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:1291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1313,7 +1396,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:1317: checking for initscr in -lcurses" >&5
+echo "configure:1400: checking for initscr in -lcurses" >&5
 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1321,7 +1404,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1325 "configure"
+#line 1408 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1332,7 +1415,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:1336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1358,7 +1441,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for initscr in -lcursesX""... $ac_c" 1>&6
-echo "configure:1362: checking for initscr in -lcursesX" >&5
+echo "configure:1445: checking for initscr in -lcursesX" >&5
 ac_lib_var=`echo cursesX'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1366,7 +1449,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lcursesX  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1370 "configure"
+#line 1453 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1377,7 +1460,7 @@
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:1381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1417,15 +1500,365 @@
 fi
 
 
-for ac_func in attron
+CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
+echo $ac_n "checking whether to enable ipv6""... $ac_c" 1>&6
+echo "configure:1506: checking whether to enable ipv6" >&5
+# Check whether --enable-ipv6 or --disable-ipv6 was given.
+if test "${enable_ipv6+set}" = set; then
+  enableval="$enable_ipv6"
+   case "$enableval" in
+  no)
+       echo "$ac_t""no" 1>&6
+       ipv6=no
+       ;;
+  *)   echo "$ac_t""yes" 1>&6
+       cat >> confdefs.h <<\EOF
+#define ENABLE_IPV6 1
+EOF
+
+       ipv6=yes
+       ;;
+  esac 
+else
+  if test "$cross_compiling" = yes; then
+  echo "$ac_t""no" 1>&6
+  ipv6=no
+
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1530 "configure"
+#include "confdefs.h"
+ /* AF_INET6 avalable check */
+#include <sys/types.h>
+#include <sys/socket.h>
+main()
+{
+  exit(0);
+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+   exit(1);
+ else
+   exit(0);
+}
+
+EOF
+if { (eval echo configure:1545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define ENABLE_IPV6 1
+EOF
+
+  ipv6=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  echo "$ac_t""no" 1>&6
+  ipv6=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+
+ipv6type=unknown
+ipv6lib=none
+ipv6trylibc=no
+
+if test "$ipv6" = "yes"; then
+	echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
+echo "configure:1572: checking ipv6 stack type" >&5
+	for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
+		case $i in
+		inria)
+						cat > conftest.$ac_ext <<EOF
+#line 1577 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef IPV6_INRIA_VERSION
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ipv6type=$i;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		kame)
+						cat > conftest.$ac_ext <<EOF
+#line 1596 "configure"
+#include "confdefs.h"
+dnl
+#include <netinet/in.h>
+#ifdef __KAME__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				ipv6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-glibc)
+						cat > conftest.$ac_ext <<EOF
+#line 1618 "configure"
+#include "confdefs.h"
+dnl
+#include <features.h>
+#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ipv6type=$i;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		linux-libinet6)
+						if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
+				ipv6type=$i
+				ipv6lib=inet6
+				ipv6libdir=/usr/inet6/lib
+				ipv6trylibc=yes;
+				CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
+			fi
+			;;
+		toshiba)
+			cat > conftest.$ac_ext <<EOF
+#line 1646 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _TOSHIBA_INET6
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		v6d)
+			cat > conftest.$ac_ext <<EOF
+#line 1667 "configure"
+#include "confdefs.h"
+dnl
+#include </usr/local/v6/include/sys/v6config.h>
+#ifdef __V6D__
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ipv6type=$i;
+				ipv6lib=v6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-I/usr/local/v6/include $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		zeta)
+			cat > conftest.$ac_ext <<EOF
+#line 1688 "configure"
+#include "confdefs.h"
+dnl
+#include <sys/param.h>
+#ifdef _ZETA_MINAMI_INET6
+yes
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "yes" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"
+fi
+rm -f conftest*
+
+			;;
+		esac
+		if test "$ipv6type" != "unknown"; then
+			break
+		fi
+	done
+	echo "$ac_t""$ipv6type" 1>&6
+fi
+
+if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
+	if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
+		LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
+		echo "You have $ipv6lib library, using it"
+	else
+		if test "$ipv6trylibc" = "yes"; then
+			echo "You do not have $ipv6lib library, using libc"
+		else
+			echo 'Fatal: no $ipv6lib library found.  cannot continue.'
+			echo "You need to fetch lib$ipv6lib.a from appropriate"
+			echo 'ipv6 kit and compile beforehand.'
+			exit 1
+		fi
+	fi
+fi
+
+
+echo $ac_n "checking getaddrinfo bug""... $ac_c" 1>&6
+echo "configure:1733: checking getaddrinfo bug" >&5
+if test "$cross_compiling" = yes; then
+  echo "$ac_t""buggy" 1>&6
+buggygetaddrinfo=yes
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1739 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <netdb.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+main()
+{
+  int passive, gaierr, inet4 = 0, inet6 = 0;
+  struct addrinfo hints, *ai, *aitop;
+  char straddr[INET6_ADDRSTRLEN], strport[16];
+
+  for (passive = 0; passive <= 1; passive++) {
+    memset(&hints, 0, sizeof(hints));
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_flags = passive ? AI_PASSIVE : 0;
+    hints.ai_socktype = SOCK_STREAM;
+    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
+      (void)gai_strerror(gaierr);
+      goto bad;
+    }
+    for (ai = aitop; ai; ai = ai->ai_next) {
+      if (ai->ai_addr == NULL ||
+          ai->ai_addrlen == 0 ||
+          getnameinfo(ai->ai_addr, ai->ai_addrlen,
+                      straddr, sizeof(straddr), strport, sizeof(strport),
+                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
+        goto bad;
+      }
+      switch (ai->ai_family) {
+      case AF_INET:
+        if (strcmp(strport, "54321") != 0) {
+          goto bad;
+        }
+        if (passive) {
+          if (strcmp(straddr, "0.0.0.0") != 0) {
+            goto bad;
+          }
+        } else {
+          if (strcmp(straddr, "127.0.0.1") != 0) {
+            goto bad;
+          }
+        }
+        inet4++;
+        break;
+      case AF_INET6:
+        if (strcmp(strport, "54321") != 0) {
+          goto bad;
+        }
+        if (passive) {
+          if (strcmp(straddr, "::") != 0) {
+            goto bad;
+          }
+        } else {
+          if (strcmp(straddr, "::1") != 0) {
+            goto bad;
+          }
+        }
+        inet6++;
+        break;
+      case AF_UNSPEC:
+        goto bad;
+        break;
+      default:
+        /* another family support? */
+        break;
+      }
+    }
+  }
+
+  if (!(inet4 == 0 || inet4 == 2))
+    goto bad;
+  if (!(inet6 == 0 || inet6 == 2))
+    goto bad;
+
+  if (aitop)
+    freeaddrinfo(aitop);
+  exit(0);
+
+ bad:
+  if (aitop)
+    freeaddrinfo(aitop);
+  exit(1);
+}
+
+EOF
+if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  echo "$ac_t""good" 1>&6
+buggygetaddrinfo=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  echo "$ac_t""buggy" 1>&6
+buggygetaddrinfo=yes
+fi
+rm -fr conftest*
+fi
+
+
+if test "$buggygetaddrinfo" = "yes"; then
+	if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then
+		echo 'Fatal: You must get working getaddrinfo() function.'
+		echo '       or you can specify "--disable-ipv6"'.
+		exit 1
+	elif test "$ipv6type" = "linux"; then
+		echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
+		echo '         Better upgreade your system library to newest version'
+		echo '         of GNU C library (aka glibc).'
+	fi
+fi
+for ac_func in getaddrinfo getnameinfo
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1424: checking for $ac_func" >&5
+echo "configure:1857: checking for $ac_func" >&5
 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 <<EOF
-#line 1429 "configure"
+#line 1862 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1448,7 +1881,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1469,106 +1902,85 @@
  
 else
   echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
 fi
 done
 
 
 
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1479: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+
+for ac_func in attron
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1916: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-    # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will confuse make.
-  CPP="${CC-cc} -E"
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1494 "configure"
+#line 1921 "configure"
 #include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -E -traditional-cpp"
-  cat > conftest.$ac_ext <<EOF
-#line 1511 "configure"
-#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
 #include <assert.h>
-Syntax Error
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* 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
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+if { (eval echo configure:1944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  CPP="${CC-cc} -nologo -E"
-  cat > conftest.$ac_ext <<EOF
-#line 1528 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
+  eval "ac_cv_func_$ac_func=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  CPP=/lib/cpp
-fi
-rm -f conftest*
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
-rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
-fi
-  CPP="$ac_cv_prog_CPP"
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
 else
-  ac_cv_prog_CPP="$CPP"
+  echo "$ac_t""no" 1>&6
 fi
-echo "$ac_t""$CPP" 1>&6
+done
+
+
 
 for ac_hdr in ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1562: checking for $ac_hdr" >&5
+echo "configure:1974: checking for $ac_hdr" >&5
 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
-#line 1567 "configure"
+#line 1979 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1598,17 +2010,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1602: checking for $ac_hdr" >&5
+echo "configure:2014: checking for $ac_hdr" >&5
 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
-#line 1607 "configure"
+#line 2019 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1636,7 +2048,7 @@
 
 
 echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
-echo "configure:1640: checking for floor in -lm" >&5
+echo "configure:2052: checking for floor in -lm" >&5
 ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1644,7 +2056,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1648 "configure"
+#line 2060 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1655,7 +2067,7 @@
 floor()
 ; return 0; }
 EOF
-if { (eval echo configure:1659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1734,7 +2146,7 @@
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1738: checking for $ac_word" >&5
+echo "configure:2150: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1769,7 +2181,7 @@
 
   min_gtk_version=1.0.0
   echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:1773: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:2185: checking for GTK - version >= $min_gtk_version" >&5
   no_gtk=""
   if test "$GTK_CONFIG" = "no" ; then
     no_gtk=yes
@@ -1792,7 +2204,7 @@
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 1796 "configure"
+#line 2208 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -1870,7 +2282,7 @@
 }
 
 EOF
-if { (eval echo configure:1874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1905,7 +2317,7 @@
           CFLAGS="$CFLAGS $GTK_CFLAGS"
           LIBS="$LIBS $GTK_LIBS"
           cat > conftest.$ac_ext <<EOF
-#line 1909 "configure"
+#line 2321 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -1915,7 +2327,7 @@
  return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); 
 ; return 0; }
 EOF
-if { (eval echo configure:1919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
    echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding GTK or finding the wrong"
@@ -1960,12 +2372,12 @@
 
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:1964: checking for socket" >&5
+echo "configure:2376: checking for socket" >&5
 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1969 "configure"
+#line 2381 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -1988,7 +2400,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -2006,7 +2418,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2010: checking for socket in -lsocket" >&5
+echo "configure:2422: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2014,7 +2426,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2018 "configure"
+#line 2430 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2025,7 +2437,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2057,12 +2469,12 @@
 
 
 echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2061: checking for gethostbyname" >&5
+echo "configure:2473: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2066 "configure"
+#line 2478 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2085,7 +2497,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2103,7 +2515,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2107: checking for gethostbyname in -lnsl" >&5
+echo "configure:2519: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2111,7 +2523,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2115 "configure"
+#line 2527 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2122,7 +2534,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2154,12 +2566,12 @@
 
 
 echo $ac_n "checking for res_init""... $ac_c" 1>&6
-echo "configure:2158: checking for res_init" >&5
+echo "configure:2570: checking for res_init" >&5
 if eval "test \"`echo '$''{'ac_cv_func_res_init'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2163 "configure"
+#line 2575 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char res_init(); below.  */
@@ -2182,7 +2594,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_res_init=yes"
 else
@@ -2200,7 +2612,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6
-echo "configure:2204: checking for res_init in -lbind" >&5
+echo "configure:2616: checking for res_init in -lbind" >&5
 ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2208,7 +2620,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2212 "configure"
+#line 2624 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2219,7 +2631,7 @@
 res_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2245,7 +2657,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6
-echo "configure:2249: checking for res_init in -lresolv" >&5
+echo "configure:2661: checking for res_init in -lresolv" >&5
 ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2253,7 +2665,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2257 "configure"
+#line 2669 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2264,7 +2676,7 @@
 res_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2300,12 +2712,12 @@
 for ac_func in seteuid
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2304: checking for $ac_func" >&5
+echo "configure:2716: checking for $ac_func" >&5
 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 <<EOF
-#line 2309 "configure"
+#line 2721 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2328,7 +2740,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2355,12 +2767,12 @@
 #  AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
 
 echo $ac_n "checking for res_mkquery""... $ac_c" 1>&6
-echo "configure:2359: checking for res_mkquery" >&5
+echo "configure:2771: checking for res_mkquery" >&5
 if eval "test \"`echo '$''{'ac_cv_func_res_mkquery'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2364 "configure"
+#line 2776 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char res_mkquery(); below.  */
@@ -2383,7 +2795,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_res_mkquery=yes"
 else
@@ -2401,7 +2813,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6
-echo "configure:2405: checking for res_init in -lbind" >&5
+echo "configure:2817: checking for res_init in -lbind" >&5
 ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2409,7 +2821,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbind  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2413 "configure"
+#line 2825 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2420,7 +2832,7 @@
 res_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2446,7 +2858,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6
-echo "configure:2450: checking for res_init in -lresolv" >&5
+echo "configure:2862: checking for res_init in -lresolv" >&5
 ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2454,7 +2866,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2458 "configure"
+#line 2870 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2465,7 +2877,7 @@
 res_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2499,12 +2911,12 @@
 
 
 echo $ac_n "checking for herror""... $ac_c" 1>&6
-echo "configure:2503: checking for herror" >&5
+echo "configure:2915: checking for herror" >&5
 if eval "test \"`echo '$''{'ac_cv_func_herror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2508 "configure"
+#line 2920 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char herror(); below.  */
@@ -2527,7 +2939,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_herror=yes"
 else
@@ -2551,12 +2963,12 @@
 fi
 
 echo $ac_n "checking for strerror""... $ac_c" 1>&6
-echo "configure:2555: checking for strerror" >&5
+echo "configure:2967: checking for strerror" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2560 "configure"
+#line 2972 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strerror(); below.  */
@@ -2579,7 +2991,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_strerror=yes"
 else
@@ -2754,6 +3166,7 @@
 s%@CURSES_OBJ@%$CURSES_OBJ%g
 s%@CC@%$CC%g
 s%@CPP@%$CPP%g
+s%@LIBOBJS@%$LIBOBJS%g
 s%@GTK_CONFIG@%$GTK_CONFIG%g
 s%@GTK_CFLAGS@%$GTK_CFLAGS%g
 s%@GTK_LIBS@%$GTK_LIBS%g
Index: mtr/configure.in
diff -u mtr/configure.in:1.1.1.2 mtr/configure.in:1.4
--- mtr/configure.in:1.1.1.2	Wed Mar  8 09:58:54 2000
+++ mtr/configure.in	Thu Mar  9 01:06:36 2000
@@ -8,6 +8,7 @@
 CURSES_OBJ=curses.o
 
 AC_PROG_CC
+AC_PROG_CPP
 
 AC_CHECK_SIZEOF(unsigned char, 1)
 AC_CHECK_SIZEOF(unsigned short, 2)
@@ -30,6 +31,260 @@
 	AC_MSG_WARN(Building without curses display support)
 	AC_DEFINE(NO_CURSES)
 	CURSES_OBJ=))))
+
+CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
+AC_MSG_CHECKING([whether to enable ipv6])
+AC_ARG_ENABLE(ipv6,
+[  --enable-ipv6		Enable ipv6 (with ipv4) support
+  --disable-ipv6		Disable ipv6 support],
+[ case "$enableval" in
+  no)
+       AC_MSG_RESULT(no)
+       ipv6=no
+       ;;
+  *)   AC_MSG_RESULT(yes)
+       AC_DEFINE(ENABLE_IPV6)
+       ipv6=yes
+       ;;
+  esac ],
+
+  AC_TRY_RUN([ /* AF_INET6 avalable check */
+#include <sys/types.h>
+#include <sys/socket.h>
+main()
+{
+  exit(0);
+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
+   exit(1);
+ else
+   exit(0);
+}
+],
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(ENABLE_IPV6)
+  ipv6=yes,
+  AC_MSG_RESULT(no)
+  ipv6=no,
+  AC_MSG_RESULT(no)
+  ipv6=no
+))
+
+ipv6type=unknown
+ipv6lib=none
+ipv6trylibc=no
+
+if test "$ipv6" = "yes"; then
+	AC_MSG_CHECKING([ipv6 stack type])
+	for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
+		case $i in
+		inria)
+			dnl http://www.kame.net/
+			AC_EGREP_CPP(yes, [dnl
+#include <netinet/in.h>
+#ifdef IPV6_INRIA_VERSION
+yes
+#endif],
+				[ipv6type=$i;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		kame)
+			dnl http://www.kame.net/
+			AC_EGREP_CPP(yes, [dnl
+#include <netinet/in.h>
+#ifdef __KAME__
+yes
+#endif],
+				[ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				ipv6trylibc=yes;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		linux-glibc)
+			dnl http://www.v6.linux.or.jp/
+			AC_EGREP_CPP(yes, [dnl
+#include <features.h>
+#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
+yes
+#endif],
+				[ipv6type=$i;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		linux-libinet6)
+			dnl http://www.v6.linux.or.jp/
+			if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
+				ipv6type=$i
+				ipv6lib=inet6
+				ipv6libdir=/usr/inet6/lib
+				ipv6trylibc=yes;
+				CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
+			fi
+			;;
+		toshiba)
+			AC_EGREP_CPP(yes, [dnl
+#include <sys/param.h>
+#ifdef _TOSHIBA_INET6
+yes
+#endif],
+				[ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		v6d)
+			AC_EGREP_CPP(yes, [dnl
+#include </usr/local/v6/include/sys/v6config.h>
+#ifdef __V6D__
+yes
+#endif],
+				[ipv6type=$i;
+				ipv6lib=v6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-I/usr/local/v6/include $CFLAGS"])
+			;;
+		zeta)
+			AC_EGREP_CPP(yes, [dnl
+#include <sys/param.h>
+#ifdef _ZETA_MINAMI_INET6
+yes
+#endif],
+				[ipv6type=$i;
+				ipv6lib=inet6;
+				ipv6libdir=/usr/local/v6/lib;
+				CFLAGS="-DINET6 $CFLAGS"])
+			;;
+		esac
+		if test "$ipv6type" != "unknown"; then
+			break
+		fi
+	done
+	AC_MSG_RESULT($ipv6type)
+fi
+
+if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
+	if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
+		LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
+		echo "You have $ipv6lib library, using it"
+	else
+		if test "$ipv6trylibc" = "yes"; then
+			echo "You do not have $ipv6lib library, using libc"
+		else
+			echo 'Fatal: no $ipv6lib library found.  cannot continue.'
+			echo "You need to fetch lib$ipv6lib.a from appropriate"
+			echo 'ipv6 kit and compile beforehand.'
+			exit 1
+		fi
+	fi
+fi
+
+
+AC_MSG_CHECKING(getaddrinfo bug)
+AC_TRY_RUN([
+#include <sys/types.h>
+#include <netdb.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+main()
+{
+  int passive, gaierr, inet4 = 0, inet6 = 0;
+  struct addrinfo hints, *ai, *aitop;
+  char straddr[INET6_ADDRSTRLEN], strport[16];
+
+  for (passive = 0; passive <= 1; passive++) {
+    memset(&hints, 0, sizeof(hints));
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_flags = passive ? AI_PASSIVE : 0;
+    hints.ai_socktype = SOCK_STREAM;
+    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
+      (void)gai_strerror(gaierr);
+      goto bad;
+    }
+    for (ai = aitop; ai; ai = ai->ai_next) {
+      if (ai->ai_addr == NULL ||
+          ai->ai_addrlen == 0 ||
+          getnameinfo(ai->ai_addr, ai->ai_addrlen,
+                      straddr, sizeof(straddr), strport, sizeof(strport),
+                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
+        goto bad;
+      }
+      switch (ai->ai_family) {
+      case AF_INET:
+        if (strcmp(strport, "54321") != 0) {
+          goto bad;
+        }
+        if (passive) {
+          if (strcmp(straddr, "0.0.0.0") != 0) {
+            goto bad;
+          }
+        } else {
+          if (strcmp(straddr, "127.0.0.1") != 0) {
+            goto bad;
+          }
+        }
+        inet4++;
+        break;
+      case AF_INET6:
+        if (strcmp(strport, "54321") != 0) {
+          goto bad;
+        }
+        if (passive) {
+          if (strcmp(straddr, "::") != 0) {
+            goto bad;
+          }
+        } else {
+          if (strcmp(straddr, "::1") != 0) {
+            goto bad;
+          }
+        }
+        inet6++;
+        break;
+      case AF_UNSPEC:
+        goto bad;
+        break;
+      default:
+        /* another family support? */
+        break;
+      }
+    }
+  }
+
+  if (!(inet4 == 0 || inet4 == 2))
+    goto bad;
+  if (!(inet6 == 0 || inet6 == 2))
+    goto bad;
+
+  if (aitop)
+    freeaddrinfo(aitop);
+  exit(0);
+
+ bad:
+  if (aitop)
+    freeaddrinfo(aitop);
+  exit(1);
+}
+],
+AC_MSG_RESULT(good)
+buggygetaddrinfo=no,
+AC_MSG_RESULT(buggy)
+buggygetaddrinfo=yes,
+AC_MSG_RESULT(buggy)
+buggygetaddrinfo=yes)
+
+if test "$buggygetaddrinfo" = "yes"; then
+	if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then
+		echo 'Fatal: You must get working getaddrinfo() function.'
+		echo '       or you can specify "--disable-ipv6"'.
+		exit 1
+	elif test "$ipv6type" = "linux"; then
+		echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
+		echo '         Better upgreade your system library to newest version'
+		echo '         of GNU C library (aka glibc).'
+	fi
+fi
+AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
+
 
 AC_CHECK_FUNCS(attron)
 
Index: mtr/curses.c
diff -u mtr/curses.c:1.1.1.1 mtr/curses.c:1.4
--- mtr/curses.c:1.1.1.1	Sat Aug 28 04:25:07 1999
+++ mtr/curses.c	Wed Sep  8 11:30:06 1999
@@ -22,6 +22,8 @@
 #ifndef NO_CURSES
 #include <ctype.h>
 #include <stdlib.h>
+#include <netdb.h>
+#include <sys/socket.h>
 
 #if defined(HAVE_NCURSES_H)
 #  include <ncurses.h>
@@ -95,9 +97,10 @@
 void mtr_curses_hosts(int startstat) {
   int max;
   int at;
-  int addr;
+  const struct sockaddr *addr;
   int y, x;
-  char *name;
+  const char *name;
+  char hbuf[128];
 
   max = net_max();
 
@@ -106,12 +109,18 @@
     addr = net_addr(at);
 
     if(addr != 0) {
-      name = dns_lookup(addr);
+      name = dns_lookup((struct sockaddr *)addr);
       if(name != NULL) {
 	printw("%s", name);
       } else {
-	printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-	       (addr >> 8) & 0xff, addr & 0xff);
+	getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+	printw("%s", hbuf);
       }
 
       getyx(stdscr, y, x);
@@ -183,7 +192,6 @@
 void mtr_fill_graph(int at) {
 	int* saved;
 	int i;
-	int val;
 
 	saved = net_saved_pings(at);
 	for (i = 0; i < SAVED_PINGS; i++) {
@@ -208,9 +216,10 @@
 }
 
 void mtr_curses_graph(int startstat) {
-	int max, at, addr, y, x;
-	char* name;
-	char blocks[50];
+	int max, at, y, x;
+	const struct sockaddr *addr;
+	const char* name;
+	char hbuf[128];
 
 	max = net_max();
 	for (at = 0; at < max; at++) {
@@ -222,11 +231,18 @@
 			continue;
 		}
 
-		name = dns_lookup(addr);
+		name = dns_lookup((struct sockaddr *)addr);
 		if (name) {
 			printw("%s", name);
 		} else {
-			printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) && 0xff, (addr >> 8) & 0xff, addr & 0xff);
+			getnameinfo(addr,
+#ifdef linux
+				SA_LEN(addr),
+#else
+				addr->sa_len,
+#endif
+				hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+			printw("%s", hbuf);
 		}
 
 		getyx(stdscr, y, x);
Index: mtr/display.c
diff -u mtr/display.c:1.1.1.1 mtr/display.c:1.2
--- mtr/display.c:1.1.1.1	Sat Aug 28 04:25:03 1999
+++ mtr/display.c	Wed Sep  8 11:30:06 1999
@@ -17,12 +17,17 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <config.h>
+#include <unistd.h>
 #include "display.h"
 #include "mtr-curses.h"
 #include "mtr-gtk.h"
 #include "report.h"
 #include "select.h"
+#include "split.h"
+#include "raw.h"
 
 extern int DisplayMode;
 
@@ -149,7 +154,7 @@
 }
 
 
-void display_rawhost(int host, int ip_addr) {
+void display_rawhost(int host, struct sockaddr *addr) {
   switch(DisplayMode) {
   case DisplayReport:
   case DisplaySplit:            /* BL */
@@ -157,7 +162,7 @@
   case DisplayGTK:
     break;
   case DisplayRaw:
-    raw_rawhost (host, ip_addr);
+    raw_rawhost (host, addr);
     break;
   }
 }
Index: mtr/display.h
diff -u mtr/display.h:1.1.1.2 mtr/display.h:1.3
--- mtr/display.h:1.1.1.2	Wed Mar  8 09:58:56 2000
+++ mtr/display.h	Thu Mar  9 01:06:36 2000
@@ -27,7 +27,7 @@
 void display_close();
 void display_redraw();
 void display_rawping(int hostnum, int msec);
-void display_rawhost(int hostnum, int ip_addr);
+void display_rawhost(int hostnum, struct sockaddr *addr);
 int display_keyaction();
 void display_loop();
 void display_clear();
Index: mtr/dns.c
diff -u mtr/dns.c:1.1.1.1 mtr/dns.c:1.10
--- mtr/dns.c:1.1.1.1	Sat Aug 28 04:25:03 1999
+++ mtr/dns.c	Thu Jan 13 15:23:04 2000
@@ -42,6 +42,8 @@
 #include <stdlib.h>
 #include <errno.h>
 
+#include "dns.h"
+
 #ifdef NO_STRERROR
 extern int sys_nerr;
 extern char *sys_errlist[];
@@ -79,7 +81,7 @@
 typedef unsigned short word;
 typedef unsigned long dword;
 
-typedef unsigned int ip_t;
+typedef u_int32_t ip_t;
 
 /* Structures */
 
@@ -94,7 +96,11 @@
    struct resolve *previoushost;
    float expiretime; /* Fucking HPUX has a problem with "double" here. */
    char *hostname;
+   int af;
    ip_t ip;
+#ifdef ENABLE_IPV6
+   struct in6_addr ip6;
+#endif
    word id;
    byte state;
 };
@@ -123,7 +129,7 @@
    "unknown error",
 };
 
-#define ResourcetypeCount 17
+#define ResourcetypeCount 36
 char *resourcetypes[ResourcetypeCount+1] = {
    "unknown type",
    "A: host address",
@@ -142,6 +148,25 @@
    "MINFO: mailbox or mail list information",
    "MX: mail exchange",
    "TXT: text string",
+   "RP: responsible person",
+   "AFSDB: AFS cell database",
+   "X25: X_25 calling address",
+   "ISDN: ISDN calling address",
+   "RT: router",
+   "NSAP: NSAP address",
+   "NSAP_PTR: reverse NSAP lookup (deprecated)",
+   "SIG: security signature",
+   "KEY: security key",
+   "PX: X.400 mail mapping",
+   "GPOS: geographical position (withdrawn)",
+   "AAAA: IP6 Address",
+   "LOC: Location Information",
+   "NXT: Next Valid Name in Zone",
+   "EID: Endpoint identifier",
+   "NIMLOC: Nimrod locator",
+   "SRV: Server selection",
+   "ATMA: ATM Address",
+   "NAPTR: Naming Authority PoinTeR",
    "unknown type",
 };
 
@@ -242,14 +267,17 @@
 
 struct resolve *idbash[BashSize];
 struct resolve *ipbash[BashSize];
+#ifdef ENABLE_IPV6
+struct resolve *ip6bash[BashSize];
+#endif
 struct resolve *hostbash[BashSize];
 struct resolve *expireresolves = NULL;
 struct resolve *lastresolve = NULL;
 struct logline *streamlog = NULL;
 struct logline *lastlog = NULL;
 
-ip_t alignedip;
-ip_t localhost;
+static struct in_addr alignedip;
+static struct in_addr localhost;
 
 double sweeptime;
 
@@ -403,7 +431,7 @@
    FD_ZERO(set);
 }
 
-char *strlongip(ip_t ip){
+static const char *strlongip(ip_t ip){
    struct in_addr a;
    a.s_addr = htonl(ip);
    return inet_ntoa(a);
@@ -413,14 +441,36 @@
    return inet_addr(s);
 }
 
-int dns_forward(char *name){
+static const char *satostr(struct sockaddr *sa) {
+   static char hbuf[256];
+   getnameinfo(sa,
+#ifdef linux
+		SA_LEN(sa),
+#else
+		sa->sa_len,
+#endif
+		hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+   return hbuf;
+}
+
+int dns_forward4(char *name){
    struct hostent *host;
-   if ((host = gethostbyname(name)))
+   if ((host = gethostbyname2(name, AF_INET)))
       return *(int *)host->h_addr;
    else
       return 0;
 }
 
+#ifdef ENABLE_IPV6
+const struct in6_addr *dns_forward6(char *name){
+   struct hostent *host;
+   if ((host = gethostbyname2(name, AF_INET6)))
+      return (struct in6_addr *)host->h_addr;
+   else
+      return 0;
+}
+#endif
+
 int dns_waitfd(){
    return resfd;
 }
@@ -447,7 +497,7 @@
        strerror(errno));
       exit(-1);
    }
-   localhost = longipstr("127.0.0.1");
+   localhost.s_addr = longipstr("127.0.0.1");
    aseed = time(NULL) ^ (time(NULL) << 3) ^ (dword)getpid();
    for (i = 0;i < BashSize;i++){
       idbash[i] = NULL;
@@ -466,14 +516,23 @@
    return rp;
 }
 
-dword getidbash(word id){
+static dword getidbash(word id){
    return (dword)BashModulo(id);
 }
 
-dword getipbash(ip_t ip){
+static dword getipbash(ip_t ip){
    return (dword)BashModulo(ip);
 }
 
+#ifdef ENABLE_IPV6
+static dword getip6bash(struct in6_addr *addr) {
+   u_int32_t x;
+   x = *(u_int32_t *)&addr->s6_addr[0];
+   x ^= *(u_int32_t *)&addr->s6_addr[12];
+   return (dword)BashModulo(x);
+}
+#endif
+
 dword gethostbash(char *host){
    dword bashvalue = 0;
    for (;*host;host++){
@@ -514,11 +573,12 @@
 void unlinkresolveid(struct resolve *rp){
    dword bashnum;
    bashnum = getidbash(rp->id);
-   if (idbash[bashnum] == rp)
+   if (idbash[bashnum] == rp) {
       if (rp->previousid)
          idbash[bashnum] = rp->previousid;
       else
          idbash[bashnum] = rp->nextid;
+   }
    if (rp->nextid)
       rp->nextid->previousid = rp->previousid;
    if (rp->previousid)
@@ -556,11 +616,12 @@
 void unlinkresolvehost(struct resolve *rp){
    dword bashnum;
    bashnum = gethostbash(rp->hostname);
-   if (hostbash[bashnum] == rp)
+   if (hostbash[bashnum] == rp) {
       if (rp->previoushost)
          hostbash[bashnum] = rp->previoushost;
       else
          hostbash[bashnum] = rp->nexthost;
+   }
    if (rp->nexthost)
       rp->nexthost->previoushost = rp->previoushost;
    if (rp->previoushost)
@@ -568,7 +629,7 @@
    statfree(rp->hostname);
 }
 
-void linkresolveip(struct resolve *addrp){
+static void linkresolveip4(struct resolve *addrp){
    struct resolve *rp;
    dword bashnum;
    bashnum = getipbash(addrp->ip);
@@ -596,21 +657,84 @@
    ipbash[bashnum] = addrp;
 }
 
-void unlinkresolveip(struct resolve *rp){
+#ifdef ENABLE_IPV6
+static void linkresolveip6(struct resolve *addrp){
+   struct resolve *rp;
    dword bashnum;
-   bashnum = getipbash(rp->ip);
-   if (ipbash[bashnum] == rp)
-      if (rp->previousip)
-         ipbash[bashnum] = rp->previousip;
-      else
-         ipbash[bashnum] = rp->nextip;
+   bashnum = getip6bash(&addrp->ip6);
+   rp = ip6bash[bashnum];
+   if (rp){
+      while ((rp->nextip)
+          && (addrp->ip6.s6_addr[15] > rp->nextip->ip6.s6_addr[15])) {
+         rp = rp->nextip;
+      }
+      while ((rp->previousip)
+          && (addrp->ip6.s6_addr[15] < rp->previousip->ip6.s6_addr[15])) {
+         rp = rp->previousip;
+      }
+      if (rp->ip6.s6_addr[15] < addrp->ip6.s6_addr[15]){
+         addrp->previousip = rp;
+         addrp->nextip = rp->nextip;
+         if (rp->nextip)
+            rp->nextip->previousip = addrp;
+         rp->nextip = addrp;
+      } else {
+         addrp->previousip = rp->previousip;
+         addrp->nextip = rp;
+         if (rp->previousip)
+            rp->previousip->nextip = addrp;
+         rp->previousip = addrp;
+      }
+   } else
+      addrp->nextip = addrp->previousip = NULL;
+   ip6bash[bashnum] = addrp;
+}
+#endif
+
+static void linkresolveip(struct resolve *addrp){
+   switch (addrp->af) {
+   case AF_INET:
+      linkresolveip4(addrp);
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      linkresolveip6(addrp);
+      break;
+#endif
+   }
+}
+
+static void unlinkresolveip(struct resolve *rp){
+   dword bashnum;
+   switch (rp->af) {
+   case AF_INET:
+      bashnum = getipbash(rp->ip);
+      if (ipbash[bashnum] == rp) {
+	 if (rp->previousip)
+	    ipbash[bashnum] = rp->previousip;
+	 else
+	    ipbash[bashnum] = rp->nextip;
+      }
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      bashnum = getip6bash(&rp->ip6);
+      if (ip6bash[bashnum] == rp) {
+	 if (rp->previousip)
+	    ip6bash[bashnum] = rp->previousip;
+	 else
+	    ip6bash[bashnum] = rp->nextip;
+      }
+      break;
+#endif
+   }
    if (rp->nextip)
       rp->nextip->previousip = rp->previousip;
    if (rp->previousip)
       rp->previousip->nextip = rp->nextip;
 }
 
-void linkresolve(struct resolve *rp){
+static void linkresolve(struct resolve *rp){
    struct resolve *irp;
    if (expireresolves){
       irp = expireresolves;
@@ -637,7 +761,8 @@
    resolvecount++;
 }
 
-void lastlinkresolve(struct resolve *rp){
+#if 0
+static void lastlinkresolve(struct resolve *rp){
    struct resolve *irp;
    if (lastresolve){
       irp = lastresolve;
@@ -664,8 +789,9 @@
    }
    resolvecount++;
 }
+#endif
 
-void untieresolve(struct resolve *rp){
+static void untieresolve(struct resolve *rp){
    if (rp->previous)
       rp->previous->next = rp->next;
    else
@@ -677,7 +803,7 @@
    resolvecount--;
 }
 
-void unlinkresolve(struct resolve *rp){
+static void unlinkresolve(struct resolve *rp){
    untieresolve(rp);
    unlinkresolveid(rp);
    unlinkresolveip(rp);
@@ -685,7 +811,7 @@
       unlinkresolvehost(rp);
 }
 
-struct resolve *findid(word id){
+static struct resolve *findid(word id) {
    struct resolve *rp;
    int bashnum;
    bashnum = getidbash(id);
@@ -704,7 +830,8 @@
    return rp; /* NULL */
 }
 
-struct resolve *findhost(char *hostname){
+#if 0
+static struct resolve *findhost(char *hostname){
    struct resolve *rp;
    int bashnum;
    bashnum = gethostbash(hostname);
@@ -723,8 +850,9 @@
    }
    return rp; /* NULL */
 }
+#endif
 
-struct resolve *findip(ip_t ip){
+static struct resolve *findip(ip_t ip){
    struct resolve *rp;
    dword bashnum;
    bashnum = getipbash(ip);
@@ -743,9 +871,32 @@
    return rp; /* NULL */
 }
 
+#ifdef ENABLE_IPV6
+static struct resolve *findip6(struct in6_addr *addr) {
+   struct resolve *rp;
+   dword bashnum;
+   bashnum = getip6bash(addr);
+   rp = ip6bash[bashnum];
+   if (rp){
+      while ((rp->nextip) && (addr->s6_addr[15] >= rp->nextip->ip6.s6_addr[15]))
+         rp = rp->nextip;
+      while ((rp->previousip)
+       && (addr->s6_addr[15] <= rp->previousip->ip6.s6_addr[15])) {
+         rp = rp->previousip;
+      }
+      if (IN6_ARE_ADDR_EQUAL(addr, &rp->ip6)){
+         ip6bash[bashnum] = rp;
+         return rp;
+      } else
+         return NULL;
+   }
+   return rp; /* NULL */
+}
+#endif
+
 void restell(char *s){
    fputs(s,stderr);
-   fputs("\r",stderr);
+   fputs("\n",stderr);
 }
 
 void dorequest(char *s,int type,word id){
@@ -764,20 +915,44 @@
        sizeof(struct sockaddr));
 }
 
-void resendrequest(struct resolve *rp,int type){
-   if (type == T_A){
+static char *ptrstring4(ip_t ip, char *buf, size_t siz) {
+   u_char *p;
+   p = (u_char *)&ip;
+   snprintf(buf, siz, "%u.%u.%u.%u.in-addr.arpa",
+      p[3], p[2], p[1], p[0]);
+   return buf;
+}
+
+#ifdef ENABLE_IPV6
+static char *ptrstring6(struct in6_addr *ip6, char *buf, size_t siz) {
+   char *p, *q;
+   int i;
+   const char *hex = "0123456789abcdef";
+
+   p = buf;
+   q = buf + siz;
+   for (i = sizeof(struct in6_addr) - 1; i >= 0 && p < q; i--) {
+      *p++ = hex[ip6->s6_addr[i] & 0x0f];
+      *p++ = '.';
+      *p++ = hex[(ip6->s6_addr[i] >> 4) & 0x0f];
+      *p++ = '.';
+      *p = '\0';
+   }
+   strcpy(p, "ip6.int");
+   return buf;
+}
+#endif
+
+static void resendrequest(struct resolve *rp,int type){
+   if (type == T_A || type == T_AAAA) {
       dorequest(rp->hostname,type,rp->id);
       if (debug){
          sprintf(tempstring,"Resolver: Sent reverse authentication request for \"%s\".",
           rp->hostname);
          restell(tempstring);
       }
-   } else if (type == T_PTR){
-      sprintf(tempstring,"%u.%u.%u.%u.in-addr.arpa",
-       ((byte *)&rp->ip)[3],
-        ((byte *)&rp->ip)[2],
-         ((byte *)&rp->ip)[1],
-          ((byte *)&rp->ip)[0]);
+   } else if (type == T_PTR && rp->af == AF_INET){
+      ptrstring4(rp->ip, tempstring, sizeof(tempstring));
       dorequest(tempstring,type,rp->id);
       if (debug){
          sprintf(tempstring,"Resolver: Sent domain lookup request for \"%s\".",
@@ -785,6 +960,18 @@
          restell(tempstring);
       }
    }
+#ifdef ENABLE_IPV6
+   else if (type == T_PTR && rp->af == AF_INET6) {
+      char buf[128];
+      ptrstring6(&rp->ip6, tempstring, sizeof(tempstring));
+      dorequest(tempstring,type,rp->id);
+      if (debug){
+         sprintf(tempstring,"Resolver: Sent domain lookup request for \"%s\".",
+          inet_ntop(AF_INET6, &rp->ip6, buf, sizeof(buf)));
+         restell(tempstring);
+      }
+   }
+#endif
 }
 
 void sendrequest(struct resolve *rp,int type){
@@ -881,11 +1068,14 @@
                case STATE_PTRREQ1:
                case STATE_PTRREQ2:
                case STATE_PTRREQ3:
-                  sprintf(stackstring,"%u.%u.%u.%u.in-addr.arpa",
-                   ((byte *)&rp->ip)[3],
-                    ((byte *)&rp->ip)[2],
-                     ((byte *)&rp->ip)[1],
-                      ((byte *)&rp->ip)[0]);
+		  if (rp->af == AF_INET)
+		     ptrstring4(rp->ip, stackstring, sizeof(stackstring));
+#ifdef ENABLE_IPV6
+		  else if (rp->af == AF_INET6)
+		     ptrstring6(&rp->ip6, stackstring, sizeof(stackstring));
+#endif
+		  else
+		     stackstring[0] = '\0';
                   break;
             }
             *namestring = '\0';
@@ -999,7 +1189,7 @@
                               sprintf(tempstring,"Resolver: Reverse authentication failed: %s != ",
                                strlongip(rp->ip));
                               memcpy(&alignedip,(ip_t *)c,sizeof(ip_t));
-                              strcat(tempstring,strlongip(alignedip));
+                              strcat(tempstring,strlongip(alignedip.s_addr));
                               restell(tempstring);
                               res_hostipmismatch++;
                               failrp(rp);
@@ -1079,7 +1269,7 @@
    r = recvfrom(resfd,(byte *)resrecvbuf,MaxPacketsize,0,(struct sockaddr *)&from,&fromlen);
    if (r > 0){
       /* Check to see if this server is actually one we sent to */
-      if (from.sin_addr.s_addr == localhost){
+      if (from.sin_addr.s_addr == localhost.s_addr){
          for (i = 0;i < _res.nscount;i++)
             if ((_res.nsaddr_list[i].sin_addr.s_addr == from.sin_addr.s_addr) ||
                 (!_res.nsaddr_list[i].sin_addr.s_addr))	/* 0.0.0.0 replies as 127.0.0.1 */
@@ -1101,12 +1291,13 @@
 }
 
 int istime(double x,double *sinterval){
-   if (x)
+   if (x) {
       if (x > sweeptime){
          if (*sinterval > x - sweeptime)
             *sinterval = x - sweeptime;
       } else
          return 1;
+   }
    return 0;
 }
 
@@ -1152,22 +1343,33 @@
       (void)istime(expireresolves->expiretime,sinterval);
 }
 
-char *dns_lookup2(ip_t ip){
+const char *dns_lookup2(struct sockaddr *sa) {
    struct resolve *rp;
-   ip = htonl(ip);
-   if ((rp = findip(ip))){
+   switch (sa->sa_family) {
+   case AF_INET:
+      rp = findip(((struct sockaddr_in *)sa)->sin_addr.s_addr);
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      rp = findip6(&((struct sockaddr_in6 *)sa)->sin6_addr);
+      break;
+#endif
+   default:
+      return satostr(sa);
+   }
+   if (rp){
       if ((rp->state == STATE_FINISHED) || (rp->state == STATE_FAILED)){
          if ((rp->state == STATE_FINISHED) && (rp->hostname)){
             if (debug){
                sprintf(tempstring,"Resolver: Used cached record: %s == \"%s\".\n",
-                strlongip(ip),rp->hostname);
+                satostr(sa),rp->hostname);
                restell(tempstring);
             }
             return rp->hostname;
          } else {
             if (debug){
                sprintf(tempstring,"Resolver: Used failed record: %s == ???\n",
-                strlongip(ip));
+                satostr(sa));
                restell(tempstring);
             }
             return NULL;
@@ -1180,19 +1382,35 @@
    rp = allocresolve();
    rp->state = STATE_PTRREQ1;
    rp->expiretime = sweeptime + ResRetryDelay1;
-   rp->ip = ip;
-   linkresolve(rp);
-   rp->ip = ip;
-   linkresolveip(rp);
-   sendrequest(rp,T_PTR);
+   switch (sa->sa_family) {
+   case AF_INET:
+      rp->af = AF_INET;
+      rp->ip = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+      linkresolve(rp);
+      rp->ip = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+      linkresolveip(rp);
+      sendrequest(rp,T_PTR);
+      break;
+#ifdef ENABLE_IPV6
+   case AF_INET6:
+      rp->af = AF_INET6;
+      rp->ip6 = ((struct sockaddr_in6 *)sa)->sin6_addr;
+      linkresolve(rp);
+      rp->ip6 = ((struct sockaddr_in6 *)sa)->sin6_addr;
+      linkresolveip(rp);
+      sendrequest(rp, T_PTR);
+      break;
+#endif
+   }
    return NULL;
 }
-
 
-char *dns_lookup(ip_t ip){
-  char *t;
+const char *dns_lookup(struct sockaddr *addr) {
+  const char *t;
 
-  if (!dns) return strlongip (ip);
-  t = dns_lookup2 (ip);
-  return t?t:strlongip(ip);
+  if (!dns) {
+    return satostr(addr);
+  }
+  t = dns_lookup2(addr);
+  return t ? t : satostr(addr);
 }
Index: mtr/dns.h
diff -u mtr/dns.h:1.1.1.1 mtr/dns.h:1.5
--- mtr/dns.h:1.1.1.1	Sat Aug 28 04:25:03 1999
+++ mtr/dns.h	Wed Sep  8 11:30:07 1999
@@ -19,11 +19,12 @@
 
 /*  Prototypes for dns.c  */
 
+struct in6_addr;
 void dns_open();
 int dns_waitfd();
 void dns_ack();
 void dns_events(double *sinterval);
-char *dns_lookup(int address);
-char *dns_lookup2(int address);
-int dns_forward(char *name);
-char *strlongip (int address);
+const char *dns_lookup(struct sockaddr *address);
+const char *dns_lookup2(struct sockaddr *address);
+int dns_forward4(char *name);
+const struct in6_addr *dns_forward6(char *name);
Index: mtr/getopt.c
diff -u mtr/getopt.c:1.1.1.1 mtr/getopt.c:1.2
--- mtr/getopt.c:1.1.1.1	Sat Aug 28 04:25:05 1999
+++ mtr/getopt.c	Wed Sep  8 11:30:07 1999
@@ -39,6 +39,7 @@
 #endif
 
 #include <stdio.h>
+#include <string.h>
 
 /* Comment out all this code if we are using the GNU C Library, and are not
    actually compiling the library itself.  This code is part of the GNU C
@@ -538,7 +539,7 @@
 		optarg = nameend + 1;
 	      else
 		{
-		  if (opterr)
+		  if (opterr) {
 		   if (argv[optind - 1][1] == '-')
 		    /* --option */
 		    fprintf (stderr,
@@ -549,6 +550,7 @@
 		    fprintf (stderr,
 		     _("%s: option `%c%s' doesn't allow an argument\n"),
 		     argv[0], argv[optind - 1][0], pfound->name);
+		  }
 
 		  nextchar += strlen (nextchar);
 		  return '?';
Index: mtr/gtk.c
diff -u mtr/gtk.c:1.1.1.1 mtr/gtk.c:1.7
--- mtr/gtk.c:1.1.1.1	Sat Aug 28 04:25:08 1999
+++ mtr/gtk.c	Fri Jan 21 20:34:22 2000
@@ -20,6 +20,10 @@
 
 #include <config.h>
 #include <sys/time.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <stdio.h>
 
 #ifndef NO_GTK
 #include <stdlib.h>
@@ -40,7 +44,13 @@
 extern float WaitTime;
 static int tag;
 static GtkWidget *Pause_Button;
+#ifdef ENABLE_IPV6
+static GtkWidget *Af_Button;
+#endif
+
+void gtk_net_data __P((gpointer data, gint fd, GdkInputCondition cond));
 
+extern int af;
 
 void gtk_add_ping_timeout (void)
 {
@@ -100,6 +110,21 @@
   return FALSE;
 }
 
+#ifdef ENABLE_IPV6
+gint Af_clicked(GtkWidget *Button, gpointer data) {
+  if (af == AF_INET)
+    af = AF_INET6;
+  else if (af == AF_INET6)
+    af = AF_INET;
+
+  /* pause for safety */
+  gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(Pause_Button) , 1);
+  gtk_redraw();
+
+  return FALSE;
+}
+#endif
+
 /*
  * There is a small problem with the following code:
  * The timeout is canceled and removed in order to ensure that
@@ -120,10 +145,31 @@
 
 gint Host_activate(GtkWidget *Entry, gpointer data) {
   int addr;
+  const struct in6_addr *addr6;
+  int ok;
 
-  addr = dns_forward(gtk_entry_get_text(GTK_ENTRY(Entry)));
-  if(addr) {
-    net_reopen(addr);
+  ok = 0;
+  switch (af) {
+  case AF_INET:
+    addr = dns_forward4(gtk_entry_get_text(GTK_ENTRY(Entry)));
+    if (addr) {
+      net4_reopen(addr);
+      ok = 1;
+    }
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    addr6 = dns_forward6(gtk_entry_get_text(GTK_ENTRY(Entry)));
+    if (addr6) {
+      net6_reopen((struct in6_addr *)addr6);
+      ok = 1;
+    }
+    break;
+#endif
+  default:
+    break;
+  }
+  if(ok) {
     /* If we are "Paused" at this point it is usually because someone
        entered a non-existing host. Therefore do the go-ahead... --REW */
     gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( Pause_Button ) , 0);
@@ -147,6 +193,8 @@
   GtkWidget *Entry;
   GtkAdjustment *Adjustment;
 
+  af = AF_INET;	/*XXX*/
+
   Button = gtk_button_new_with_label("Quit");
   gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0);
   gtk_signal_connect(GTK_OBJECT(Button), "clicked",
@@ -165,6 +213,14 @@
                     GTK_SIGNAL_FUNC(Pause_clicked), NULL);
   gtk_widget_show(Pause_Button);
 
+#ifdef ENABLE_IPV6
+  Af_Button = gtk_toggle_button_new_with_label("IPv6");
+  gtk_box_pack_end(GTK_BOX(Toolbar), Af_Button, FALSE, FALSE, 0);
+  gtk_signal_connect(GTK_OBJECT(Af_Button), "clicked",
+                    GTK_SIGNAL_FUNC(Af_clicked), NULL);
+  gtk_widget_show(Af_Button);
+#endif
+
   /* allow root only to set zero delay */
   Adjustment = (GtkAdjustment *)gtk_adjustment_new(WaitTime,
                                                   getuid()==0 ? 0.00:1.00,
@@ -199,20 +255,28 @@
 GtkWidget *ReportBody;
 
 GtkWidget *GetRow(int index) {
-  int addr;
-  char str[256], *name;
+  const struct sockaddr *addr;
+  char str[256];
+  const char *name;
   GtkWidget *Row, *Label;
 
   Row = gtk_fixed_new();
   
   addr = net_addr(index);
   name = "???";
-  if(addr != 0) {
-    name = dns_lookup(addr);
+  if (addr != 0) {
+    name = dns_lookup((struct sockaddr *)addr);
     if(!name) {
       /* Actually this is not neccesary: 
 	 dns_lookup always returns a printable string */
-      name = strlongip (addr);
+      getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		str, sizeof(str), NULL, 0, NI_NUMERICHOST);
+      name = str;
     }
   }
 
@@ -281,20 +345,26 @@
 }
 
 void gtk_update_row(GtkCList *List, int row) {
-  int addr;
-  char str[256], *name;
+  const struct sockaddr *addr;
+  char str[256];
+  const char *name;
 
   addr = net_addr(row);
   name = "???";
   if(addr != 0) {
-    name = dns_lookup(addr);
+    name = dns_lookup((struct sockaddr *)addr);
     if(!name) {
-      sprintf(str, "%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-	      (addr >> 8) & 0xff, addr & 0xff);
+      getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		str, sizeof(str), NULL, 0, NI_NUMERICHOST);
       name = str;
     }
   }
-  gtk_set_field(List, row, 0, name);
+  gtk_set_field(List, row, 0, (char *)name);
 
   gtk_set_field_num(List, row, 1, "%d%%", net_percent(row));
   gtk_set_field_num(List, row, 2, "%d", net_returned(row));  
@@ -405,10 +475,12 @@
   gtk_redraw();
 }
 
-
 void gtk_loop() {
   gtk_add_ping_timeout ();
-  gdk_input_add(net_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL);
+  gdk_input_add(net4_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL);
+#ifdef ENABLE_IPV6
+  gdk_input_add(net6_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL);
+#endif
   gdk_input_add(dns_waitfd(), GDK_INPUT_READ, gtk_dns_data, NULL);
 
   gtk_main();
Index: mtr/mtr.c
diff -u mtr/mtr.c:1.1.1.2 mtr/mtr.c:1.7
--- mtr/mtr.c:1.1.1.2	Wed Mar  8 09:58:54 2000
+++ mtr/mtr.c	Thu Mar  9 01:06:37 2000
@@ -22,6 +22,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
 
 #include "mtr-curses.h"
 #include "getopt.h"
@@ -47,6 +50,7 @@
 char LocalHostname[128];
 int dns = 1;
 int packetsize = MINPACKET;
+int af = AF_INET;
 
 void parse_arg(int argc, char **argv) {
   int opt;
@@ -62,12 +66,20 @@
     { "no-dns", 0, 0, 'n' },
     { "split", 0, 0, 's' },     /* BL */
     { "raw", 0, 0, 'l' },
+#ifdef ENABLE_IPV6
+    { "ipv6", 0, 0, '6' },
+    { "ipv4", 0, 0, '4' },
+#endif
     { 0, 0, 0, 0 }
   };
 
   opt = 0;
   while(1) {
-    opt = getopt_long(argc, argv, "hvrc:tklnsi:p:", long_options, NULL);
+    opt = getopt_long(argc, argv, "hvrc:tklnsi:p:"
+#ifdef ENABLE_IPV6
+	"46"
+#endif
+	, long_options, NULL);
     if(opt == -1)
       break;
 
@@ -111,6 +123,14 @@
       if (getuid() != 0 && WaitTime < 1.0)
        WaitTime = 1.0;
       break;
+#ifdef ENABLE_IPV6
+    case '4':
+      af = AF_INET;
+      break;
+    case '6':
+      af = AF_INET6;
+      break;
+#endif
     }
   }
 
@@ -132,7 +152,6 @@
 {
   int argc;
   char *argv[128], *p;
-  int i;
 
   if (!string) return;
 
@@ -155,7 +174,6 @@
   int net_preopen_result;
 
   /*  Get the raw sockets first thing, so we can drop to user euid immediately  */
-
   net_preopen_result = net_preopen ();
 
   /*  Now drop to user permissions  */
@@ -182,7 +200,7 @@
   }
 
   if(PrintHelp) {
-    printf("usage: %s [-hvrctglsni] [--help] [--version] [--report]\n"
+    printf("usage: %s [-hvrctglsni46] [--help] [--version] [--report]\n"
 	   "\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n"
            "\t\t[--raw] [--split] [--no-dns]\n"      /* BL */
            "\t\t[--psize=bytes/-p=bytes]\n"            /* ok */
@@ -201,7 +219,7 @@
   }
 
 
-  host = gethostbyname(Hostname);
+  host = gethostbyname2(Hostname, af);
   if(host == NULL) {
 #ifndef NO_HERROR
     herror("mtr");
@@ -211,11 +229,23 @@
     exit(1);
   }
 
-  traddr = *(int *)host->h_addr;
-
-  if(net_open(traddr) != 0) {
-    printf("mtr: Unable to get raw socket.  (Executable not suid?)\n");
-    exit(1);
+  switch (af) {
+  case AF_INET:
+    traddr = *(int *)host->h_addr;
+
+    if(net4_open(traddr) != 0) {
+      printf("mtr: Unable to get raw socket.  (Executable not suid?)\n");
+      exit(1);
+    }
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    if(net6_open((struct in6_addr *)host->h_addr) != 0) {
+      printf("mtr: Unable to get raw socket.  (Executable not suid?)\n");
+      exit(1);
+    }
+    break;
+#endif
   }
 
   display_open();
Index: mtr/net.c
diff -u mtr/net.c:1.1.1.2 mtr/net.c:1.11
--- mtr/net.c:1.1.1.2	Wed Mar  8 09:58:55 2000
+++ mtr/net.c	Wed Jul 19 23:40:09 2000
@@ -17,6 +17,7 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     
    1999-08-13 ok Olav@okvittem.priv.no  added -psize
+   2000-06-16 kbyanc@egroups.net	improved ipv6 support
 
 */
 
@@ -30,14 +31,29 @@
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#ifdef ENABLE_IPV6
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+#endif
 #include <memory.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <math.h>
 #include <errno.h>
+#include <netdb.h>
 
 #include "net.h"
+#include "display.h"
+
+#ifndef ENABLE_IPV6
+#define sockaddr_storage sockaddr
+#undef ss_len
+#define ss_len sa_len
+#undef ss_family
+#define ss_family sa_family
+#endif
 
+#define ICMP6ECHOLEN	8
 
 
 #define MaxTransit 4
@@ -82,7 +98,16 @@
 
 
 struct nethost {
-  uint32 addr;
+  union {
+    struct sockaddr_in _addr4;
+#define addr4 _addr._addr4.sin_addr
+#ifdef ENABLE_IPV6
+    struct sockaddr_in6 _addr6;
+#define addr6 _addr._addr6.sin6_addr
+#endif
+    struct sockaddr _addr0;
+#define addr0 _addr._addr0
+  } _addr;
   int xmit;
   int returned;
   long long total;
@@ -111,10 +136,11 @@
 static struct sequence sequence[MaxSequence];
 static struct timeval reset = { 0, 0 };
 
-int timestamp;
-int sendsock;
-int recvsock;
-struct sockaddr_in remoteaddress;
+static int sendsock4 = -1, recvsock4 = -1;
+#ifdef ENABLE_IPV6
+static int sendsock6 = -1, recvsock6 = -1;
+#endif
+static struct sockaddr_storage remoteaddress;
 static int batch_at = 0;
 
 
@@ -151,7 +177,7 @@
 
 static int BSDfix = 0;
 
-int new_sequence(int index) {
+static int new_sequence(int index) {
   static int next_sequence = 0;
   int seq;
 
@@ -171,7 +197,7 @@
 }
 
 /*  Attempt to find the host at a particular number of hops away  */
-void net_send_query(int index) {
+static void net4_send_query(int index) {
   /*ok  char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)];*/
   char packet[MAXPACKET];
   struct IPHeader *ip;
@@ -181,6 +207,9 @@
   int rv;
   static int first=1;
 
+  if ( sendsock4 < 0 )
+    return;
+
   if ( packetsize < MINPACKET ) packetsize = MINPACKET;
   if ( packetsize > MAXPACKET ) packetsize = MAXPACKET;
   memset(packet, 0, packetsize);
@@ -196,7 +225,7 @@
   ip->ttl = index + 1;
   ip->protocol = IPPROTO_ICMP;
   ip->saddr = 0;
-  ip->daddr = remoteaddress.sin_addr.s_addr;
+  ip->daddr = ((struct sockaddr_in *)&remoteaddress)->sin_addr.s_addr;
 
   icmp->type = ICMP_ECHO;
   icmp->id = getpid();
@@ -206,26 +235,153 @@
   ip->check = checksum(ip, packetsize);
 
   gettimeofday(&sequence[icmp->sequence].time, NULL);
-  rv = sendto(sendsock, packet, packetsize, 0, 
-	 (struct sockaddr *)&remoteaddress, sizeof(remoteaddress));
+  rv = sendto(sendsock4, packet, packetsize, 0, 
+	 (struct sockaddr *)&remoteaddress,
+#ifdef linux
+	 SA_LEN((struct sockaddr *)&remoteaddress)
+#else
+	 remoteaddress.ss_len
+#endif
+	 );
   if (first && (rv < 0) && (errno == EINVAL)) {
     ip->len = packetsize;
-    rv = sendto(sendsock, packet, packetsize, 0, 
-		(struct sockaddr *)&remoteaddress, sizeof(remoteaddress));
+    rv = sendto(sendsock4, packet, packetsize, 0, 
+		(struct sockaddr *)&remoteaddress,
+#ifdef linux
+		SA_LEN((struct sockaddr *)&remoteaddress)
+#else
+		remoteaddress.ss_len
+#endif
+		);
     if (rv >= 0) {
       fprintf (stderr, "You've got a broken (FreeBSD?) system\n");
       BSDfix = 1;
     }
   }
+  if (rv < 0) {
+    perror("sendto");
+    exit(1);
+  }
   first = 0;
 }
 
+#ifdef ENABLE_IPV6
+static void net6_send_query(int index) {
+  /*ok  char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)];*/
+  char packet[MAXPACKET];
+  struct icmp6_hdr *icmp6;
+
+  /*ok  int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + datasize;*/
+  int rv;
+  static int first=1;
+  int hops;
+
+  if (sendsock6 < 0)
+    return;
+
+  if (packetsize < MINPACKET) packetsize = MINPACKET;
+  if (packetsize > MAXPACKET) packetsize = MAXPACKET;
+  memset(packet, 0, packetsize);
+
+  hops = index + 1;
+  if (setsockopt(sendsock6, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
+	&hops, sizeof(hops)) < 0) {
+    perror("setsockopt(IPV6_UNICAST_HOPS)");
+    exit(1);
+  }
+
+  icmp6 = (struct icmp6_hdr *)packet;
+
+  icmp6->icmp6_type = ICMP6_ECHO_REQUEST;
+  icmp6->icmp6_code = 0;
+  icmp6->icmp6_cksum = 0;
+  icmp6->icmp6_seq = new_sequence(index);
+  icmp6->icmp6_id = getpid() & 0xffff;
+
+  gettimeofday(&sequence[icmp6->icmp6_seq].time, NULL);
+  rv = sendto(sendsock6, packet, packetsize, 0, 
+	 (struct sockaddr *)&remoteaddress,
+#ifdef linux
+	 SA_LEN((struct sockaddr *)&remoteaddress)
+#else
+	 remoteaddress.ss_len
+#endif
+	);
+  if (rv < 0) {
+    perror("sendto");
+    exit(1);
+  }
+  first = 0;
+}
+#endif
+
+void net_send_query(int index) {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    net4_send_query(index);
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    net6_send_query(index);
+    break;
+#endif
+  }
+}
+
 /*   We got a return on something we sent out.  Record the address and
      time.  */
-void net_process_ping(int seq, uint32 addr, struct timeval now) {
+void net4_process_ping(int seq, uint32 addr, struct timeval now) {
+  int index;
+  int totusec;
+
+  if(sendsock4 < 0)
+    return;
+
+  if(seq < 0 || seq >= MaxSequence)
+    return;
+
+  if(!sequence[seq].transit)
+    return;
+  sequence[seq].transit = 0;
+
+  index = sequence[seq].index;
+
+  totusec = (now.tv_sec  - sequence[seq].time.tv_sec ) * 1000000 +
+            (now.tv_usec - sequence[seq].time.tv_usec);
+
+  if(host[index].addr4.s_addr == 0) {
+    host[index].addr0.sa_family = AF_INET;
+#ifndef linux
+    host[index].addr0.sa_len = sizeof(struct sockaddr_in);
+#endif
+    host[index].addr4.s_addr = addr;
+    display_rawhost(index, &host[index].addr0);
+  }
+  if(host[index].returned <= 0) {
+    host[index].best = host[index].worst = totusec;
+  }
+  host[index].last = totusec;
+  if(totusec < host[index].best)
+    host[index].best = totusec;
+  if(totusec > host[index].worst)
+    host[index].worst = totusec;
+
+  host[index].total += totusec;
+  host[index].returned++;
+  host[index].transit = 0;
+
+  net_save_return(index, sequence[seq].saved_seq, totusec);
+  display_rawping(index, totusec);
+}
+
+#ifdef ENABLE_IPV6
+void net6_process_ping(int seq, struct in6_addr *addr, struct timeval now) {
   int index;
   int totusec;
 
+  if(sendsock6 < 0)
+    return;
+
   if(seq < 0 || seq >= MaxSequence)
     return;
 
@@ -238,9 +394,13 @@
   totusec = (now.tv_sec  - sequence[seq].time.tv_sec ) * 1000000 +
             (now.tv_usec - sequence[seq].time.tv_usec);
 
-  if(host[index].addr == 0) {
-    host[index].addr = addr;
-    display_rawhost(index, host[index].addr);
+  if(IN6_IS_ADDR_UNSPECIFIED(&host[index].addr6)) {
+    host[index].addr0.sa_family = AF_INET6;
+#ifndef linux
+    host[index].addr0.sa_len = sizeof(struct sockaddr_in6);
+#endif
+    host[index].addr6 = *addr;
+    display_rawhost(index, &host[index].addr0);
   }
   if(host[index].returned <= 0) {
     host[index].best = host[index].worst = totusec;
@@ -258,23 +418,25 @@
   net_save_return(index, sequence[seq].saved_seq, totusec);
   display_rawping(index, totusec);
 }
+#endif
 
 /*  We know a packet has come in, because the main select loop has called us,
     now we just need to read it, see if it is for us, and if it is a reply 
-    to something we sent, then call net_process_ping()  */
-void net_process_return() {
+    to something we sent, then call net4_process_ping()  */
+static void net4_process_return() {
   char packet[2048];
   struct sockaddr_in fromaddr;
   int fromaddrsize;
   int num;
-  int at;
   struct ICMPHeader *header;
   struct timeval now;
 
+  if(recvsock4 < 0) return;
+
   gettimeofday(&now, NULL);
 
   fromaddrsize = sizeof(fromaddr);
-  num = recvfrom(recvsock, packet, 2048, 0, 
+  num = recvfrom(recvsock4, packet, 2048, 0, 
 		 (struct sockaddr *)&fromaddr, &fromaddrsize);
 
   if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader))
@@ -285,7 +447,7 @@
     if(header->id != (uint16)getpid())
       return;
 
-    net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
+    net4_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
   } else if(header->type == ICMP_TIME_EXCEEDED) {
     if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + 
              sizeof(struct IPHeader) + sizeof(struct ICMPHeader))
@@ -295,13 +457,69 @@
 				sizeof(struct ICMPHeader) + sizeof(struct IPHeader));
     if(header->id != (uint16)getpid())
       return;
+
+    net4_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
+  }
+}
+
+#ifdef ENABLE_IPV6
+static void net6_process_return() {
+  char packet[2048];
+  struct sockaddr_storage fromaddr;
+  int fromaddrsize;
+  int num;
+  struct icmp6_hdr *header;
+  struct timeval now;
+
+  if(recvsock6 < 0) return;
+
+  gettimeofday(&now, NULL);
+
+  fromaddrsize = sizeof(fromaddr);
+  num = recvfrom(recvsock6, packet, 2048, 0, 
+		 (struct sockaddr *)&fromaddr, &fromaddrsize);
+
+  if (num < sizeof(struct icmp6_hdr))
+    return;
+
+  header = (struct icmp6_hdr *)packet;
+  if(header->icmp6_type == ICMP6_ECHO_REPLY) {
+    if(header->icmp6_id != (uint16)(getpid() & 0xffff))
+      return;
+
+    net6_process_ping(header->icmp6_seq,
+      &((struct sockaddr_in6 *)&fromaddr)->sin6_addr, now);
+  } else if (header->icmp6_type == ICMP6_TIME_EXCEEDED) {
+    if(num < sizeof(struct icmp6_hdr) + 
+             sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr))
+      return;
+    
+    header = (struct icmp6_hdr *)(packet + sizeof(struct icmp6_hdr)
+					    + sizeof(struct ip6_hdr));
+    if(header->icmp6_id != (getpid() & 0xffff))
+      return;
 
-    net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
+    net6_process_ping(header->icmp6_seq,
+      &((struct sockaddr_in6 *)&fromaddr)->sin6_addr, now);
   }
 }
+#endif
+
+void net_process_return() {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    net4_process_return();
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    net6_process_return();
+    break;
+#endif
+  }
+}
 
-int net_addr(int at) {
-  return ntohl(host[at].addr);
+const struct sockaddr *net_addr(int at) {
+  return &host[at].addr0;
 }
 
 int net_percent(int at) {
@@ -330,15 +548,47 @@
   return host[at].total / host[at].returned;
 }
 
+static int finaladdr(int at) {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    if (host[at].addr4.s_addr == ((struct sockaddr_in *)&remoteaddress)->sin_addr.s_addr)
+      return 1;
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    if (IN6_ARE_ADDR_EQUAL(&host[at].addr6, &((struct sockaddr_in6 *)&remoteaddress)->sin6_addr))
+      return 1;
+    break;
+#endif
+  }
+  return 0;
+}
+
+static int unspecaddr(int at) {
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    if (host[at].addr4.s_addr == 0)
+      return 1;
+    break;
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    if (IN6_IS_ADDR_UNSPECIFIED(&host[at].addr6))
+      return 1;
+    break;
+#endif
+  }
+  return 0;
+}
+
 int net_max() {
   int at;
   int max;
 
   max = 0;
   for(at = 0; at < MaxHost-2; at++) {
-    if(host[at].addr == remoteaddress.sin_addr.s_addr) {
+    if(finaladdr(at)) {
       return at + 1;
-    } else if(host[at].addr != 0) {
+    } else if(!unspecaddr(at)) {
       max = at + 2;
     }
   }
@@ -376,13 +626,13 @@
   n_unknown = 0;
 
   for (i=0;i<batch_at;i++) {
-    if (host[i].addr == 0)
+    if (unspecaddr(i))
       n_unknown++;
-    if (host[i].addr == remoteaddress.sin_addr.s_addr)
+    if (finaladdr(i))
       n_unknown = 100; /* Make sure we drop into "we should restart" */
   }
 
-  if ((host[batch_at].addr == remoteaddress.sin_addr.s_addr) ||
+  if (finaladdr(batch_at) ||
       (n_unknown > MAX_UNKNOWN_HOSTS) ||
       (batch_at >= MaxHost-2)) {
     numhosts = batch_at+1;
@@ -398,50 +648,146 @@
 int net_preopen() {
   int trueopt = 1;
 
-  sendsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
-  if(sendsock < 0)
-    return -1;
+  sendsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
 
 #ifdef IP_HDRINCL
   /*  FreeBSD wants this to avoid sending out packets with protocol type RAW
       to the network.  */
-  if(setsockopt(sendsock, SOL_IP, IP_HDRINCL, &trueopt, sizeof(trueopt)))
+  if(setsockopt(sendsock4, SOL_IP, IP_HDRINCL, &trueopt, sizeof(trueopt)))
   {
     perror("setsockopt(IP_HDRINCL,1)");
-    return -1;
+    sendsock4 = -1;
   }
 #endif
 
-  recvsock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
-  if(recvsock < 0)
+  if(sendsock4 >= 0)
+    recvsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+  if(recvsock4 < 0) {
+    close(sendsock4);
+    sendsock4 = -1;
+  }
+
+#ifdef ENABLE_IPV6
+  sendsock6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+
+  if(sendsock6 >= 0)
+    recvsock6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+  if(recvsock6 < 0) {
+    close(sendsock6);
+    sendsock6 = -1;
+  }
+
+  /* Make sure we have either a valid IPV4 or IPV6 socket pair. */
+  if(((recvsock4 < 0) || (sendsock4 < 0)) &&
+     ((recvsock6 < 0) || (sendsock6 < 0)))
+    return -1;
+#else
+  /* Make sure we have either a valid IPV4 socket pair. */
+  if((recvsock4 < 0) || (sendsock4 < 0))
     return -1;
+#endif
 
   return 0;
 }
  
-int net_open(int addr) {
+int net4_open(int addr) {
+  struct sockaddr_in *sin;
+
+  if(sendsock4 < 0)
+    return(-1);
+
   net_reset();
+#if 0
+  if (sendsock6 >= 0)
+    close(sendsock6);
+  sendsock6 = -1;
+  if (recvsock6 >= 0)
+    close(recvsock6);
+  recvsock6 = -1;
+#endif
 
-  remoteaddress.sin_family = AF_INET;
-  remoteaddress.sin_addr.s_addr = addr;
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin = (struct sockaddr_in *)&remoteaddress;
+  sin->sin_family = AF_INET;
+#ifndef linux
+  sin->sin_len = sizeof(struct sockaddr_in);
+#endif
+  sin->sin_addr.s_addr = addr;
 
   return 0;
 }
 
-void net_reopen(int addr) {
+void net4_reopen(int addr) {
+  struct sockaddr_in *sin;
   int at;
 
   for(at = 0; at < MaxHost; at++) {
     memset(&host[at], 0, sizeof(host[at]));
   }
 
-  remoteaddress.sin_family = AF_INET;
-  remoteaddress.sin_addr.s_addr = addr;
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin = (struct sockaddr_in *)&remoteaddress;
+  sin->sin_family = AF_INET;
+#ifndef linux
+  sin->sin_len = sizeof(struct sockaddr_in);
+#endif
+  sin->sin_addr.s_addr = addr;
 
   net_reset ();
   net_send_batch();
 }
 
+#ifdef ENABLE_IPV6
+int net6_open(struct in6_addr *addr) {
+  struct sockaddr_in6 *sin6;
+
+  if(sendsock6 < 0)
+    return(-1);
+
+  net_reset();
+#if 0
+  if (sendsock4 >= 0)
+    close(sendsock4);
+  sendsock4 = -1;
+  if (recvsock4 >= 0)
+    close(recvsock4);
+  recvsock4 = -1;
+#endif
+
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin6 = (struct sockaddr_in6 *)&remoteaddress;
+  sin6->sin6_family = AF_INET6;
+#ifndef linux
+  sin6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
+  memcpy(&sin6->sin6_addr, addr, sizeof(*addr));
+
+  return 0;
+}
+
+void net6_reopen(struct in6_addr *addr) {
+  struct sockaddr_in6 *sin6;
+  int at;
+
+  if(sendsock6 < 0) return;
+
+  for(at = 0; at < MaxHost; at++) {
+    memset(&host[at], 0, sizeof(host[at]));
+  }
+
+  memset(&remoteaddress, 0, sizeof(remoteaddress));
+  sin6 = (struct sockaddr_in6 *)&remoteaddress;
+  sin6->sin6_family = AF_INET6;
+#ifndef linux
+  sin6->sin6_len = sizeof(struct sockaddr_in6);
+#endif
+  memcpy(&sin6->sin6_addr, addr, sizeof(*addr));
+
+  net_reset ();
+  net_send_batch();
+}
+#endif
+
 void net_reset() {
   int at;
   int i;
@@ -469,12 +815,39 @@
 }
 
 void net_close() {
-  close(sendsock);
-  close(recvsock);
+  if (sendsock4 >= 0)
+    close(sendsock4);
+  if (recvsock4 >= 0)
+    close(recvsock4);
+#ifdef ENABLE_IPV6
+  if (sendsock6 >= 0)
+    close(sendsock6);
+  if (recvsock6 >= 0)
+    close(recvsock6);
+#endif
+}
+
+int net4_waitfd() {
+  return recvsock4;
 }
 
+#ifdef ENABLE_IPV6
+int net6_waitfd() {
+  return recvsock6;
+}
+#endif
+
 int net_waitfd() {
-  return recvsock;
+  switch (remoteaddress.ss_family) {
+  case AF_INET:
+    return net4_waitfd();
+#ifdef ENABLE_IPV6
+  case AF_INET6:
+    return net6_waitfd();
+#endif
+  default:
+    return -1;
+  }
 }
 
 
Index: mtr/net.h
diff -u mtr/net.h:1.1.1.1 mtr/net.h:1.5
--- mtr/net.h:1.1.1.1	Sat Aug 28 04:25:00 1999
+++ mtr/net.h	Wed Sep  8 11:30:08 1999
@@ -19,16 +19,27 @@
 
 /*  Prototypes for functions in net.c  */
 
+struct in6_addr;
+
 int net_preopen();
-int net_open(int address);
-void net_reopen(int address);
+int net4_open(int address);
+void net4_reopen(int address);
+#ifdef ENABLE_IPV6
+int net6_open(struct in6_addr *address);
+void net6_reopen(struct in6_addr *address);
+#endif
 void net_reset();
 void net_close();
 int net_waitfd();
+int net4_waitfd();
+#ifdef ENABLE_IPV6
+int net6_waitfd();
+#endif
 void net_process_return();
 int net_max();
-int net_addr(int at);
+const struct sockaddr *net_addr(int at);
 int net_percent(int at);
+int net_last(int at);
 int net_best(int at);
 int net_worst(int at);
 int net_avg(int at);
Index: mtr/raw.c
diff -u mtr/raw.c:1.1.1.1 mtr/raw.c:1.7
--- mtr/raw.c:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/raw.c	Thu Jan 13 13:32:00 2000
@@ -22,6 +22,9 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netdb.h>
 
 
 #include "raw.h"
@@ -30,6 +33,7 @@
 
 static int havename[MaxHost];
 
+#if 0
 static char *addr_to_str(int addr)
 {
   static char buf[20];
@@ -41,14 +45,14 @@
 	   (addr >> 24) & 0xff);
   return buf;
 }
+#endif
 
-
 void raw_rawping (int host, int msec)
 {
-  char *name;
+  const char *name;
 
   if (!havename[host]) {
-    name = dns_lookup2(net_addr(host));
+    name = dns_lookup2((struct sockaddr *)net_addr(host));
     if (name) {
       havename[host]++;
       printf ("d %d %s\n", host, name);
@@ -58,9 +62,17 @@
 }
 
 
-void raw_rawhost (int host, int ip_addr)
+void raw_rawhost (int host, struct sockaddr *addr)
 {
-  printf ("h %d %s\n", host, addr_to_str (ip_addr));
+  char hbuf[128];
+  getnameinfo(addr,
+#ifdef linux
+	SA_LEN(addr),
+#else
+	addr->sa_len,
+#endif
+	hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+  printf ("h %d %s\n", host, hbuf);
 }
 
 
Index: mtr/raw.h
diff -u mtr/raw.h:1.1.1.1 mtr/raw.h:1.2
--- mtr/raw.h:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/raw.h	Fri Sep  3 02:12:37 1999
@@ -21,4 +21,4 @@
 
 /*  Prototypes for raw.c  */
 void raw_rawping(int host, int msec);
-void raw_rawhost(int host, int addr);
+void raw_rawhost(int host, struct sockaddr *addr);
Index: mtr/report.c
diff -u mtr/report.c:1.1.1.1 mtr/report.c:1.4
--- mtr/report.c:1.1.1.1	Sat Aug 28 04:25:03 1999
+++ mtr/report.c	Wed Sep  8 11:30:08 1999
@@ -36,10 +36,9 @@
 }
 
 void report_close() {
-  int at, max, addr;
-  int haddr;
-  char name[81];
-  struct hostent *host;
+  int at, max;
+  const struct sockaddr *addr;
+  char name[128];
 
   max = net_max();
 
@@ -50,16 +49,13 @@
     if(addr == 0) {
       sprintf(name, "???");
     } else {
-      haddr = htonl(addr);
-      host = dns?gethostbyaddr((char *)&haddr, sizeof(int), AF_INET):NULL;
-
-      if (host != NULL) {
-	 strncpy(name, host->h_name, 80);
-	 name[80] = 0;
-      } else {
-	sprintf(name, "%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-		(addr >> 8) & 0xff, addr & 0xff);
-      }
+      getnameinfo(addr,
+#ifdef linux
+		SA_LEN(addr),
+#else
+		addr->sa_len,
+#endif
+		name, sizeof(name), NULL, 0, dns ? 0 : NI_NUMERICHOST);
     }
 
     /* Coding tip: 
Index: mtr/select.c
diff -u mtr/select.c:1.1.1.1 mtr/select.c:1.2
--- mtr/select.c:1.1.1.1	Sat Aug 28 04:25:06 1999
+++ mtr/select.c	Wed Sep  8 11:30:08 1999
@@ -20,6 +20,7 @@
 #include <config.h>
 #include <sys/types.h>
 #include <sys/time.h>
+#include <sys/socket.h>
 #include <unistd.h>
 #include <time.h>
 #include <string.h>
@@ -45,7 +46,6 @@
   int NumPing;
   int paused;
   struct timeval lasttime, thistime, selecttime;
-  float wt;
   int dt;
 
   NumPing = 0; 
Index: mtr/split.c
diff -u mtr/split.c:1.1.1.1 mtr/split.c:1.4
--- mtr/split.c:1.1.1.1	Sat Aug 28 04:25:09 1999
+++ mtr/split.c	Wed Sep  8 11:30:08 1999
@@ -24,13 +24,14 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
 
 #include "display.h"
 #include "dns.h"
-/*
 #include "net.h"
 #include "split.h"
-*/
 
 #include <config.h>
 
@@ -71,10 +72,11 @@
 split_redraw() {
   int   max;
   int   at;
-  int   addr;
-  char *name;
+  const struct sockaddr *addr;
+  const char *name;
   char  newLine[MAX_LINE_SIZE];
   int   i;
+  char hbuf[128];
 
 #if DEBUG
   fprintf(stderr, "split_redraw()\n"); 
@@ -97,7 +99,7 @@
     addr = net_addr(at);
     
     if(addr != 0) {
-      name = dns_lookup(addr);
+      name = dns_lookup((struct sockaddr *)addr);
       if(name != NULL) {
 	/* May be we should test name's length */
 	sprintf(newLine, "%s %d %d %d %d %d %d", name,
@@ -106,9 +108,15 @@
 		net_best(at) /1000, net_avg(at)/1000, 
 		net_worst(at)/1000);
       } else {
-	sprintf(newLine, "%d.%d.%d.%d %d %d %d %d %d %d", 
-		(addr >> 24) & 0xff, (addr >> 16) & 0xff, 
-		(addr >> 8) & 0xff, addr & 0xff,
+	getnameinfo(addr,
+#ifdef linux
+			SA_LEN(addr),
+#else
+			addr->sa_len,
+#endif
+			hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+	sprintf(newLine, "%s %d %d %d %d %d %d", 
+		hbuf,
 		net_percent(at),
 		net_returned(at), net_xmit(at),
 		net_best(at) /1000, net_avg(at)/1000, 
Index: mtr/img/.cvsignore
diff -u /dev/null mtr/img/.cvsignore:1.1
--- /dev/null	Wed Jul 19 23:40:37 2000
+++ mtr/img/.cvsignore	Fri Sep  3 00:29:09 1999
@@ -0,0 +1 @@
+Makefile
Index: mtr/img/Makefile.in
diff -u mtr/img/Makefile.in:1.1.1.2 mtr/img/Makefile.in:1.3
--- mtr/img/Makefile.in:1.1.1.2	Wed Mar  8 09:58:58 2000
+++ mtr/img/Makefile.in	Thu Jan 27 14:50:20 2000
@@ -58,6 +58,7 @@
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 CC = @CC@
+CPP = @CPP@
 CURSES_OBJ = @CURSES_OBJ@
 GTK_CFLAGS = @GTK_CFLAGS@
 GTK_CONFIG = @GTK_CONFIG@
@@ -81,9 +82,9 @@
 all: all-redirect
 .SUFFIXES:
 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
-	cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps img/Makefile
+	cd $(top_srcdir) && $(AUTOMAKE) --gnu img/Makefile
 
-Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
+Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
 	cd $(top_builddir) \
 	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
@@ -96,6 +97,11 @@
 subdir = img
 
 distdir: $(DISTFILES)
+	here=`cd $(top_builddir) && pwd`; \
+	top_distdir=`cd $(top_distdir) && pwd`; \
+	distdir=`cd $(distdir) && pwd`; \
+	cd $(top_srcdir) \
+	  && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu img/Makefile
 	@for file in $(DISTFILES); do \
 	  d=$(srcdir); \
 	  if test -d $$d/$$file; then \
