/* MacOSX may need this before socket.h...*/
#if defined(HAVE_SYS_TYPES_H)
-#include <sys/types.h>
+# include <sys/types.h>
#else
/* If a system doesn't have sys/types.h, lets hope that time_t is an int */
-#define time_t int
+# define time_t int
#endif
#include <sys/socket.h>
#include <arpa/inet.h>
#if defined(HAVE_NCURSES_H)
-# include <ncurses.h>
+# include <ncurses.h>
#elif defined(HAVE_NCURSES_CURSES_H)
-# include <ncurses/curses.h>
+# include <ncurses/curses.h>
#elif defined(HAVE_CURSES_H)
-# include <curses.h>
+# include <curses.h>
#elif defined(HAVE_CURSESX_H)
-# include <cursesX.h>
+# include <cursesX.h>
#else
-# error No curses header file available
+# error No curses header file available
#endif
/* This go-around is needed only when compiling with antique version of curses.
getmaxyx is part of Technical Standard X/Open Curses Issue 4, Version 2 (1996).
http://pubs.opengroup.org/onlinepubs/9693989999/toc.pdf see page 106 */
#ifndef getmaxyx
-# define getmaxyx(win,y,x) ((y) = (win)->_maxy + 1, (x) = (win)->_maxx + 1)
+# define getmaxyx(win,y,x) ((y) = (win)->_maxy + 1, (x) = (win)->_maxx + 1)
#endif
#include "mtr.h"
#include "config.h"
#if defined(HAVE_SYS_XTI_H)
-#include <sys/xti.h>
+# include <sys/xti.h>
#endif
#include <sys/types.h>
#include <memory.h>
#include <unistd.h>
#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
+# include <fcntl.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifdef HAVE_ERROR_H
-#include <error.h>
+# include <error.h>
#else
-#include "portability/error.h"
+# include "portability/error.h"
#endif
#ifdef HAVE_LINUX_ICMP_H
-#include <linux/icmp.h>
+# include <linux/icmp.h>
#endif
#include "mtr.h"
};
#ifndef ICMP_ECHOREPLY
-#define ICMP_ECHOREPLY 0
-#define ICMP_DEST_UNREACH 3
-#define ICMP_ECHO 8
-#define ICMP_TIME_EXCEEDED 11
+# define ICMP_ECHOREPLY 0
+# define ICMP_DEST_UNREACH 3
+# define ICMP_ECHO 8
+# define ICMP_TIME_EXCEEDED 11
#endif
#ifndef SOL_IP
-#define SOL_IP 0
+# define SOL_IP 0
#endif
struct nethost {
#ifdef ENABLE_IPV6
static char localaddr[INET6_ADDRSTRLEN];
#else
-#ifndef INET_ADDRSTRLEN
-#define INET_ADDRSTRLEN 16
-#endif
+# ifndef INET_ADDRSTRLEN
+# define INET_ADDRSTRLEN 16
+# endif
static char localaddr[INET_ADDRSTRLEN];
#endif
struct sockaddr_storage remote;
struct sockaddr_in *local4 = (struct sockaddr_in *) &local;
struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote;
-#ifdef ENABLE_IPV6
+# ifdef ENABLE_IPV6
struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote;
-#endif
+# endif
socklen_t len;
ttl = index + 1;
remote4->sin_port = htons(ctl->remoteport);
len = sizeof (struct sockaddr_in);
break;
-#ifdef ENABLE_IPV6
+# ifdef ENABLE_IPV6
case AF_INET6:
addrcpy((void *) &local6->sin6_addr, (void *) &ssa6->sin6_addr, ctl->af);
addrcpy((void *) &remote6->sin6_addr, (void *) remoteaddress, ctl->af);
remote6->sin6_port = htons(ctl->remoteport);
len = sizeof (struct sockaddr_in6);
break;
-#endif
+# endif
}
if (bind(s, (struct sockaddr *) &local, len)) {
error(EXIT_FAILURE, errno, "setsockopt IP_TOS");
}
break;
-#ifdef ENABLE_IPV6
+# ifdef ENABLE_IPV6
case AF_INET6:
if (setsockopt(s, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof (ttl))) {
display_clear(ctl);
error(EXIT_FAILURE, errno, "setsockopt IPPROTO_IPV6 ttl");
}
break;
-#endif
+# endif
}
-#ifdef SO_MARK
+# ifdef SO_MARK
if (ctl->mark && setsockopt( s, SOL_SOCKET, SO_MARK, &ctl->mark, sizeof ctl->mark ) ) {
error(EXIT_FAILURE, errno, "setsockopt SO_MARK");
}
-#endif
+# endif
switch (local.ss_family) {
case AF_INET:
port = ntohs(local4->sin_port);
break;
-#ifdef ENABLE_IPV6
+# ifdef ENABLE_IPV6
case AF_INET6:
port = ntohs(local6->sin6_port);
break;
-#endif
+# endif
default:
display_clear(ctl);
error(EXIT_FAILURE, 0, "unknown address family");
connect(s, (struct sockaddr *) &remote, len);
}
-#endif
+#endif /* HAS_SCTP */
/* Attempt to find the host at a particular number of hops away */
static void net_send_query(struct mtr_ctl *ctl, int index)
decodempls(num, packet, &mpls, 156);
break;
-#ifdef ENABLE_IPV6
+# ifdef ENABLE_IPV6
case AF_INET6:
if ((size_t) num < sizeof (struct ICMPHeader) +
sizeof (struct ip6_hdr) + sizeof (struct SCTPHeader) )
decodempls(num, packet, &mpls, 136);
break;
-#endif
+# endif
}
seq_num = ntohs(sctpheader->srcport);
}
break;
-#endif
+#endif /* HAS_SCTP */
}
if (seq_num)
net_process_ping (ctl, seq_num, mpls, (void *) fromaddress, now);