diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2001-03-10 02:00:54 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2001-03-10 02:00:54 +0000 |
commit | 78f57460f2776aeddb584dd10923959f26863ea5 (patch) | |
tree | 69bd4341c9a5c604793226a1d2509cf1dd57ab6b | |
parent | d2117e9c828e02bfc1da38768fc3f6198cab9340 (diff) | |
download | busybox-w32-78f57460f2776aeddb584dd10923959f26863ea5.tar.gz busybox-w32-78f57460f2776aeddb584dd10923959f26863ea5.tar.bz2 busybox-w32-78f57460f2776aeddb584dd10923959f26863ea5.zip |
Quick mod to enable option -a for ifconfig.
-rw-r--r-- | ifconfig.c | 22 | ||||
-rw-r--r-- | interface.c | 9 | ||||
-rw-r--r-- | networking/ifconfig.c | 22 |
3 files changed, 33 insertions, 20 deletions
diff --git a/ifconfig.c b/ifconfig.c index daf189458..95dda3bce 100644 --- a/ifconfig.c +++ b/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.6 2001/03/09 23:06:15 mjn3 Exp $ | 18 | * $Id: ifconfig.c,v 1.7 2001/03/10 02:00:54 mjn3 Exp $ |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
@@ -234,7 +234,7 @@ 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 |
237 | extern int display_interfaces(void); | 237 | extern int display_interfaces(int display_all); |
238 | #endif | 238 | #endif |
239 | 239 | ||
240 | /* | 240 | /* |
@@ -263,21 +263,27 @@ int ifconfig_main(int argc, char **argv) | |||
263 | 263 | ||
264 | if(argc < 2) { | 264 | if(argc < 2) { |
265 | #ifdef BB_FEATURE_IFCONFIG_STATUS | 265 | #ifdef BB_FEATURE_IFCONFIG_STATUS |
266 | return(display_interfaces()); | 266 | return(display_interfaces(0)); |
267 | #else | 267 | #else |
268 | show_usage(); | 268 | show_usage(); |
269 | #endif | 269 | #endif |
270 | } | 270 | } |
271 | 271 | ||
272 | /* skip argv[0] */ | ||
273 | argc--; | ||
274 | argv++; | ||
275 | |||
276 | #ifdef BB_FEATURE_IFCONFIG_STATUS | ||
277 | if ((argc == 1) && (strcmp(*argv, "-a") == 0)) { | ||
278 | return(display_interfaces(1)); | ||
279 | } | ||
280 | #endif | ||
281 | |||
272 | /* Create a channel to the NET kernel. */ | 282 | /* Create a channel to the NET kernel. */ |
273 | if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { | 283 | if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { |
274 | perror_msg_and_die("socket"); | 284 | perror_msg_and_die("socket"); |
275 | } | 285 | } |
276 | 286 | ||
277 | /* skip argv[0] */ | ||
278 | argc--; | ||
279 | argv++; | ||
280 | |||
281 | /* get interface name */ | 287 | /* get interface name */ |
282 | safe_strncpy(ifr.ifr_name, *argv, IFNAMSIZ); | 288 | safe_strncpy(ifr.ifr_name, *argv, IFNAMSIZ); |
283 | 289 | ||
@@ -290,7 +296,7 @@ int ifconfig_main(int argc, char **argv) | |||
290 | mask = M_MASK; /* set the appropriate mask. */ | 296 | mask = M_MASK; /* set the appropriate mask. */ |
291 | } | 297 | } |
292 | for (op = OptArray ; op->name ; op++) { /* Find table entry. */ | 298 | for (op = OptArray ; op->name ; op++) { /* Find table entry. */ |
293 | if (!strcmp(p,op->name)) { /* If name matches... */ | 299 | if (strcmp(p,op->name) == 0) { /* If name matches... */ |
294 | if ((mask &= op->flags)) { /* set the mask and go. */ | 300 | if ((mask &= op->flags)) { /* set the mask and go. */ |
295 | goto FOUND_ARG;; | 301 | goto FOUND_ARG;; |
296 | } | 302 | } |
diff --git a/interface.c b/interface.c index 4df1a721a..648888bf5 100644 --- a/interface.c +++ b/interface.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * that either displays or sets the characteristics of | 3 | * that either displays or sets the characteristics of |
4 | * one or more of the system's networking interfaces. | 4 | * one or more of the system's networking interfaces. |
5 | * | 5 | * |
6 | * Version: $Id: interface.c,v 1.2 2001/03/06 20:54:43 andersen Exp $ | 6 | * Version: $Id: interface.c,v 1.3 2001/03/10 02:00:54 mjn3 Exp $ |
7 | * | 7 | * |
8 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | 8 | * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> |
9 | * and others. Copyright 1993 MicroWalt Corporation | 9 | * and others. Copyright 1993 MicroWalt Corporation |
@@ -2059,14 +2059,15 @@ static int if_print(char *ifname) | |||
2059 | return res; | 2059 | return res; |
2060 | } | 2060 | } |
2061 | 2061 | ||
2062 | int display_interfaces(void) | 2062 | int display_interfaces(int opt_all) |
2063 | { | 2063 | { |
2064 | int status; | 2064 | int status; |
2065 | 2065 | ||
2066 | opt_a = opt_all; | ||
2067 | |||
2066 | /* Create a channel to the NET kernel. */ | 2068 | /* Create a channel to the NET kernel. */ |
2067 | if ((skfd = sockets_open(0)) < 0) { | 2069 | if ((skfd = sockets_open(0)) < 0) { |
2068 | perror("socket"); | 2070 | perror_msg_and_die("socket"); |
2069 | exit(1); | ||
2070 | } | 2071 | } |
2071 | 2072 | ||
2072 | /* Do we have to show the current setup? */ | 2073 | /* Do we have to show the current setup? */ |
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index daf189458..95dda3bce 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.6 2001/03/09 23:06:15 mjn3 Exp $ | 18 | * $Id: ifconfig.c,v 1.7 2001/03/10 02:00:54 mjn3 Exp $ |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
@@ -234,7 +234,7 @@ 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 |
237 | extern int display_interfaces(void); | 237 | extern int display_interfaces(int display_all); |
238 | #endif | 238 | #endif |
239 | 239 | ||
240 | /* | 240 | /* |
@@ -263,21 +263,27 @@ int ifconfig_main(int argc, char **argv) | |||
263 | 263 | ||
264 | if(argc < 2) { | 264 | if(argc < 2) { |
265 | #ifdef BB_FEATURE_IFCONFIG_STATUS | 265 | #ifdef BB_FEATURE_IFCONFIG_STATUS |
266 | return(display_interfaces()); | 266 | return(display_interfaces(0)); |
267 | #else | 267 | #else |
268 | show_usage(); | 268 | show_usage(); |
269 | #endif | 269 | #endif |
270 | } | 270 | } |
271 | 271 | ||
272 | /* skip argv[0] */ | ||
273 | argc--; | ||
274 | argv++; | ||
275 | |||
276 | #ifdef BB_FEATURE_IFCONFIG_STATUS | ||
277 | if ((argc == 1) && (strcmp(*argv, "-a") == 0)) { | ||
278 | return(display_interfaces(1)); | ||
279 | } | ||
280 | #endif | ||
281 | |||
272 | /* Create a channel to the NET kernel. */ | 282 | /* Create a channel to the NET kernel. */ |
273 | if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { | 283 | if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { |
274 | perror_msg_and_die("socket"); | 284 | perror_msg_and_die("socket"); |
275 | } | 285 | } |
276 | 286 | ||
277 | /* skip argv[0] */ | ||
278 | argc--; | ||
279 | argv++; | ||
280 | |||
281 | /* get interface name */ | 287 | /* get interface name */ |
282 | safe_strncpy(ifr.ifr_name, *argv, IFNAMSIZ); | 288 | safe_strncpy(ifr.ifr_name, *argv, IFNAMSIZ); |
283 | 289 | ||
@@ -290,7 +296,7 @@ int ifconfig_main(int argc, char **argv) | |||
290 | mask = M_MASK; /* set the appropriate mask. */ | 296 | mask = M_MASK; /* set the appropriate mask. */ |
291 | } | 297 | } |
292 | for (op = OptArray ; op->name ; op++) { /* Find table entry. */ | 298 | for (op = OptArray ; op->name ; op++) { /* Find table entry. */ |
293 | if (!strcmp(p,op->name)) { /* If name matches... */ | 299 | if (strcmp(p,op->name) == 0) { /* If name matches... */ |
294 | if ((mask &= op->flags)) { /* set the mask and go. */ | 300 | if ((mask &= op->flags)) { /* set the mask and go. */ |
295 | goto FOUND_ARG;; | 301 | goto FOUND_ARG;; |
296 | } | 302 | } |