Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+// The autoconf system provides us with the NO_IPINFO define.
+// Littering the code with #ifndef NO_IPINFO (double negative)
+// does not benefit readabilty. So here we invert the sense of the
+// define.
+//
+// Similarly, this include file should be included unconditially.
+// It will evaluate to nothing if we don't need it.
+
+#ifndef NO_IPINFO
+#define IPINFO
+
+
extern int ipinfo_no;
extern int ipinfo_max;
extern int iiwidth_len;
int get_iiwidth(void);
int is_printii(void);
+#endif
#include "mtr.h"
#include "mtr-curses.h"
-#include "display.h"
#include "net.h"
#include "dns.h"
-#ifndef NO_IPINFO
#include "asn.h"
-#endif
+#include "display.h"
+
#include "version.h"
#endif
return ActionMPLS;
if (tolower(c) == 'n')
return ActionDNS;
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (tolower(c) == 'y')
return ActionII;
if (tolower(c) == 'z')
printw(" b <c> set ping bit pattern to c(0..255) or random(c<0)\n" );
printw(" Q <t> set ping packet's TOS to t\n" );
printw(" u switch between ICMP ECHO and UDP datagrams\n" );
-#ifndef NO_IPINFO
+#ifdef IPINFO
printw(" y switching IP info\n");
printw(" z toggle ASN info on/off\n");
pressanykey_row += 2;
name = dns_lookup(addr);
if (! net_up(at))
attron(A_BOLD);
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (is_printii())
printw(fmt_ipinfo(addr));
#endif
name = dns_lookup(addrs);
if (! net_up(at)) attron(A_BOLD);
printw("\n ");
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (is_printii())
printw(fmt_ipinfo(addrs));
#endif
if (! net_up(at))
attron(A_BOLD);
if (addrcmp((void *) addr, (void *) &unspec_addr, af)) {
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (is_printii())
printw(fmt_ipinfo(addr));
#endif
} else {
char msg[80];
int padding = 30;
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (is_printii())
padding += get_iiwidth();
#endif
#include "select.h"
#include "raw.h"
#include "dns.h"
-#ifndef NO_IPINFO
-#include <asn.h>
-#endif
+#include "asn.h"
extern int DisplayMode;
break;
case DisplayCurses:
mtr_curses_open();
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (ipinfo_no >= 0)
asn_open();
#endif
csv_close(now);
break;
case DisplayCurses:
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (ipinfo_no >= 0)
asn_close();
#endif
(notably the one on Irix 5.2) do not like that. */
enum { ActionNone, ActionQuit, ActionReset, ActionDisplay,
ActionClear, ActionPause, ActionResume, ActionMPLS, ActionDNS,
-#ifndef NO_IPINFO
+#ifdef IPINFO
ActionII, ActionAS,
#endif
ActionScrollDown, ActionScrollUp };
#include "dns.h"
#include "report.h"
#include "net.h"
-#ifndef NO_IPINFO
#include "asn.h"
-#endif
#include "version.h"
{ "timeout", 1, 0, 'Z' }, /* timeout for TCP sockets */
{ "inet", 0, 0, '4' }, /* IPv4 only */
{ "inet6", 0, 0, '6' }, /* IPv6 only */
-#ifndef NO_IPINFO
+#ifdef IPINFO
{ "ipinfo", 1, 0, 'y' }, /* IP info lookup */
{ "aslookup", 0, 0, 'z' }, /* Do AS lookup (--ipinfo 0) */
#endif
fprintf( stderr, "IPv6 not enabled.\n" );
break;
#endif
-#ifndef NO_IPINFO
+#ifdef IPINFO
case 'y':
ipinfo_no = atoi (optarg);
if (ipinfo_no < 0)
"\t\t[--report-wide] [--report-cycles=COUNT] [--curses] [--gtk]\n"
"\t\t[--csv|-C] [--raw] [--split] [--mpls] [--no-dns] [--show-ips]\n"
"\t\t[--address interface] [--filename=FILE|-F]\n" /* BL */
-#ifndef NO_IPINFO
+#ifdef IPINFO
"\t\t[--ipinfo=item_no|-y item_no]\n"
"\t\t[--aslookup|-z]\n"
#endif
#include "report.h"
#include "net.h"
#include "dns.h"
-#ifndef NO_IPINFO
#include "asn.h"
-#endif
#define MAXLOADBAL 5
}
-#ifndef NO_IPINFO
+#ifdef IPINFO
void print_mpls(struct mplslen *mpls) {
int k;
for (k=0; k < mpls->labels; k++)
}
}
-#ifndef NO_IPINFO
+#ifdef IPINFO
int len_tmp = len_hosts;
if (ipinfo_no >= 0) {
ipinfo_no %= iiwidth_len;
mpls = net_mpls(at);
snprint_addr(name, sizeof(name), addr);
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (is_printii()) {
snprintf(fmt, sizeof(fmt), " %%2d. %%s%%-%ds", len_hosts);
snprintf(buf, sizeof(buf), fmt, at+1, fmt_ipinfo(addr), name);
#endif
snprintf( fmt, sizeof(fmt), " %%2d.|-- %%-%ds", len_hosts);
snprintf(buf, sizeof(buf), fmt, at+1, name);
-#ifndef NO_IPINFO
+#ifdef IPINFO
}
#endif
len = reportwide ? strlen(buf) : len_hosts;
if (!found) {
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (is_printii()) {
if (mpls->labels && z == 1 && enablempls)
print_mpls(mpls);
}
}
#endif
-#ifndef NO_IPINFO
+#ifdef IPINFO
}
#endif
}
}
/* No multipath */
-#ifndef NO_IPINFO
+#ifdef IPINFO
if (is_printii()) {
if (mpls->labels && z == 1 && enablempls)
print_mpls(mpls);
}
}
#endif
-#ifndef NO_IPINFO
+#ifdef IPINFO
}
#endif
}
snprint_addr(name, sizeof(name), addr);
int last = net_last(at);
-#ifndef NO_IPINFO
+#ifdef IPINFO
if(!ipinfo_no) {
char* fmtinfo = fmt_ipinfo(addr);
if (fmtinfo != NULL) fmtinfo = trim(fmtinfo);
#include <errno.h>
#include "mtr.h"
-#include "display.h"
#include "dns.h"
#include "net.h"
-#ifndef NO_IPINFO
#include "asn.h"
-#endif
+#include "display.h"
extern int Interactive;
extern int MaxPing;
display_clear();
}
break;
-#ifndef NO_IPINFO
+#ifdef IPINFO
case ActionII:
if (ipinfo_no >= 0) {
ipinfo_no++;