WHAT'S NEW?
+ v0.56 Fixed compile warnings. Now compiles with -Wall. If your
+ compiler finds things mine didn't feel free to shout.
+
v0.55 Cleanup patch. I'm going to do some maintenance on MTR,
but I want to be able to say: Can you see which version
fixed/broke things for you, so you're going to see a
AC_INIT(mtr.c)
-AM_INIT_AUTOMAKE(mtr, 0.55)
+AM_INIT_AUTOMAKE(mtr, 0.56)
+
AC_SUBST(GTK_OBJ)
AC_SUBST(CURSES_OBJ)
AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR))
AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR))
+
+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_prog_gcc" = "xyes" ; then
+ dnl gcc is the easiest C compiler
+ warning_CFLAGS="-Wall"
+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_TRY_COMPILE([#include <stdio.h>],[printf("test");],
+ warning_CFLAGS="-fullwarn",)
+ ;;
+
+ dnl SunOS 4.x with the SparcWorks(?) acc compiler
+ sunos*)
+ if "$CC" = "acc" ; then
+ CFLAGS="$CFLAGS -vc"
+ AC_TRY_COMPILE([#include <stdio.h>],[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
+
+
+
+
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile img/Makefile)
extern float WaitTime;
+struct fields data_fields[MAXFLD] = {
+ /* Remark, Header, Format, Width, CallBackFunc */
+ { "<sp>: Space between fields", " ", " ", 1, &net_drop }, /* 0 */
+ { "L: Loss Ratio", "Loss%", " %4.1f%%", 6, &net_loss }, /* 1 */
+ { "D: Dropped Packets", "Drop", " %4d", 5, &net_drop }, /* 2 */
+ { "R: Received Packets", "Rcv", " %5d", 6, &net_returned}, /* 3 */
+ { "S: Sent Packets", "Snt", " %5d", 6, &net_xmit }, /* 4 */
+ { "N: Newest RTT(ms)", "Last", " %5.1f", 6, &net_last }, /* 5 */
+ { "B: Min/Best RTT(ms)", "Best", " %5.1f", 6, &net_best }, /* 6 */
+ { "A: Average RTT(ms)", "Avg", " %5.1f", 6, &net_avg }, /* 7 */
+ { "W: Max/Worst RTT(ms)", "Wrst", " %5.1f", 6, &net_worst }, /* 8 */
+ { "V: Standard Deviation", "StDev", " %5.1f", 6, &net_stdev }, /* 9 */
+ { "G: Geometric Mean", "Gmean", " %5.1f", 6, &net_gmean }, /* 10 */
+ { "J: Current Jitter", "Jttr", " %4.1f", 5, &net_jitter}, /* 11 */
+ { "M: Jitter Mean/Avg.", "Javg", " %4.1f", 5, &net_javg }, /* 12 */
+ { "X: Worst Jitter", "Jmax", " %4.1f", 5, &net_jworst}, /* 13 */
+ { "I: Interarrival Jitter", "Jint", " %4.1f", 5, &net_jinta }, /* 14 */
+ { 0, 0, 0, 0, 0 }
+};
+
+
+/* keys: the value in the array is the index number in data_fields[] */
+int fld_index[] = {
+ 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* ' ', 0,1..9 */
+ 7, 6, -1, 2, -1, -1, 10, -1, 14, 11, -1, 1, 12, /* A..M */
+ 5, -1, -1, -1, 3, 4, -1, -1, 9, 8, 13, -1, -1, /* N..Z */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* a..m */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* n..z */
+ -1
+};
void pwcenter(char *str) {
move(2,20);
refresh();
while ( (c=getch ()) != '\n' && i<MAXFLD ) {
- attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh;
+ attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh ();
buf[i++] = c; /* need more checking on 'c' */
}
buf[i] = '\0';
move(2,18);
refresh();
while ( (c=getch ()) != '\n' && i<MAXFLD ) {
- attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh;
+ attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh ();
buf[i++] = c; /* need more checking on 'c' */
}
buf[i] = '\0';
move(2,22);
refresh();
while ( (c=getch ()) != '\n' && i<MAXFLD ) {
- attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh;
+ attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh();
buf[i++] = c; /* need more checking on 'c' */
}
buf[i] = '\0';
move(2,11);
refresh();
while ( (c=getch ()) != '\n' && i<MAXFLD ) {
- attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh;
+ attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh();
buf[i++] = c; /* need more checking on 'c' */
}
buf[i] = '\0';
move(2,11);
refresh();
while ( (c=getch ()) != '\n' && i<MAXFLD ) {
- attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh;
+ attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh();
buf[i++] = c; /* need more checking on 'c' */
}
buf[i] = '\0';
move(2,9);
refresh();
while ( (c=getch ()) != '\n' && i<MAXFLD ) {
- attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh;
+ attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh();
buf[i++] = c; /* need more checking on 'c' */
}
buf[i] = '\0';
i = 0;
while ( (c=getch ()) != '\n' && i<MAXFLD ) {
- attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh;
- if( c>= 'A' && c<= 'Z' || c==' ') {
+ attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh();
+ if( (c>= 'A' && c<= 'Z') || c==' ') {
buf[i++] = c; /* only accept [ A-Z], can be extend to [a-z0-9] */
}
}
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <time.h>
#ifdef NO_STRERROR
extern int sys_nerr;
break;
if (i == _res.nscount){
sprintf(tempstring,"Resolver error: Received reply from unknown source: %s",
- strlongip(from.sin_addr.s_addr));
+ inet_ntoa(from.sin_addr));
restell(tempstring);
} else
parserespacket((byte *)resrecvbuf,r);
*/
#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <sys/time.h>
+#include <sys/types.h>
#ifndef NO_GTK
#include <stdlib.h>
GtkWidget *GetRow(int index) {
int addr;
- char str[256], *name;
+ char *name;
GtkWidget *Row, *Label;
Row = gtk_fixed_new();
for (i=fstTTL-1;i<batch_at;i++) {
if (host[i].addr == 0)
n_unknown++;
- if (host[i].addr == remoteaddress.sin_addr.s_addr)
+
+ if ((host[i].addr == remoteaddress.sin_addr.s_addr) ||
+ (host[i].addr == host[batch_at].addr))
n_unknown = MaxHost; /* Make sure we drop into "we should restart" */
}
-
if ( // success in reaching target
(host[batch_at].addr == remoteaddress.sin_addr.s_addr) ||
// fail in consecuitive MAX_UNKNOWN_HOSTS (firewall?)
int net_jworst(int at);
int net_javg(int at);
int net_jinta(int at);
+int net_addrs(int at, int i);
+
int net_send_batch();
void net_end_transit();
int (*net_xxx)();
};
-static struct fields data_fields[MAXFLD] = {
- /* Remark, Header, Format, Width, CallBackFunc */
- { "<sp>: Space between fields", " ", " ", 1, &net_drop }, /* 0 */
- { "L: Loss Ratio", "Loss%", " %4.1f%%", 6, &net_loss }, /* 1 */
- { "D: Dropped Packets", "Drop", " %4d", 5, &net_drop }, /* 2 */
- { "R: Received Packets", "Rcv", " %5d", 6, &net_returned}, /* 3 */
- { "S: Sent Packets", "Snt", " %5d", 6, &net_xmit }, /* 4 */
- { "N: Newest RTT(ms)", "Last", " %5.1f", 6, &net_last }, /* 5 */
- { "B: Min/Best RTT(ms)", "Best", " %5.1f", 6, &net_best }, /* 6 */
- { "A: Average RTT(ms)", "Avg", " %5.1f", 6, &net_avg }, /* 7 */
- { "W: Max/Worst RTT(ms)", "Wrst", " %5.1f", 6, &net_worst }, /* 8 */
- { "V: Standard Deviation", "StDev", " %5.1f", 6, &net_stdev }, /* 9 */
- { "G: Geometric Mean", "Gmean", " %5.1f", 6, &net_gmean }, /* 10 */
- { "J: Current Jitter", "Jttr", " %4.1f", 5, &net_jitter}, /* 11 */
- { "M: Jitter Mean/Avg.", "Javg", " %4.1f", 5, &net_javg }, /* 12 */
- { "X: Worst Jitter", "Jmax", " %4.1f", 5, &net_jworst}, /* 13 */
- { "I: Interarrival Jitter", "Jint", " %4.1f", 5, &net_jinta }, /* 14 */
- { 0, 0, 0, 0, 0 }
-};
+extern struct fields data_fields[MAXFLD];
+
/* keys: the value in the array is the index number in data_fields[] */
-static int fld_index[] = {
- 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* ' ', 0,1..9 */
- 7, 6, -1, 2, -1, -1, 10, -1, 14, 11, -1, 1, 12, /* A..M */
- 5, -1, -1, -1, 3, 4, -1, -1, 9, 8, 13, -1, -1, /* N..Z */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* a..m */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* n..z */
- -1
-};
+extern int fld_index[];
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include "raw.h"
static int havename[MaxHost];
+#if 0
static char *addr_to_str(int addr)
{
static char buf[20];
(addr >> 24) & 0xff);
return buf;
}
-
+#endif
void raw_rawping (int host, int msec)
{
}
}
printf ("p %d %d\n", host, msec);
+ fflush (stdout);
}
void raw_rawhost (int host, int ip_addr)
{
- printf ("h %d %s\n", host, addr_to_str (ip_addr));
+ struct in_addr in;
+
+ in.s_addr = ip_addr;
+
+ printf ("h %d %s\n",
+ host, inet_ntoa(in));
+ fflush (stdout);
}
void select_loop() {
fd_set readfd;
- int action;
int anyset = 0;
int maxfd = 0;
int dnsfd, netfd;