summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdw <>2014-01-01 15:22:48 +0000
committerpdw <>2014-01-01 15:22:48 +0000
commit6d384fc12dfd4fee58b251543f77864aa8c2a58f (patch)
tree698217a335f245f051395a5266b2e2ff3e0d7c02
parent975b775fd05188aeb2aea9aabeb6b16bb4776588 (diff)
downloadiftop-6d384fc12dfd4fee58b251543f77864aa8c2a58f.zip
Portability fixes from Mats Erik Andersson <debian@gisladisker.se>
It restores compilability and most functionality for GNU/Linux, GNU/kFreeBSD, FreeBSD, OpenBSD, OpenSolaris/NexentaCore.
-rw-r--r--addrs_ioctl.c4
-rw-r--r--configure.in2
-rw-r--r--dlcommon.c3
-rw-r--r--iftop.h10
-rw-r--r--ui.c2
5 files changed, 16 insertions, 5 deletions
diff --git a/addrs_ioctl.c b/addrs_ioctl.c
index e86e2de..3c1a0ac 100644
--- a/addrs_ioctl.c
+++ b/addrs_ioctl.c
@@ -19,7 +19,7 @@
#include <netinet/in.h>
#if defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__ \
- || ( defined __GNUC__ && ! defined __linux__ )
+ || ( defined __GLIBC__ && ! defined __linux__ )
#include <sys/param.h>
#include <sys/sysctl.h>
#include <net/if_dl.h>
@@ -81,7 +81,7 @@ get_addrs_ioctl(char *interface, char if_hw_addr[], struct in_addr *if_ip_addr,
}
#else
#if defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__ \
- || ( defined __GNUC__ && ! defined __linux__ )
+ || ( defined __GLIBC__ && ! defined __linux__ )
{
int sysctlparam[6] = {CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0};
size_t needed = 0;
diff --git a/configure.in b/configure.in
index 73902f0..02bcd04 100644
--- a/configure.in
+++ b/configure.in
@@ -355,7 +355,7 @@ oldLIBS=$LIBS
for curseslib in ncursesw curses ncurses ; do
LIBS="$oldLIBS -l$curseslib"
AC_TRY_LINK([
-#include <curses.h>
+#include <$curseslib.h>
], [
mvchgat(0, 0, 1, A_REVERSE, 0, NULL)
], [
diff --git a/dlcommon.c b/dlcommon.c
index 748cea9..98e6c55 100644
--- a/dlcommon.c
+++ b/dlcommon.c
@@ -25,6 +25,7 @@ typedef unsigned long ulong;
#include <sys/dlpi.h>
#include <sys/signal.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "dlcommon.h"
@@ -462,7 +463,7 @@ char *bufp;
err("dlphysaddrack: short response ctl.len: %d", ctl.len);
}
-static void
+void
sigalrm()
{
(void) err("sigalrm: TIMEOUT");
diff --git a/iftop.h b/iftop.h
index 4f03d8c..f273c0f 100644
--- a/iftop.h
+++ b/iftop.h
@@ -13,6 +13,16 @@
#define RESOLUTION 2
#define DUMP_RESOLUTION 300
+/* At least OpenBSD and NexentaCore do not
+ * define s6_addr32 for user land settings.
+ */
+#if !defined s6_addr32 && defined __sun__
+# define s6_addr32 _S6_un._S6_u32
+#elif !defined s6_addr32 && \
+ ( defined __OpenBSD__ || defined __FreeBSD__ )
+# define s6_addr32 __u6_addr.__u6_addr32
+#endif /* !defined s6_addr32 */
+
typedef struct {
long recv[HISTORY_LENGTH];
long sent[HISTORY_LENGTH];
diff --git a/ui.c b/ui.c
index 705f9a0..b85d63e 100644
--- a/ui.c
+++ b/ui.c
@@ -6,7 +6,7 @@
#include <sys/types.h>
#include <ctype.h>
-#include <curses.h>
+#include <ncurses.h>
#include <errno.h>
#include <string.h>
#include <math.h>