aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2001-03-12 09:57:59 +0000
committerManuel Novoa III <mjn3@codepoet.org>2001-03-12 09:57:59 +0000
commit68ea1d032561b9bd47c0b0877ec58ddd1288b594 (patch)
treeda374e2e60360979e05c36541a88b99b41b08190 /networking
parent1365bb786155439041b7777d31bcfadb5276e824 (diff)
downloadbusybox-w32-68ea1d032561b9bd47c0b0877ec58ddd1288b594.tar.gz
busybox-w32-68ea1d032561b9bd47c0b0877ec58ddd1288b594.tar.bz2
busybox-w32-68ea1d032561b9bd47c0b0877ec58ddd1288b594.zip
Reduced code size of interface. Support ifconfig -a and ifconfig interface
display. Change %llu to %Lu in ifconfig for hacked unsigned long long support in uClibc scanf.
Diffstat (limited to 'networking')
-rw-r--r--networking/ifconfig.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 95dda3bce..75bcf38e8 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -15,7 +15,7 @@
15 * Foundation; either version 2 of the License, or (at 15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version. 16 * your option) any later version.
17 * 17 *
18 * $Id: ifconfig.c,v 1.7 2001/03/10 02:00:54 mjn3 Exp $ 18 * $Id: ifconfig.c,v 1.8 2001/03/12 09:57:59 mjn3 Exp $
19 * 19 *
20 */ 20 */
21 21
@@ -26,7 +26,7 @@
26 * converting to a table-driven approach. Added several (optional) 26 * converting to a table-driven approach. Added several (optional)
27 * args missing from initial port. 27 * args missing from initial port.
28 * 28 *
29 * Still missing: media. 29 * Still missing: media, tunnel.
30 */ 30 */
31 31
32#include <stdio.h> 32#include <stdio.h>
@@ -234,7 +234,8 @@ static int in_ether(char *bufp, struct sockaddr *sap);
234#endif 234#endif
235 235
236#ifdef BB_FEATURE_IFCONFIG_STATUS 236#ifdef BB_FEATURE_IFCONFIG_STATUS
237extern int display_interfaces(int display_all); 237extern int interface_opt_a;
238extern int display_interfaces(char *ifname);
238#endif 239#endif
239 240
240/* 241/*
@@ -261,24 +262,26 @@ int ifconfig_main(int argc, char **argv)
261 goterr = 0; 262 goterr = 0;
262 did_flags = 0; 263 did_flags = 0;
263 264
264 if(argc < 2) {
265#ifdef BB_FEATURE_IFCONFIG_STATUS
266 return(display_interfaces(0));
267#else
268 show_usage();
269#endif
270 }
271
272 /* skip argv[0] */ 265 /* skip argv[0] */
273 argc--; 266 ++argv;
274 argv++; 267 --argc;
275 268
276#ifdef BB_FEATURE_IFCONFIG_STATUS 269#ifdef BB_FEATURE_IFCONFIG_STATUS
277 if ((argc == 1) && (strcmp(*argv, "-a") == 0)) { 270 if ((argc > 0) && (strcmp(*argv,"-a") == 0)) {
278 return(display_interfaces(1)); 271 interface_opt_a = 1;
272 --argc;
273 ++argv;
279 } 274 }
280#endif 275#endif
281 276
277 if(argc <= 1) {
278#ifdef BB_FEATURE_IFCONFIG_STATUS
279 return display_interfaces(argc ? *argv : NULL);
280#else
281 show_usage();
282#endif
283 }
284
282 /* Create a channel to the NET kernel. */ 285 /* Create a channel to the NET kernel. */
283 if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { 286 if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
284 perror_msg_and_die("socket"); 287 perror_msg_and_die("socket");