diff --git a/.gitignore b/.gitignore index 4cefe3e..ec6d288 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,6 @@ stamp-h1* /ChangeLog /INSTALL /mtr +/version.h +/version.h.tmp diff --git a/AUTHORS b/AUTHORS index 690151a..ccff487 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,44 +13,44 @@ (Reverse alphabetical order, and sometimes I just add people at the end... ) - Bohdan Vlasyuk (bohdan@cec.vstu.vinnica.ua) - Evgeniy Tretyak (evtr@ukr.net) - John Thacker (thacker@math.cornell.edu) + Bohdan Vlasyuk + Evgeniy Tretyak + John Thacker Juha Takala - David Sward (sward@clark.net) - David Stone (stone@AsIf.com) + David Sward + David Stone Andrew Stesin - Greg Stark (gsstark@mit.edu) - Robert Sparks (rjsparks@nostrum.com) - Mike Simons (msimons@moria.simons-clan.com) - Aaron Scarisbrick, - Craig Milo Rogers (Rogers@ISI.EDU) + Greg Stark + Robert Sparks + Mike Simons + Aaron Scarisbrick + Craig Milo Rogers Antonio Querubin - Russell Nelson (rn-mtr@crynwr.com) - Davin Milun (milun@acm.org) - Josh Martin (jmartin@columbiaservices.net) - Alexander V. Lukyanov (lav@yars.free.net) - Charles Levert (charles@comm.polymtl.ca) - Bertrand Leconte (B.Leconte@mail.dotcom.fr) + Russell Nelson + Davin Milun + Josh Martin + Alexander V. Lukyanov + Charles Levert + Bertrand Leconte Anand Kumria - Olav Kvittem (Olav.Kvittem@uninett.no) - Adam Kramer (l3zqc@qcunix1.acc.qc.edu) - Philip Kizer (pckizer@nostrum.com) + Olav Kvittem + Adam Kramer + Philip Kizer Simon Kirby Christophe Kalt - Steve Kann (stevek@spheara.horizonlive.com) - Brett Johnson (brett@jdacareers.com) - Roland Illig (roland.illig@gmx.de) - Damian Gryski (dgryski@uwaterloo.ca) - Rob Foehl (rwf@loonybin.net) + Steve Kann + Brett Johnson + Roland Illig + Damian Gryski + Rob Foehl Mircea Damian - Cougar (cougar@random.ee) + Cougar Travis Cross Brian Casey - Andrew Brown (atatat@atatdot.net) - Bill Bogstad (bogstad@pobox.com) - Marc Bejarano (marc.bejarano@openwave.com) - Moritz Barsnick (barsnick@gmx.net) + Andrew Brown + Bill Bogstad + Marc Bejarano + Moritz Barsnick Thomas Klausner and anyone who has slipped through the cracks of my mail file. diff --git a/Makefile.am b/Makefile.am index 013ef42..4a767fa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,10 +17,24 @@ mtr_SOURCES = mtr.c \ select.c select.h \ mtr-curses.h \ mtr-gtk.h +nodist_mtr_SOURCES = version.h EXTRA_mtr_SOURCES = curses.c \ gtk.c +DEFAULT_INCLUDES= $(GLIB_CFLAGS) -I. mtr_DEPENDENCIES = $(GTK_OBJ) $(CURSES_OBJ) -mtr_LDFLAGS = $(GTK_OBJ) $(CURSES_OBJ) +mtr_LDFLAGS = $(GTK_OBJ) $(CURSES_OBJ) $(GLIB_LIBS) + +CLEANFILES = version.h +BUILT_SOURCES = version.h + +version.h: version.h.tmp Makefile $(mtr_SOURCES) + @cat version.h.tmp > $@; \ + if [ -d .git ] && [ -n "$$(which git)" ]; then \ + xver="+git:$$(git rev-list -n1 --abbrev=8 --abbrev-commit HEAD)"; \ + sed \ + -e "/#define *MTR_VERSION */{s/\"\([^\"]*\)\"/\"\1$$xver\"/;}" \ + version.h.tmp > $@; \ + fi; EXTRA_DIST = SECURITY mtr.8 Makefile Makefile.dist distclean-local: diff --git a/README b/README index 72be08c..c7588d0 100644 --- a/README +++ b/README @@ -70,22 +70,21 @@ INSTALLING WHERE CAN I GET THE LATEST VERSION OR MORE INFORMATION? + mtr is now hosted on github. + https://github.com/traviscross/mtr + See the mtr web page at http://www.BitWizard.nl/mtr/ - Subscribe to the mtr mailing list. All mtr related announcements - are posted to the mtr mailing list. To subscribe, send email to - the 'mtr-subscribe' with the hostname part set to 'BitWizard.nl'. - The body or subject of the message doesn't matter. To send an - Email to the list, mail to the username part set to 'mtr'. To - prevent SPAM to this list, please don't put the full name on - the internet. + There used to be a mailinglist, but all it got was spam. So + when the server was upgraded, the mailing list died. - Bug reports and feature requests should be submitted the mailing - list. + Bug reports and feature requests should be submitted to the + bug tracker at launchpad: https://launchpad.net/mtr/+bugs Patches can be submitted by Email to me, or submitted to the - mailing list. Please use unified diffs. Usually the diff is sort of + bug tracker. Or you can clone the github repository and issue a pull + request. Please use unified diffs. Usually the diff is sort of messy, so please check that the diff is clean and doesn't contain too much of your local stuff (for example, I don't want/need the "configure" script that /your/ automake made for you). diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..8f1d319 --- /dev/null +++ b/configure.ac @@ -0,0 +1,164 @@ +AC_INIT([mtr], [0.83]) +AC_CONFIG_SRCDIR([mtr.c]) +AM_INIT_AUTOMAKE([foreign]) + +AC_CONFIG_FILES([version.h.tmp:version.h.in]) + +AC_SUBST(GTK_OBJ) +AC_SUBST(CURSES_OBJ) + +GTK_OBJ=gtk.o +CURSES_OBJ=curses.o + +AC_PROG_CC + +AC_CHECK_SIZEOF(unsigned char, 1) +AC_CHECK_SIZEOF(unsigned short, 2) +AC_CHECK_SIZEOF(unsigned int, 4) +AC_CHECK_SIZEOF(unsigned long, 4) + +AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h fcntl.h) +AC_CHECK_HEADERS(socket.h sys/socket.h sys/xti.h) + +# Some doc I found somewhere. :-) -- REW +# - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +# - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) + +# We don't refer to any symbols in termcap, but -lcurses on SunOS does. +# 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). +AC_CHECK_LIB(termcap, tgetent) + +AC_CHECK_FUNC(initscr, , + AC_CHECK_LIB(ncurses, initscr, , + AC_CHECK_LIB(curses, initscr, , + AC_CHECK_LIB(cursesX, initscr, , + AC_MSG_WARN(Building without curses display support) + AC_DEFINE(NO_CURSES, 1, Define if you don't have the curses libraries available.) + CURSES_OBJ=)))) + +AC_CHECK_FUNCS(attron fcntl) + +AC_CHECK_LIB(m, floor, , AC_MSG_ERROR(No math library found)) + +dnl Added ability to cleanly disable GTK+ (12 Jan 2000, Joseph Carter) +AC_ARG_WITH(gtk, +[ --without-gtk Do not try to use GTK+ at all], +WANTS_GTK=$withval, WANTS_GTK=yes) + +AC_ARG_ENABLE(ipv6, +[ --disable-ipv6 Do not enable IPv6], +WANTS_IPV6=$enableval, WANTS_IPV6=yes) + +if test "x$WANTS_GTK" = "xyes"; then + AM_PATH_GTK_2_0(2.6.0, CFLAGS="$CFLAGS $GTK_CFLAGS" + LIBS="$LIBS $GTK_LIBS -lm", + AC_MSG_WARN(Building without GTK2 display support) + AC_DEFINE(NO_GTK, 1, [Define if you don't have the GTK+ libraries available.]) + GTK_OBJ="") +else + AC_DEFINE(NO_GTK) + GTK_OBJ="" + PKG_CHECK_MODULES([GLIB], [glib-2.0]) +fi + +AC_CHECK_FUNC(socket, , + AC_CHECK_LIB(socket, socket, , AC_MSG_ERROR(No socket library found))) + +AC_CHECK_FUNC(gethostbyname, , + AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found))) + +#AC_CHECK_FUNC(res_init, , +# AC_CHECK_LIB(bind, res_init, , +# AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found)))) + +AC_CHECK_FUNCS(seteuid) +# AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) + +AC_CHECK_FUNC(res_mkquery, , + AC_CHECK_LIB(bind, res_mkquery, , + AC_CHECK_LIB(resolv, res_mkquery, , + AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found))))) +# This next line would override the just detected-or-not -lresolv. +# This apparently hurts BSD. And it's bad practise. So it should go. +# However, it probably didn't get added for nothing..... Holler if +# removing it hurts your OS.... -- REW +#LIBS="$LIBS -lresolv" + +AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR, 1, [Define if you don't have the herror() function available.])) +AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR, 1, [Define if you don't have the strerror() function available.])) + +AC_CHECK_FUNC(getaddrinfo, +[if test "$WANTS_IPV6" = "yes"; then + AC_DEFINE([ENABLE_IPV6], [], [Define to enable IPv6]) +fi]) + +AC_CHECK_DECLS(errno, , , [[ +#include +#include +]] ) + +AC_CHECK_TYPE(socklen_t, AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t]) , , [[ +#include +#ifdef HAVE_SOCKET_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +]]) + +AC_CHECK_TYPE(struct in_addr, AC_DEFINE([HAVE_STRUCT_INADDR], [], [Define if you have struct in_addr]), , [[ +#include +]]) + +dnl Add C flags to display more warnings +AC_MSG_CHECKING(for C flags to get more warnings) +ac_save_CFLAGS="$CFLAGS" +if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then + dnl gcc is the easiest C compiler + warning_CFLAGS="-Wall" + # Check if compiler supports -Wno-pointer-sign and add it if supports + CFLAGS_saved="$CFLAGS" + CFLAGS="$CFLAGS -Wno-pointer-sign" + AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ int foo; ]])], + [ warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign" ],) + CFLAGS="$CFLAGS_saved" +else + dnl Vendor supplied C compilers are a bit tricky + case "$host_os" in + dnl SGI IRIX with the MipsPRO C compiler + irix*) + CFLAGS="$CFLAGS -fullwarn" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("test");]])],[warning_CFLAGS="-fullwarn"],[]) + ;; + + dnl SunOS 4.x with the SparcWorks(?) acc compiler + sunos*) + if "$CC" = "acc" ; then + CFLAGS="$CFLAGS -vc" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("test");]])],[warning_CFLAGS="-vc"],[]) + fi + ;; + + dnl Unknown, do nothing + *) + warning_CFLAGS="none" + ;; + esac +fi +CFLAGS="$ac_save_CFLAGS" +if test "$warning_CFLAGS" = "none" ; then + AC_MSG_RESULT(none) +else + CFLAGS="$CFLAGS $warning_CFLAGS" + AC_MSG_RESULT($warning_CFLAGS) +fi + + + + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile img/Makefile]) +AC_OUTPUT + diff --git a/configure.in b/configure.in deleted file mode 100644 index 4b81c44..0000000 --- a/configure.in +++ /dev/null @@ -1,161 +0,0 @@ -AC_INIT(mtr.c) -AM_INIT_AUTOMAKE(mtr, 0.83) - - -AC_SUBST(GTK_OBJ) -AC_SUBST(CURSES_OBJ) - -GTK_OBJ=gtk.o -CURSES_OBJ=curses.o - -AC_PROG_CC - -AC_CHECK_SIZEOF(unsigned char, 1) -AC_CHECK_SIZEOF(unsigned short, 2) -AC_CHECK_SIZEOF(unsigned int, 4) -AC_CHECK_SIZEOF(unsigned long, 4) - -AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h fcntl.h) -AC_CHECK_HEADERS(socket.h sys/socket.h sys/xti.h) - -# Some doc I found somewhere. :-) -- REW -# - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -# - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) - -# We don't refer to any symbols in termcap, but -lcurses on SunOS does. -# 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). -AC_CHECK_LIB(termcap, tgetent) - -AC_CHECK_FUNC(initscr, , - AC_CHECK_LIB(ncurses, initscr, , - AC_CHECK_LIB(curses, initscr, , - AC_CHECK_LIB(cursesX, initscr, , - AC_MSG_WARN(Building without curses display support) - AC_DEFINE(NO_CURSES, 1, Define if you don't have the curses libraries available.) - CURSES_OBJ=)))) - -AC_CHECK_FUNCS(attron fcntl) - -AC_CHECK_LIB(m, floor, , AC_MSG_ERROR(No math library found)) - -dnl Added ability to cleanly disable GTK+ (12 Jan 2000, Joseph Carter) -AC_ARG_WITH(gtk, -[ --without-gtk Do not try to use GTK+ at all], -WANTS_GTK=$withval, WANTS_GTK=yes) - -AC_ARG_ENABLE(ipv6, -[ --disable-ipv6 Do not enable IPv6], -WANTS_IPV6=$enableval, WANTS_IPV6=yes) - -if test "x$WANTS_GTK" = "xyes"; then - AM_PATH_GTK_2_0(2.6.0, CFLAGS="$CFLAGS $GTK_CFLAGS" - LIBS="$LIBS $GTK_LIBS -lm", - AC_MSG_WARN(Building without GTK2 display support) - AC_DEFINE(NO_GTK, 1, [Define if you don't have the GTK+ libraries available.]) - GTK_OBJ="") -else - AC_DEFINE(NO_GTK) - GTK_OBJ="" -fi - -AC_CHECK_FUNC(socket, , - AC_CHECK_LIB(socket, socket, , AC_MSG_ERROR(No socket library found))) - -AC_CHECK_FUNC(gethostbyname, , - AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found))) - -#AC_CHECK_FUNC(res_init, , -# AC_CHECK_LIB(bind, res_init, , -# AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found)))) - -AC_CHECK_FUNCS(seteuid) -# AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) - -AC_CHECK_FUNC(res_mkquery, , - AC_CHECK_LIB(bind, res_mkquery, , - AC_CHECK_LIB(resolv, res_mkquery, , - AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found))))) -# This next line would override the just detected-or-not -lresolv. -# This apparently hurts BSD. And it's bad practise. So it should go. -# However, it probably didn't get added for nothing..... Holler if -# removing it hurts your OS.... -- REW -#LIBS="$LIBS -lresolv" - -AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR, 1, [Define if you don't have the herror() function available.])) -AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR, 1, [Define if you don't have the strerror() function available.])) - -AC_CHECK_FUNC(getaddrinfo, -[if test "$WANTS_IPV6" = "yes"; then - AC_DEFINE([ENABLE_IPV6], [], [Define to enable IPv6]) -fi]) - -AC_CHECK_DECLS(errno, , , [[ -#include -#include -]] ) - -AC_CHECK_TYPE(socklen_t, AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t]) , , [[ -#include -#ifdef HAVE_SOCKET_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -]]) - -AC_CHECK_TYPE(struct in_addr, AC_DEFINE([HAVE_STRUCT_INADDR], [], [Define if you have struct in_addr]), , [[ -#include -]]) - -dnl Add C flags to display more warnings -AC_MSG_CHECKING(for C flags to get more warnings) -ac_save_CFLAGS="$CFLAGS" -if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then - dnl gcc is the easiest C compiler - warning_CFLAGS="-Wall" - # Check if compiler supports -Wno-pointer-sign and add it if supports - CFLAGS_saved="$CFLAGS" - CFLAGS="$CFLAGS -Wno-pointer-sign" - AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ int foo; ]])], - [ warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign" ],) - CFLAGS="$CFLAGS_saved" -else - dnl Vendor supplied C compilers are a bit tricky - case "$host_os" in - dnl SGI IRIX with the MipsPRO C compiler - irix*) - CFLAGS="$CFLAGS -fullwarn" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("test");]])],[warning_CFLAGS="-fullwarn"],[]) - ;; - - dnl SunOS 4.x with the SparcWorks(?) acc compiler - sunos*) - if "$CC" = "acc" ; then - CFLAGS="$CFLAGS -vc" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[printf("test");]])],[warning_CFLAGS="-vc"],[]) - fi - ;; - - dnl Unknown, do nothing - *) - warning_CFLAGS="none" - ;; - esac -fi -CFLAGS="$ac_save_CFLAGS" -if test "$warning_CFLAGS" = "none" ; then - AC_MSG_RESULT(none) -else - CFLAGS="$CFLAGS $warning_CFLAGS" - AC_MSG_RESULT($warning_CFLAGS) -fi - - - - -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile img/Makefile]) -AC_OUTPUT - diff --git a/curses.c b/curses.c index 0652e87..dad7117 100644 --- a/curses.c +++ b/curses.c @@ -64,6 +64,7 @@ #include "net.h" #include "dns.h" #include "asn.h" +#include "version.h" #include #endif @@ -409,7 +410,8 @@ void mtr_curses_hosts(int startstat) name = dns_lookup(addrs); if (! net_up(at)) attron(A_BOLD); if (name != NULL) { - printw("\n %s", name); + if (show_ips) printw("\n %s (%s)", name, strlongip(addrs)); + else printw("\n %s", name); } else { printw("\n %s", strlongip( addrs ) ); } @@ -565,7 +567,7 @@ void mtr_curses_redraw(void) move(0, 0); attron(A_BOLD); - pwcenter("My traceroute [v" VERSION "]"); + pwcenter("My traceroute [v" MTR_VERSION "]"); attroff(A_BOLD); mvprintw(1, 0, "%s (%s)", LocalHostname, net_localaddr()); diff --git a/gtk.c b/gtk.c index 5a04b3e..b45ac81 100644 --- a/gtk.c +++ b/gtk.c @@ -26,9 +26,7 @@ #include #ifndef NO_GTK -#include -#include -#include +#include #include #include @@ -36,6 +34,7 @@ #include "net.h" #include "dns.h" #include "mtr-gtk.h" +#include "version.h" #include "img/mtr_icon.xpm" #endif @@ -125,6 +124,7 @@ gint Pause_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data) gint About_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data) { gchar *authors[] = { + "Matt Kimball ", "Roger Wolff ", "Bohdan Vlasyuk ", "Evgeniy Tretyak ", @@ -158,16 +158,18 @@ gint About_clicked(UNUSED GtkWidget *Button, UNUSED gpointer data) "Rob Foehl ", "Mircea Damian", "Cougar ", + "Travis Cross ", "Brian Casey", "Andrew Brown ", "Bill Bogstad ", "Marc Bejarano ", "Moritz Barsnick ", + "Thomas Klausner ", NULL }; gtk_show_about_dialog(GTK_WINDOW(main_window) - , "version", VERSION + , "version", MTR_VERSION , "copyright", "Copyright \xc2\xa9 1997,1998 Matt Kimball" , "website", "http://www.bitwizard.nl/mtr/" , "authors", authors diff --git a/mtr.c b/mtr.c index 044fac5..9246bb1 100644 --- a/mtr.c +++ b/mtr.c @@ -35,6 +35,7 @@ #include "report.h" #include "net.h" #include "asn.h" +#include "version.h" #ifdef ENABLE_IPV6 @@ -387,7 +388,7 @@ int main(int argc, char **argv) } if (PrintVersion) { - printf ("mtr " VERSION "\n"); + printf ("mtr " MTR_VERSION "\n"); exit(0); } diff --git a/version.h.in b/version.h.in new file mode 100644 index 0000000..d39e6a4 --- /dev/null +++ b/version.h.in @@ -0,0 +1,20 @@ +/* + mtr -- a network diagnostic tool + Copyright (C) 1997,1998 Matt Kimball + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define MTR_VERSION "@VERSION@" + .