summaryrefslogtreecommitdiff
path: root/networking
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 /networking
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 'networking')
-rw-r--r--networking/hostname.c10
-rw-r--r--networking/ifconfig.c20
-rw-r--r--networking/nc.c4
-rw-r--r--networking/nslookup.c4
-rw-r--r--networking/ping.c12
-rw-r--r--networking/route.c26
-rw-r--r--networking/telnet.c2
-rw-r--r--networking/wget.c6
8 files changed, 42 insertions, 42 deletions
diff --git a/networking/hostname.c b/networking/hostname.c
index ce17ba91c..e1486b365 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: hostname.c,v 1.23 2001/02/01 16:49:29 kraai Exp $ 3 * $Id: hostname.c,v 1.24 2001/02/14 21:23:06 andersen Exp $
4 * Mini hostname implementation for busybox 4 * Mini hostname implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -66,7 +66,7 @@ int hostname_main(int argc, char **argv)
66 char *s = NULL; 66 char *s = NULL;
67 67
68 if (argc < 1) 68 if (argc < 1)
69 usage(hostname_usage); 69 show_usage();
70 70
71 while (--argc > 0 && **(++argv) == '-') { 71 while (--argc > 0 && **(++argv) == '-') {
72 while (*(++(*argv))) { 72 while (*(++(*argv))) {
@@ -82,18 +82,18 @@ int hostname_main(int argc, char **argv)
82 break; 82 break;
83 case 'F': 83 case 'F':
84 if (--argc == 0) { 84 if (--argc == 0) {
85 usage(hostname_usage); 85 show_usage();
86 } 86 }
87 filename = *(++argv); 87 filename = *(++argv);
88 break; 88 break;
89 case '-': 89 case '-':
90 if (strcmp(++(*argv), "file") || --argc ==0 ) { 90 if (strcmp(++(*argv), "file") || --argc ==0 ) {
91 usage(hostname_usage); 91 show_usage();
92 } 92 }
93 filename = *(++argv); 93 filename = *(++argv);
94 break; 94 break;
95 default: 95 default:
96 usage(hostname_usage); 96 show_usage();
97 } 97 }
98 if (filename != NULL) 98 if (filename != NULL)
99 break; 99 break;
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 2134f8a48..66615a2fd 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.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));
diff --git a/networking/nc.c b/networking/nc.c
index 3f512d1cb..8927103e0 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -58,12 +58,12 @@ int nc_main(int argc, char **argv)
58 lport = atoi(optarg); 58 lport = atoi(optarg);
59 break; 59 break;
60 default: 60 default:
61 usage(nc_usage); 61 show_usage();
62 } 62 }
63 } 63 }
64 64
65 if ((do_listen && optind != argc) || (!do_listen && optind + 2 != argc)) 65 if ((do_listen && optind != argc) || (!do_listen && optind + 2 != argc))
66 usage(nc_usage); 66 show_usage();
67 67
68 if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) 68 if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
69 perror_msg_and_die("socket"); 69 perror_msg_and_die("socket");
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 8bfcd5785..33732de68 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -157,7 +157,7 @@ int nslookup_main(int argc, char **argv)
157 struct hostent *host; 157 struct hostent *host;
158 158
159 if (argc < 2 || *argv[1]=='-') { 159 if (argc < 2 || *argv[1]=='-') {
160 usage(nslookup_usage); 160 show_usage();
161 } 161 }
162 162
163 server_print(); 163 server_print();
@@ -170,4 +170,4 @@ int nslookup_main(int argc, char **argv)
170 return EXIT_SUCCESS; 170 return EXIT_SUCCESS;
171} 171}
172 172
173/* $Id: nslookup.c,v 1.20 2001/01/27 09:33:38 andersen Exp $ */ 173/* $Id: nslookup.c,v 1.21 2001/02/14 21:23:06 andersen Exp $ */
diff --git a/networking/ping.c b/networking/ping.c
index 15611babd..c114fb0b3 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * $Id: ping.c,v 1.36 2001/01/31 19:00:21 kraai Exp $ 3 * $Id: ping.c,v 1.37 2001/02/14 21:23:06 andersen Exp $
4 * Mini ping implementation for busybox 4 * Mini ping implementation for busybox
5 * 5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -251,7 +251,7 @@ extern int ping_main(int argc, char **argv)
251 argc--; 251 argc--;
252 argv++; 252 argv++;
253 if (argc < 1) 253 if (argc < 1)
254 usage(ping_usage); 254 show_usage();
255 ping(*argv); 255 ping(*argv);
256 return EXIT_SUCCESS; 256 return EXIT_SUCCESS;
257} 257}
@@ -522,24 +522,24 @@ extern int ping_main(int argc, char **argv)
522 break; 522 break;
523 case 'c': 523 case 'c':
524 if (--argc <= 0) 524 if (--argc <= 0)
525 usage(ping_usage); 525 show_usage();
526 argv++; 526 argv++;
527 pingcount = atoi(*argv); 527 pingcount = atoi(*argv);
528 break; 528 break;
529 case 's': 529 case 's':
530 if (--argc <= 0) 530 if (--argc <= 0)
531 usage(ping_usage); 531 show_usage();
532 argv++; 532 argv++;
533 datalen = atoi(*argv); 533 datalen = atoi(*argv);
534 break; 534 break;
535 default: 535 default:
536 usage(ping_usage); 536 show_usage();
537 } 537 }
538 argc--; 538 argc--;
539 argv++; 539 argv++;
540 } 540 }
541 if (argc < 1) 541 if (argc < 1)
542 usage(ping_usage); 542 show_usage();
543 543
544 myid = getpid() & 0xFFFF; 544 myid = getpid() & 0xFFFF;
545 ping(*argv); 545 ping(*argv);
diff --git a/networking/route.c b/networking/route.c
index 83a0be2d2..3fad81a01 100644
--- a/networking/route.c
+++ b/networking/route.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: route.c,v 1.2 2001/02/14 19:26:39 andersen Exp $ 18 * $Id: route.c,v 1.3 2001/02/14 21:23:06 andersen Exp $
19 * 19 *
20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> 20 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
21 */ 21 */
@@ -115,7 +115,7 @@ INET_setroute(int action, int options, char **args)
115 args++; 115 args++;
116 } 116 }
117 if (*args == NULL) 117 if (*args == NULL)
118 usage(route_usage); 118 show_usage();
119 119
120 safe_strncpy(target, *args++, (sizeof target)); 120 safe_strncpy(target, *args++, (sizeof target));
121 121
@@ -152,7 +152,7 @@ INET_setroute(int action, int options, char **args)
152 152
153 args++; 153 args++;
154 if (!*args || !isdigit(**args)) 154 if (!*args || !isdigit(**args))
155 usage(route_usage); 155 show_usage();
156 metric = atoi(*args); 156 metric = atoi(*args);
157#if HAVE_NEW_ADDRT 157#if HAVE_NEW_ADDRT
158 rt.rt_metric = metric + 1; 158 rt.rt_metric = metric + 1;
@@ -168,7 +168,7 @@ INET_setroute(int action, int options, char **args)
168 168
169 args++; 169 args++;
170 if (!*args || mask_in_addr(rt)) 170 if (!*args || mask_in_addr(rt))
171 usage(route_usage); 171 show_usage();
172 safe_strncpy(netmask, *args, (sizeof netmask)); 172 safe_strncpy(netmask, *args, (sizeof netmask));
173 if ((isnet = INET_resolve(netmask, &mask)) < 0) { 173 if ((isnet = INET_resolve(netmask, &mask)) < 0) {
174 fprintf(stderr, "cant resolve netmask %s\n", netmask); 174 fprintf(stderr, "cant resolve netmask %s\n", netmask);
@@ -182,9 +182,9 @@ INET_setroute(int action, int options, char **args)
182 if (!strcmp(*args, "gw") || !strcmp(*args, "gateway")) { 182 if (!strcmp(*args, "gw") || !strcmp(*args, "gateway")) {
183 args++; 183 args++;
184 if (!*args) 184 if (!*args)
185 usage(route_usage); 185 show_usage();
186 if (rt.rt_flags & RTF_GATEWAY) 186 if (rt.rt_flags & RTF_GATEWAY)
187 usage(route_usage); 187 show_usage();
188 safe_strncpy(gateway, *args, (sizeof gateway)); 188 safe_strncpy(gateway, *args, (sizeof gateway));
189 if ((isnet = INET_resolve(gateway, &rt.rt_gateway)) < 0) { 189 if ((isnet = INET_resolve(gateway, &rt.rt_gateway)) < 0) {
190 fprintf(stderr, "cant resolve gw %s\n", gateway); 190 fprintf(stderr, "cant resolve gw %s\n", gateway);
@@ -205,7 +205,7 @@ INET_setroute(int action, int options, char **args)
205 args++; 205 args++;
206 rt.rt_flags |= RTF_MSS; 206 rt.rt_flags |= RTF_MSS;
207 if (!*args) 207 if (!*args)
208 usage(route_usage); 208 show_usage();
209 rt.rt_mss = atoi(*args); 209 rt.rt_mss = atoi(*args);
210 args++; 210 args++;
211 if (rt.rt_mss < 64 || rt.rt_mss > 32768) { 211 if (rt.rt_mss < 64 || rt.rt_mss > 32768) {
@@ -218,7 +218,7 @@ INET_setroute(int action, int options, char **args)
218 if (!strcmp(*args, "window")) { 218 if (!strcmp(*args, "window")) {
219 args++; 219 args++;
220 if (!*args) 220 if (!*args)
221 usage(route_usage); 221 show_usage();
222 rt.rt_flags |= RTF_WINDOW; 222 rt.rt_flags |= RTF_WINDOW;
223 rt.rt_window = atoi(*args); 223 rt.rt_window = atoi(*args);
224 args++; 224 args++;
@@ -232,7 +232,7 @@ INET_setroute(int action, int options, char **args)
232 if (!strcmp(*args, "irtt")) { 232 if (!strcmp(*args, "irtt")) {
233 args++; 233 args++;
234 if (!*args) 234 if (!*args)
235 usage(route_usage); 235 show_usage();
236 args++; 236 args++;
237#if HAVE_RTF_IRTT 237#if HAVE_RTF_IRTT
238 rt.rt_flags |= RTF_IRTT; 238 rt.rt_flags |= RTF_IRTT;
@@ -277,7 +277,7 @@ INET_setroute(int action, int options, char **args)
277 if (!strcmp(*args, "device") || !strcmp(*args, "dev")) { 277 if (!strcmp(*args, "device") || !strcmp(*args, "dev")) {
278 args++; 278 args++;
279 if (rt.rt_dev || *args == NULL) 279 if (rt.rt_dev || *args == NULL)
280 usage(route_usage); 280 show_usage();
281 rt.rt_dev = *args++; 281 rt.rt_dev = *args++;
282 continue; 282 continue;
283 } 283 }
@@ -285,9 +285,9 @@ INET_setroute(int action, int options, char **args)
285 if (!rt.rt_dev) { 285 if (!rt.rt_dev) {
286 rt.rt_dev = *args++; 286 rt.rt_dev = *args++;
287 if (*args) 287 if (*args)
288 usage(route_usage); /* must be last to catch typos */ 288 show_usage(); /* must be last to catch typos */
289 } else 289 } else
290 usage(route_usage); 290 show_usage();
291 } 291 }
292 292
293#if HAVE_RTF_REJECT 293#if HAVE_RTF_REJECT
@@ -420,7 +420,7 @@ int route_main(int argc, char **argv)
420 else if (!strcmp(*argv, "flush")) 420 else if (!strcmp(*argv, "flush"))
421 what = RTACTION_FLUSH; 421 what = RTACTION_FLUSH;
422 else 422 else
423 usage(route_usage); 423 show_usage();
424 } 424 }
425 425
426 INET_setroute(what, 0, ++argv); 426 INET_setroute(what, 0, ++argv);
diff --git a/networking/telnet.c b/networking/telnet.c
index b08effed7..ed92a8403 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -498,7 +498,7 @@ extern int telnet_main(int argc, char** argv)
498 498
499 cfmakeraw(&G.termios_raw); 499 cfmakeraw(&G.termios_raw);
500 500
501 if (argc < 2) usage(telnet_usage); 501 if (argc < 2) show_usage();
502 port = (argc > 2)? getport(argv[2]): 23; 502 port = (argc > 2)? getport(argv[2]): 23;
503 503
504 G.buf = xmalloc(DATABUFSIZE); 504 G.buf = xmalloc(DATABUFSIZE);
diff --git a/networking/wget.c b/networking/wget.c
index c134427e4..d1aacefa6 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -105,12 +105,12 @@ int wget_main(int argc, char **argv)
105 fname_out = (strcmp(optarg, "-") == 0 ? (char *)1 : optarg); 105 fname_out = (strcmp(optarg, "-") == 0 ? (char *)1 : optarg);
106 break; 106 break;
107 default: 107 default:
108 usage(wget_usage); 108 show_usage();
109 } 109 }
110 } 110 }
111 111
112 if (argc - optind != 1) 112 if (argc - optind != 1)
113 usage(wget_usage); 113 show_usage();
114 114
115 /* 115 /*
116 * Use the proxy if necessary. 116 * Use the proxy if necessary.
@@ -533,7 +533,7 @@ progressmeter(int flag)
533 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 533 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
534 * SUCH DAMAGE. 534 * SUCH DAMAGE.
535 * 535 *
536 * $Id: wget.c,v 1.26 2001/02/01 16:49:30 kraai Exp $ 536 * $Id: wget.c,v 1.27 2001/02/14 21:23:06 andersen Exp $
537 */ 537 */
538 538
539 539