Patch from Robert P. J. Day cleaning up some unnecessary preprocessor

directives.
This commit is contained in:
Rob Landley 2006-06-20 14:57:00 +00:00
parent 352e117c6b
commit 2a613d7360

View File

@ -31,22 +31,6 @@
* (default AF was wrong) * (default AF was wrong)
*/ */
/*
*
* Protocol Families.
*
*/
#define HAVE_AFINET 1
/*
*
* Device Hardware types.
*
*/
#define HAVE_HWETHER 1
#define HAVE_HWPPP 1
#include "inet_common.h" #include "inet_common.h"
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
@ -126,37 +110,6 @@ struct aftype {
char *flag_file; char *flag_file;
}; };
#if HAVE_AFUNIX
/* Display a UNIX domain address. */
static char *UNIX_print(unsigned char *ptr)
{
return (ptr);
}
/* Display a UNIX domain address. */
static char *UNIX_sprint(struct sockaddr *sap, int numeric)
{
static char buf[64];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buf, "[NONE SET]", sizeof(buf));
return (UNIX_print(sap->sa_data));
}
static struct aftype unix_aftype = {
"unix", "UNIX Domain", AF_UNIX, 0,
UNIX_print, UNIX_sprint, NULL, NULL,
NULL, NULL, NULL,
-1,
"/proc/net/unix"
};
#endif /* HAVE_AFUNIX */
#if HAVE_AFINET
/* Display an Internet socket address. */ /* Display an Internet socket address. */
static char *INET_sprint(struct sockaddr *sap, int numeric) static char *INET_sprint(struct sockaddr *sap, int numeric)
{ {
@ -182,8 +135,6 @@ static struct aftype inet_aftype = {
NULL NULL
}; };
#endif /* HAVE_AFINET */
#if HAVE_AFINET6 #if HAVE_AFINET6
/* Display an Internet socket address. */ /* Display an Internet socket address. */
@ -247,12 +198,7 @@ static struct aftype unspec_aftype = {
}; };
static struct aftype * const aftypes[] = { static struct aftype * const aftypes[] = {
#if HAVE_AFUNIX
&unix_aftype,
#endif
#if HAVE_AFINET
&inet_aftype, &inet_aftype,
#endif
#if HAVE_AFINET6 #if HAVE_AFINET6
&inet6_aftype, &inet6_aftype,
#endif #endif
@ -721,7 +667,6 @@ static int if_fetch(struct interface *ife)
ife->tx_queue_len = -1; /* unknown value */ ife->tx_queue_len = -1; /* unknown value */
#endif #endif
#if HAVE_AFINET
/* IPv4 address? */ /* IPv4 address? */
fd = get_socket_for_af(AF_INET); fd = get_socket_for_af(AF_INET);
if (fd >= 0) { if (fd >= 0) {
@ -750,7 +695,6 @@ static int if_fetch(struct interface *ife)
} else } else
memset(&ife->addr, 0, sizeof(struct sockaddr)); memset(&ife->addr, 0, sizeof(struct sockaddr));
} }
#endif
return 0; return 0;
} }
@ -796,7 +740,6 @@ static const struct hwtype loop_hwtype = {
NULL, NULL, NULL NULL, NULL, NULL
}; };
#if HAVE_HWETHER
#include <net/if_arp.h> #include <net/if_arp.h>
#if (__GLIBC__ >=2 && __GLIBC_MINOR >= 1) || defined(_NEWLIB_VERSION) #if (__GLIBC__ >=2 && __GLIBC_MINOR >= 1) || defined(_NEWLIB_VERSION)
@ -822,12 +765,6 @@ static const struct hwtype ether_hwtype = {
pr_ether, NULL /* UNUSED in_ether */ , NULL pr_ether, NULL /* UNUSED in_ether */ , NULL
}; };
#endif /* HAVE_HWETHER */
#if HAVE_HWPPP
#include <net/if_arp.h> #include <net/if_arp.h>
static const struct hwtype ppp_hwtype = { static const struct hwtype ppp_hwtype = {
@ -835,25 +772,10 @@ static const struct hwtype ppp_hwtype = {
NULL, NULL, NULL /* UNUSED do_ppp */ , 0 NULL, NULL, NULL /* UNUSED do_ppp */ , 0
}; };
#endif /* HAVE_PPP */
static const struct hwtype * const hwtypes[] = { static const struct hwtype * const hwtypes[] = {
&loop_hwtype, &loop_hwtype,
#if HAVE_HWSTRIP
&strip_hwtype,
#endif
#if HAVE_HWETHER
&ether_hwtype, &ether_hwtype,
#endif
#if HAVE_HWTUNNEL
&tunnel_hwtype,
#endif
#if HAVE_HWPPP
&ppp_hwtype, &ppp_hwtype,
#endif
&unspec_hwtype, &unspec_hwtype,
NULL NULL
}; };
@ -1005,7 +927,6 @@ static void ife_print(struct interface *ptr)
#endif #endif
printf("\n"); printf("\n");
#if HAVE_AFINET
if (ptr->has_ip) { if (ptr->has_ip) {
printf(" %s addr:%s ", ap->name, printf(" %s addr:%s ", ap->name,
ap->sprint(&ptr->addr, 1)); ap->sprint(&ptr->addr, 1));
@ -1017,7 +938,6 @@ static void ife_print(struct interface *ptr)
} }
printf(" Mask:%s\n", ap->sprint(&ptr->netmask, 1)); printf(" Mask:%s\n", ap->sprint(&ptr->netmask, 1));
} }
#endif
#if HAVE_AFINET6 #if HAVE_AFINET6