diff options
author | Rob Landley <rob@landley.net> | 2006-06-20 14:57:00 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-06-20 14:57:00 +0000 |
commit | 2a613d73601b2dedb6cc4441bd4405a22379867c (patch) | |
tree | 1c6c41d9fd5766ffb26bde5b870120ae3eb48b94 /networking/interface.c | |
parent | 352e117c6bfdf032258fe16b3cab7e6cde348e72 (diff) | |
download | busybox-w32-2a613d73601b2dedb6cc4441bd4405a22379867c.tar.gz busybox-w32-2a613d73601b2dedb6cc4441bd4405a22379867c.tar.bz2 busybox-w32-2a613d73601b2dedb6cc4441bd4405a22379867c.zip |
Patch from Robert P. J. Day cleaning up some unnecessary preprocessor
directives.
Diffstat (limited to 'networking/interface.c')
-rw-r--r-- | networking/interface.c | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/networking/interface.c b/networking/interface.c index 4f8e46de4..dc097fa59 100644 --- a/networking/interface.c +++ b/networking/interface.c | |||
@@ -31,22 +31,6 @@ | |||
31 | * (default AF was wrong) | 31 | * (default AF was wrong) |
32 | */ | 32 | */ |
33 | 33 | ||
34 | /* | ||
35 | * | ||
36 | * Protocol Families. | ||
37 | * | ||
38 | */ | ||
39 | #define HAVE_AFINET 1 | ||
40 | |||
41 | /* | ||
42 | * | ||
43 | * Device Hardware types. | ||
44 | * | ||
45 | */ | ||
46 | #define HAVE_HWETHER 1 | ||
47 | #define HAVE_HWPPP 1 | ||
48 | |||
49 | |||
50 | #include "inet_common.h" | 34 | #include "inet_common.h" |
51 | #include <stdio.h> | 35 | #include <stdio.h> |
52 | #include <errno.h> | 36 | #include <errno.h> |
@@ -126,37 +110,6 @@ struct aftype { | |||
126 | char *flag_file; | 110 | char *flag_file; |
127 | }; | 111 | }; |
128 | 112 | ||
129 | #if HAVE_AFUNIX | ||
130 | |||
131 | /* Display a UNIX domain address. */ | ||
132 | static char *UNIX_print(unsigned char *ptr) | ||
133 | { | ||
134 | return (ptr); | ||
135 | } | ||
136 | |||
137 | |||
138 | /* Display a UNIX domain address. */ | ||
139 | static char *UNIX_sprint(struct sockaddr *sap, int numeric) | ||
140 | { | ||
141 | static char buf[64]; | ||
142 | |||
143 | if (sap->sa_family == 0xFFFF || sap->sa_family == 0) | ||
144 | return safe_strncpy(buf, "[NONE SET]", sizeof(buf)); | ||
145 | return (UNIX_print(sap->sa_data)); | ||
146 | } | ||
147 | |||
148 | |||
149 | static struct aftype unix_aftype = { | ||
150 | "unix", "UNIX Domain", AF_UNIX, 0, | ||
151 | UNIX_print, UNIX_sprint, NULL, NULL, | ||
152 | NULL, NULL, NULL, | ||
153 | -1, | ||
154 | "/proc/net/unix" | ||
155 | }; | ||
156 | #endif /* HAVE_AFUNIX */ | ||
157 | |||
158 | #if HAVE_AFINET | ||
159 | |||
160 | /* Display an Internet socket address. */ | 113 | /* Display an Internet socket address. */ |
161 | static char *INET_sprint(struct sockaddr *sap, int numeric) | 114 | static char *INET_sprint(struct sockaddr *sap, int numeric) |
162 | { | 115 | { |
@@ -182,8 +135,6 @@ static struct aftype inet_aftype = { | |||
182 | NULL | 135 | NULL |
183 | }; | 136 | }; |
184 | 137 | ||
185 | #endif /* HAVE_AFINET */ | ||
186 | |||
187 | #if HAVE_AFINET6 | 138 | #if HAVE_AFINET6 |
188 | 139 | ||
189 | /* Display an Internet socket address. */ | 140 | /* Display an Internet socket address. */ |
@@ -247,12 +198,7 @@ static struct aftype unspec_aftype = { | |||
247 | }; | 198 | }; |
248 | 199 | ||
249 | static struct aftype * const aftypes[] = { | 200 | static struct aftype * const aftypes[] = { |
250 | #if HAVE_AFUNIX | ||
251 | &unix_aftype, | ||
252 | #endif | ||
253 | #if HAVE_AFINET | ||
254 | &inet_aftype, | 201 | &inet_aftype, |
255 | #endif | ||
256 | #if HAVE_AFINET6 | 202 | #if HAVE_AFINET6 |
257 | &inet6_aftype, | 203 | &inet6_aftype, |
258 | #endif | 204 | #endif |
@@ -721,7 +667,6 @@ static int if_fetch(struct interface *ife) | |||
721 | ife->tx_queue_len = -1; /* unknown value */ | 667 | ife->tx_queue_len = -1; /* unknown value */ |
722 | #endif | 668 | #endif |
723 | 669 | ||
724 | #if HAVE_AFINET | ||
725 | /* IPv4 address? */ | 670 | /* IPv4 address? */ |
726 | fd = get_socket_for_af(AF_INET); | 671 | fd = get_socket_for_af(AF_INET); |
727 | if (fd >= 0) { | 672 | if (fd >= 0) { |
@@ -750,7 +695,6 @@ static int if_fetch(struct interface *ife) | |||
750 | } else | 695 | } else |
751 | memset(&ife->addr, 0, sizeof(struct sockaddr)); | 696 | memset(&ife->addr, 0, sizeof(struct sockaddr)); |
752 | } | 697 | } |
753 | #endif | ||
754 | 698 | ||
755 | return 0; | 699 | return 0; |
756 | } | 700 | } |
@@ -796,7 +740,6 @@ static const struct hwtype loop_hwtype = { | |||
796 | NULL, NULL, NULL | 740 | NULL, NULL, NULL |
797 | }; | 741 | }; |
798 | 742 | ||
799 | #if HAVE_HWETHER | ||
800 | #include <net/if_arp.h> | 743 | #include <net/if_arp.h> |
801 | 744 | ||
802 | #if (__GLIBC__ >=2 && __GLIBC_MINOR >= 1) || defined(_NEWLIB_VERSION) | 745 | #if (__GLIBC__ >=2 && __GLIBC_MINOR >= 1) || defined(_NEWLIB_VERSION) |
@@ -822,12 +765,6 @@ static const struct hwtype ether_hwtype = { | |||
822 | pr_ether, NULL /* UNUSED in_ether */ , NULL | 765 | pr_ether, NULL /* UNUSED in_ether */ , NULL |
823 | }; | 766 | }; |
824 | 767 | ||
825 | |||
826 | #endif /* HAVE_HWETHER */ | ||
827 | |||
828 | |||
829 | #if HAVE_HWPPP | ||
830 | |||
831 | #include <net/if_arp.h> | 768 | #include <net/if_arp.h> |
832 | 769 | ||
833 | static const struct hwtype ppp_hwtype = { | 770 | static const struct hwtype ppp_hwtype = { |
@@ -835,25 +772,10 @@ static const struct hwtype ppp_hwtype = { | |||
835 | NULL, NULL, NULL /* UNUSED do_ppp */ , 0 | 772 | NULL, NULL, NULL /* UNUSED do_ppp */ , 0 |
836 | }; | 773 | }; |
837 | 774 | ||
838 | |||
839 | #endif /* HAVE_PPP */ | ||
840 | |||
841 | static const struct hwtype * const hwtypes[] = { | 775 | static const struct hwtype * const hwtypes[] = { |
842 | |||
843 | &loop_hwtype, | 776 | &loop_hwtype, |
844 | |||
845 | #if HAVE_HWSTRIP | ||
846 | &strip_hwtype, | ||
847 | #endif | ||
848 | #if HAVE_HWETHER | ||
849 | ðer_hwtype, | 777 | ðer_hwtype, |
850 | #endif | ||
851 | #if HAVE_HWTUNNEL | ||
852 | &tunnel_hwtype, | ||
853 | #endif | ||
854 | #if HAVE_HWPPP | ||
855 | &ppp_hwtype, | 778 | &ppp_hwtype, |
856 | #endif | ||
857 | &unspec_hwtype, | 779 | &unspec_hwtype, |
858 | NULL | 780 | NULL |
859 | }; | 781 | }; |
@@ -1005,7 +927,6 @@ static void ife_print(struct interface *ptr) | |||
1005 | #endif | 927 | #endif |
1006 | printf("\n"); | 928 | printf("\n"); |
1007 | 929 | ||
1008 | #if HAVE_AFINET | ||
1009 | if (ptr->has_ip) { | 930 | if (ptr->has_ip) { |
1010 | printf(" %s addr:%s ", ap->name, | 931 | printf(" %s addr:%s ", ap->name, |
1011 | ap->sprint(&ptr->addr, 1)); | 932 | ap->sprint(&ptr->addr, 1)); |
@@ -1017,7 +938,6 @@ static void ife_print(struct interface *ptr) | |||
1017 | } | 938 | } |
1018 | printf(" Mask:%s\n", ap->sprint(&ptr->netmask, 1)); | 939 | printf(" Mask:%s\n", ap->sprint(&ptr->netmask, 1)); |
1019 | } | 940 | } |
1020 | #endif | ||
1021 | 941 | ||
1022 | #if HAVE_AFINET6 | 942 | #if HAVE_AFINET6 |
1023 | 943 | ||