diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-01-07 22:12:35 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2007-01-07 22:12:35 +0000 |
commit | 42646c5585b67eee6751a58d5db48e4c1281f813 (patch) | |
tree | 973f33f3ad0ae262e983a889c3004556a4f84004 | |
parent | 6998142998a0986f82c81b3bdca64566bc4844b1 (diff) | |
download | busybox-w32-42646c5585b67eee6751a58d5db48e4c1281f813.tar.gz busybox-w32-42646c5585b67eee6751a58d5db48e4c1281f813.tar.bz2 busybox-w32-42646c5585b67eee6751a58d5db48e4c1281f813.zip |
- style fixes and shrink by another 4 bytes while at it.
-rw-r--r-- | networking/arp.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/networking/arp.c b/networking/arp.c index 10934c254..fd418cc3f 100644 --- a/networking/arp.c +++ b/networking/arp.c | |||
@@ -87,27 +87,24 @@ static int arp_del(char **args) | |||
87 | req.arp_flags = ATF_PERM; | 87 | req.arp_flags = ATF_PERM; |
88 | args++; | 88 | args++; |
89 | while (*args != NULL) { | 89 | while (*args != NULL) { |
90 | if (option_mask32 & ARP_OPT_v) | ||
91 | bb_error_msg("args=%s", *args); | ||
92 | |||
93 | switch (index_in_str_array(options, *args)) { | 90 | switch (index_in_str_array(options, *args)) { |
94 | case 0: // "pub" | 91 | case 0: /* "pub" */ |
95 | flags |= 1; | 92 | flags |= 1; |
96 | args++; | 93 | args++; |
97 | break; | 94 | break; |
98 | case 1: // "priv" | 95 | case 1: /* "priv" */ |
99 | flags |= 2; | 96 | flags |= 2; |
100 | args++; | 97 | args++; |
101 | break; | 98 | break; |
102 | case 2: // "temp" | 99 | case 2: /* "temp" */ |
103 | req.arp_flags &= ~ATF_PERM; | 100 | req.arp_flags &= ~ATF_PERM; |
104 | args++; | 101 | args++; |
105 | break; | 102 | break; |
106 | case 3: // "trail" | 103 | case 3: /* "trail" */ |
107 | req.arp_flags |= ATF_USETRAILERS; | 104 | req.arp_flags |= ATF_USETRAILERS; |
108 | args++; | 105 | args++; |
109 | break; | 106 | break; |
110 | case 4: // "dontpub" | 107 | case 4: /* "dontpub" */ |
111 | #ifdef HAVE_ATF_DONTPUB | 108 | #ifdef HAVE_ATF_DONTPUB |
112 | req.arp_flags |= ATF_DONTPUB; | 109 | req.arp_flags |= ATF_DONTPUB; |
113 | #else | 110 | #else |
@@ -115,7 +112,7 @@ static int arp_del(char **args) | |||
115 | #endif | 112 | #endif |
116 | args++; | 113 | args++; |
117 | break; | 114 | break; |
118 | case 5: // "auto" | 115 | case 5: /* "auto" */ |
119 | #ifdef HAVE_ATF_MAGIC | 116 | #ifdef HAVE_ATF_MAGIC |
120 | req.arp_flags |= ATF_MAGIC; | 117 | req.arp_flags |= ATF_MAGIC; |
121 | #else | 118 | #else |
@@ -123,20 +120,19 @@ static int arp_del(char **args) | |||
123 | #endif | 120 | #endif |
124 | args++; | 121 | args++; |
125 | break; | 122 | break; |
126 | case 6: // "dev" | 123 | case 6: /* "dev" */ |
127 | if (*++args == NULL) | 124 | if (*++args == NULL) |
128 | bb_show_usage(); | 125 | bb_show_usage(); |
129 | device = *args; | 126 | device = *args; |
130 | args++; | 127 | args++; |
131 | break; | 128 | break; |
132 | case 7: // "netmask" | 129 | case 7: /* "netmask" */ |
133 | if (*++args == NULL) | 130 | if (*++args == NULL) |
134 | bb_show_usage(); | 131 | bb_show_usage(); |
135 | if (strcmp(*args, "255.255.255.255") != 0) { | 132 | if (strcmp(*args, "255.255.255.255") != 0) { |
136 | safe_strncpy(host, *args, 128); | 133 | safe_strncpy(host, *args, 128); |
137 | if (ap->input(0, host, &sa) < 0) { | 134 | if (ap->input(0, host, &sa) < 0) { |
138 | bb_herror_msg("%s", host); | 135 | bb_herror_msg_and_die("%s", host); |
139 | return -1; | ||
140 | } | 136 | } |
141 | memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr)); | 137 | memcpy(&req.arp_netmask, &sa, sizeof(struct sockaddr)); |
142 | req.arp_flags |= ATF_NETMASK; | 138 | req.arp_flags |= ATF_NETMASK; |
@@ -187,8 +183,8 @@ static int arp_del(char **args) | |||
187 | } | 183 | } |
188 | 184 | ||
189 | /* Get the hardware address to a specified interface name */ | 185 | /* Get the hardware address to a specified interface name */ |
190 | static void | 186 | static void arp_getdevhw(char *ifname, struct sockaddr *sa, |
191 | arp_getdevhw(char *ifname, struct sockaddr *sa, const struct hwtype *hwt) | 187 | const struct hwtype *hwt) |
192 | { | 188 | { |
193 | struct ifreq ifr; | 189 | struct ifreq ifr; |
194 | const struct hwtype *xhw; | 190 | const struct hwtype *xhw; |
@@ -221,7 +217,7 @@ static int arp_set(char **args) | |||
221 | struct arpreq req; | 217 | struct arpreq req; |
222 | struct sockaddr sa; | 218 | struct sockaddr sa; |
223 | int flags; | 219 | int flags; |
224 | 220 | ||
225 | memset(&req, 0, sizeof(req)); | 221 | memset(&req, 0, sizeof(req)); |
226 | 222 | ||
227 | safe_strncpy(host, *args++, 128); | 223 | safe_strncpy(host, *args++, 128); |
@@ -247,23 +243,23 @@ static int arp_set(char **args) | |||
247 | flags = ATF_PERM | ATF_COM; | 243 | flags = ATF_PERM | ATF_COM; |
248 | while (*args != NULL) { | 244 | while (*args != NULL) { |
249 | switch (index_in_str_array(options, *args)) { | 245 | switch (index_in_str_array(options, *args)) { |
250 | case 0: // "pub" | 246 | case 0: /* "pub" */ |
251 | flags |= ATF_PUBL; | 247 | flags |= ATF_PUBL; |
252 | args++; | 248 | args++; |
253 | break; | 249 | break; |
254 | case 1: // "priv" | 250 | case 1: /* "priv" */ |
255 | flags &= ~ATF_PUBL; | 251 | flags &= ~ATF_PUBL; |
256 | args++; | 252 | args++; |
257 | break; | 253 | break; |
258 | case 2: // "temp" | 254 | case 2: /* "temp" */ |
259 | flags &= ~ATF_PERM; | 255 | flags &= ~ATF_PERM; |
260 | args++; | 256 | args++; |
261 | break; | 257 | break; |
262 | case 3: // "trail" | 258 | case 3: /* "trail" */ |
263 | flags |= ATF_USETRAILERS; | 259 | flags |= ATF_USETRAILERS; |
264 | args++; | 260 | args++; |
265 | break; | 261 | break; |
266 | case 4: // "dontpub" | 262 | case 4: /* "dontpub" */ |
267 | #ifdef HAVE_ATF_DONTPUB | 263 | #ifdef HAVE_ATF_DONTPUB |
268 | flags |= ATF_DONTPUB; | 264 | flags |= ATF_DONTPUB; |
269 | #else | 265 | #else |
@@ -271,7 +267,7 @@ static int arp_set(char **args) | |||
271 | #endif | 267 | #endif |
272 | args++; | 268 | args++; |
273 | break; | 269 | break; |
274 | case 5: // "auto" | 270 | case 5: /* "auto" */ |
275 | #ifdef HAVE_ATF_MAGIC | 271 | #ifdef HAVE_ATF_MAGIC |
276 | flags |= ATF_MAGIC; | 272 | flags |= ATF_MAGIC; |
277 | #else | 273 | #else |
@@ -279,13 +275,13 @@ static int arp_set(char **args) | |||
279 | #endif | 275 | #endif |
280 | args++; | 276 | args++; |
281 | break; | 277 | break; |
282 | case 6: // "dev" | 278 | case 6: /* "dev" */ |
283 | if (*++args == NULL) | 279 | if (*++args == NULL) |
284 | bb_show_usage(); | 280 | bb_show_usage(); |
285 | device = *args; | 281 | device = *args; |
286 | args++; | 282 | args++; |
287 | break; | 283 | break; |
288 | case 7: // "netmask" | 284 | case 7: /* "netmask" */ |
289 | if (*++args == NULL) | 285 | if (*++args == NULL) |
290 | bb_show_usage(); | 286 | bb_show_usage(); |
291 | if (strcmp(*args, "255.255.255.255") != 0) { | 287 | if (strcmp(*args, "255.255.255.255") != 0) { |
@@ -376,7 +372,8 @@ static int arp_show(char *name) | |||
376 | int type, flags; | 372 | int type, flags; |
377 | FILE *fp; | 373 | FILE *fp; |
378 | char *hostname; | 374 | char *hostname; |
379 | int num, entries = 0, shown = 0; | 375 | int num; |
376 | unsigned entries = 0, shown = 0; | ||
380 | 377 | ||
381 | host[0] = '\0'; | 378 | host[0] = '\0'; |
382 | 379 | ||