aboutsummaryrefslogtreecommitdiff
path: root/ifconfig.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-02-14 21:23:06 +0000
committerEric Andersen <andersen@codepoet.org>2001-02-14 21:23:06 +0000
commit67991cf824f8df27e74c92d754fb507681c69ce6 (patch)
treea0b652f3dc794d1050c1a8de3afb014a621238fa /ifconfig.c
parent68be2ab914e1e20fe666bbd22a89a18714be2789 (diff)
downloadbusybox-w32-67991cf824f8df27e74c92d754fb507681c69ce6.tar.gz
busybox-w32-67991cf824f8df27e74c92d754fb507681c69ce6.tar.bz2
busybox-w32-67991cf824f8df27e74c92d754fb507681c69ce6.zip
This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make usage messages occupy less space and simplify how usage messages are displayed.
Diffstat (limited to 'ifconfig.c')
-rw-r--r--ifconfig.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ifconfig.c b/ifconfig.c
index 2134f8a48..66615a2fd 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.1 2001/02/14 08:11:27 andersen Exp $ 18 * $Id: ifconfig.c,v 1.2 2001/02/14 21:23:06 andersen Exp $
19 * 19 *
20 */ 20 */
21 21
@@ -183,7 +183,7 @@ int ifconfig_main(int argc, char **argv)
183 char host[128]; 183 char host[128];
184 184
185 if(argc < 2) { 185 if(argc < 2) {
186 usage(ifconfig_usage); 186 show_usage();
187 } 187 }
188 188
189 /* Create a channel to the NET kernel. */ 189 /* Create a channel to the NET kernel. */
@@ -269,7 +269,7 @@ int ifconfig_main(int argc, char **argv)
269 269
270 if (!strcmp(*spp, "metric")) { 270 if (!strcmp(*spp, "metric")) {
271 if (*++spp == NULL) 271 if (*++spp == NULL)
272 usage(ifconfig_usage); 272 show_usage();
273 ifr.ifr_metric = atoi(*spp); 273 ifr.ifr_metric = atoi(*spp);
274 if (ioctl(sockfd, SIOCSIFMETRIC, &ifr) < 0) { 274 if (ioctl(sockfd, SIOCSIFMETRIC, &ifr) < 0) {
275 fprintf(stderr, "SIOCSIFMETRIC: %s\n", strerror(errno)); 275 fprintf(stderr, "SIOCSIFMETRIC: %s\n", strerror(errno));
@@ -280,7 +280,7 @@ int ifconfig_main(int argc, char **argv)
280 } 280 }
281 if (!strcmp(*spp, "mtu")) { 281 if (!strcmp(*spp, "mtu")) {
282 if (*++spp == NULL) 282 if (*++spp == NULL)
283 usage(ifconfig_usage); 283 show_usage();
284 ifr.ifr_mtu = atoi(*spp); 284 ifr.ifr_mtu = atoi(*spp);
285 if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) { 285 if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) {
286 fprintf(stderr, "SIOCSIFMTU: %s\n", strerror(errno)); 286 fprintf(stderr, "SIOCSIFMTU: %s\n", strerror(errno));
@@ -292,7 +292,7 @@ int ifconfig_main(int argc, char **argv)
292#ifdef SIOCSKEEPALIVE 292#ifdef SIOCSKEEPALIVE
293 if (!strcmp(*spp, "keepalive")) { 293 if (!strcmp(*spp, "keepalive")) {
294 if (*++spp == NULL) 294 if (*++spp == NULL)
295 usage(ifconfig_usage); 295 show_usage();
296 ifr.ifr_data = (caddr_t) atoi(*spp); 296 ifr.ifr_data = (caddr_t) atoi(*spp);
297 if (ioctl(sockfd, SIOCSKEEPALIVE, &ifr) < 0) { 297 if (ioctl(sockfd, SIOCSKEEPALIVE, &ifr) < 0) {
298 fprintf(stderr, "SIOCSKEEPALIVE: %s\n", strerror(errno)); 298 fprintf(stderr, "SIOCSKEEPALIVE: %s\n", strerror(errno));
@@ -306,7 +306,7 @@ int ifconfig_main(int argc, char **argv)
306#ifdef SIOCSOUTFILL 306#ifdef SIOCSOUTFILL
307 if (!strcmp(*spp, "outfill")) { 307 if (!strcmp(*spp, "outfill")) {
308 if (*++spp == NULL) 308 if (*++spp == NULL)
309 usage(ifconfig_usage); 309 show_usage();
310 ifr.ifr_data = (caddr_t) atoi(*spp); 310 ifr.ifr_data = (caddr_t) atoi(*spp);
311 if (ioctl(sockfd, SIOCSOUTFILL, &ifr) < 0) { 311 if (ioctl(sockfd, SIOCSOUTFILL, &ifr) < 0) {
312 fprintf(stderr, "SIOCSOUTFILL: %s\n", strerror(errno)); 312 fprintf(stderr, "SIOCSOUTFILL: %s\n", strerror(errno));
@@ -344,7 +344,7 @@ int ifconfig_main(int argc, char **argv)
344 } 344 }
345 if (!strcmp(*spp, "dstaddr")) { 345 if (!strcmp(*spp, "dstaddr")) {
346 if (*++spp == NULL) 346 if (*++spp == NULL)
347 usage(ifconfig_usage); 347 show_usage();
348 safe_strncpy(host, *spp, (sizeof host)); 348 safe_strncpy(host, *spp, (sizeof host));
349 if (INET_resolve(host, &sa) < 0) { 349 if (INET_resolve(host, &sa) < 0) {
350 goterr++; 350 goterr++;
@@ -363,7 +363,7 @@ int ifconfig_main(int argc, char **argv)
363 } 363 }
364 if (!strcmp(*spp, "netmask")) { 364 if (!strcmp(*spp, "netmask")) {
365 if (*++spp == NULL || didnetmask) 365 if (*++spp == NULL || didnetmask)
366 usage(ifconfig_usage); 366 show_usage();
367 safe_strncpy(host, *spp, (sizeof host)); 367 safe_strncpy(host, *spp, (sizeof host));
368 if (INET_resolve(host, &sa) < 0) { 368 if (INET_resolve(host, &sa) < 0) {
369 goterr++; 369 goterr++;
@@ -409,7 +409,7 @@ int ifconfig_main(int argc, char **argv)
409 409
410 if (!strcmp(*spp, "hw")) { 410 if (!strcmp(*spp, "hw")) {
411 if (*++spp == NULL || strcmp("ether", *spp)) { 411 if (*++spp == NULL || strcmp("ether", *spp)) {
412 usage(ifconfig_usage); 412 show_usage();
413 } 413 }
414 414
415 if (*++spp == NULL) { 415 if (*++spp == NULL) {
@@ -438,7 +438,7 @@ int ifconfig_main(int argc, char **argv)
438 safe_strncpy(host, *spp, (sizeof host)); 438 safe_strncpy(host, *spp, (sizeof host));
439 439
440 if (INET_resolve(host, &sa) < 0) { 440 if (INET_resolve(host, &sa) < 0) {
441 usage(ifconfig_usage); 441 show_usage();
442 } 442 }
443 memcpy((char *) &ifr.ifr_addr, 443 memcpy((char *) &ifr.ifr_addr,
444 (char *) &sa, sizeof(struct sockaddr)); 444 (char *) &sa, sizeof(struct sockaddr));