Skip to content

Commit

Permalink
Portability fixes from Mats Erik Andersson <debian@gisladisker.se>
Browse files Browse the repository at this point in the history
It restores compilability and most functionality for

   GNU/Linux,
   GNU/kFreeBSD,
   FreeBSD,
   OpenBSD,
   OpenSolaris/NexentaCore.
  • Loading branch information
pdw committed Jan 1, 2014
1 parent 975b775 commit 6d384fc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions addrs_ioctl.c
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Expand Up @@ -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)
], [
Expand Down
3 changes: 2 additions & 1 deletion dlcommon.c
Expand Up @@ -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"

Expand Down Expand Up @@ -462,7 +463,7 @@ char *bufp;
err("dlphysaddrack: short response ctl.len: %d", ctl.len);
}

static void
void
sigalrm()
{
(void) err("sigalrm: TIMEOUT");
Expand Down
10 changes: 10 additions & 0 deletions iftop.h
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion ui.c
Expand Up @@ -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>
Expand Down

0 comments on commit 6d384fc

Please sign in to comment.