From: Dan Fandrich Date: Fri, 10 Jun 2011 03:17:59 +0000 (+0200) Subject: *: simplify Ethernet header includes X-Git-Tag: 1_19_0~69 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f533ec876716415ed0e6ba28d13dfb6263068e82;p=oweals%2Fbusybox.git *: simplify Ethernet header includes Signed-off-by: Dan Fandrich Signed-off-by: Denys Vlasenko --- diff --git a/include/platform.h b/include/platform.h index 780568c2b..429220b0d 100644 --- a/include/platform.h +++ b/include/platform.h @@ -332,8 +332,8 @@ typedef unsigned smalluint; /* ---- Who misses what? ------------------------------------ */ -/* Assume all these functions exist by default. Platforms where it is not - * true will #undef them below. +/* Assume all these functions and header files exist by default. + * Platforms where it is not true will #undef them below. */ #define HAVE_CLEARENV 1 #define HAVE_FDATASYNC 1 @@ -349,9 +349,14 @@ typedef unsigned smalluint; #define HAVE_STRSEP 1 #define HAVE_STRSIGNAL 1 #define HAVE_VASPRINTF 1 +#define HAVE_XTABS 1 #define HAVE_MNTENT_H 1 +#define HAVE_NET_ETHERNET_H 1 #define HAVE_SYS_STATFS_H 1 -#define HAVE_XTABS 1 + +#if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 1) +# undef HAVE_NET_ETHERNET_H +#endif #if defined(__dietlibc__) # undef HAVE_STRCHRNUL @@ -368,6 +373,7 @@ typedef unsigned smalluint; # undef HAVE_STRSEP # undef HAVE_STRSIGNAL # undef HAVE_VASPRINTF +# undef HAVE_NET_ETHERNET_H #endif #if defined(__FreeBSD__) @@ -395,6 +401,7 @@ typedef unsigned smalluint; # undef HAVE_DPRINTF # undef HAVE_STPCPY # undef HAVE_STRCHRNUL +# undef HAVE_NET_ETHERNET_H #endif /* diff --git a/networking/ether-wake.c b/networking/ether-wake.c index 260ba2463..6a88279f4 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c @@ -74,13 +74,11 @@ //usage: "\n -i iface Interface to use (default eth0)" //usage: "\n -p pass Append four or six byte password PW to the packet" +#include "libbb.h" #include -#include #include #include -#include "libbb.h" - /* Note: PF_INET, SOCK_DGRAM, IPPROTO_UDP would allow SIOCGIFHWADDR to * work as non-root, but we need SOCK_PACKET to specify the Ethernet * destination address. diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 2a56da561..b6604f5d1 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -46,18 +46,14 @@ //usage: " [mem_start NN] [io_addr NN] [irq NN]\n") //usage: " [up|down] ..." +#include "libbb.h" +#include "inet_common.h" #include #include #include -#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 -#include -#include -#else -#include -#include +#ifdef HAVE_NET_ETHERNET_H +# include #endif -#include "libbb.h" -#include "inet_common.h" #if ENABLE_FEATURE_IFCONFIG_SLIP # include diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 57d04e67b..d8358cdfd 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -37,7 +37,9 @@ #include #include #include -#include +#ifdef HAVE_NET_ETHERNET_H +# include +#endif #include #include #include diff --git a/networking/interface.c b/networking/interface.c index bea54c180..79c322ec0 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -30,15 +30,14 @@ * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu * (default AF was wrong) */ + +#include "libbb.h" +#include "inet_common.h" #include #include -#ifndef __UCLIBC__ +#ifdef HAVE_NET_ETHERNET_H # include -#else -# include #endif -#include "libbb.h" -#include "inet_common.h" #if ENABLE_FEATURE_HWIB /* #include */ diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c index 04925ecf6..7aac8364d 100644 --- a/networking/libiproute/ll_proto.c +++ b/networking/libiproute/ll_proto.c @@ -12,11 +12,7 @@ #include "rt_names.h" #include "utils.h" -#if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 -#include -#else -#include -#endif +#include #if !ENABLE_WERROR #warning de-bloat diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 5d3291b8c..4d755e6b8 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -25,14 +25,8 @@ #include "dhcpd.h" #include "dhcpc.h" -#include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined(_NEWLIB_VERSION) -# include -# include -#else -# include -# include -#endif +#include +#include #include /* struct client_config_t client_config is in bb_common_bufsiz1 */ diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index 2b7528cc7..66b42c5e1 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c @@ -6,18 +6,11 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ -#include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION -# include -# include -#else -# include -# include -# include -#endif - #include "common.h" #include "dhcpd.h" +#include +#include +#include void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type) { diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index 39f1cec54..a5220ba74 100644 --- a/networking/udhcp/socket.c +++ b/networking/udhcp/socket.c @@ -22,17 +22,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION -# include -# include -#else -# include -# include -# include -#endif - #include "common.h" +#include int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) { diff --git a/networking/zcip.c b/networking/zcip.c index 6b7f2144f..8a35eca5d 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -35,14 +35,12 @@ //usage: "\nWith no -q, runs continuously monitoring for ARP conflicts," //usage: "\nexits only on I/O errors (link down etc)" +#include "libbb.h" #include -#include #include #include -#include #include -#include "libbb.h" #include /* We don't need more than 32 bits of the counter */