aboutsummaryrefslogtreecommitdiff
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-67991cf824f8df27e74c92d754fb507681c69ce6.tar.gz
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 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: hostname.c,v 1.23 2001/02/01 16:49:29 kraai Exp $
+ * $Id: hostname.c,v 1.24 2001/02/14 21:23:06 andersen Exp $
* Mini hostname implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -66,7 +66,7 @@ int hostname_main(int argc, char **argv)
char *s = NULL;
if (argc < 1)
- usage(hostname_usage);
+ show_usage();
while (--argc > 0 && **(++argv) == '-') {
while (*(++(*argv))) {
@@ -82,18 +82,18 @@ int hostname_main(int argc, char **argv)
break;
case 'F':
if (--argc == 0) {
- usage(hostname_usage);
+ show_usage();
}
filename = *(++argv);
break;
case '-':
if (strcmp(++(*argv), "file") || --argc ==0 ) {
- usage(hostname_usage);
+ show_usage();
}
filename = *(++argv);
break;
default:
- usage(hostname_usage);
+ show_usage();
}
if (filename != NULL)
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 @@
* Foundation; either version 2 of the License, or (at
* your option) any later version.
*
- * $Id: ifconfig.c,v 1.1 2001/02/14 08:11:27 andersen Exp $
+ * $Id: ifconfig.c,v 1.2 2001/02/14 21:23:06 andersen Exp $
*
*/
@@ -183,7 +183,7 @@ int ifconfig_main(int argc, char **argv)
char host[128];
if(argc < 2) {
- usage(ifconfig_usage);
+ show_usage();
}
/* Create a channel to the NET kernel. */
@@ -269,7 +269,7 @@ int ifconfig_main(int argc, char **argv)
if (!strcmp(*spp, "metric")) {
if (*++spp == NULL)
- usage(ifconfig_usage);
+ show_usage();
ifr.ifr_metric = atoi(*spp);
if (ioctl(sockfd, SIOCSIFMETRIC, &ifr) < 0) {
fprintf(stderr, "SIOCSIFMETRIC: %s\n", strerror(errno));
@@ -280,7 +280,7 @@ int ifconfig_main(int argc, char **argv)
}
if (!strcmp(*spp, "mtu")) {
if (*++spp == NULL)
- usage(ifconfig_usage);
+ show_usage();
ifr.ifr_mtu = atoi(*spp);
if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) {
fprintf(stderr, "SIOCSIFMTU: %s\n", strerror(errno));
@@ -292,7 +292,7 @@ int ifconfig_main(int argc, char **argv)
#ifdef SIOCSKEEPALIVE
if (!strcmp(*spp, "keepalive")) {
if (*++spp == NULL)
- usage(ifconfig_usage);
+ show_usage();
ifr.ifr_data = (caddr_t) atoi(*spp);
if (ioctl(sockfd, SIOCSKEEPALIVE, &ifr) < 0) {
fprintf(stderr, "SIOCSKEEPALIVE: %s\n", strerror(errno));
@@ -306,7 +306,7 @@ int ifconfig_main(int argc, char **argv)
#ifdef SIOCSOUTFILL
if (!strcmp(*spp, "outfill")) {
if (*++spp == NULL)
- usage(ifconfig_usage);
+ show_usage();
ifr.ifr_data = (caddr_t) atoi(*spp);
if (ioctl(sockfd, SIOCSOUTFILL, &ifr) < 0) {
fprintf(stderr, "SIOCSOUTFILL: %s\n", strerror(errno));
@@ -344,7 +344,7 @@ int ifconfig_main(int argc, char **argv)
}
if (!strcmp(*spp, "dstaddr")) {
if (*++spp == NULL)
- usage(ifconfig_usage);
+ show_usage();
safe_strncpy(host, *spp, (sizeof host));
if (INET_resolve(host, &sa) < 0) {
goterr++;
@@ -363,7 +363,7 @@ int ifconfig_main(int argc, char **argv)
}
if (!strcmp(*spp, "netmask")) {
if (*++spp == NULL || didnetmask)
- usage(ifconfig_usage);
+ show_usage();
safe_strncpy(host, *spp, (sizeof host));
if (INET_resolve(host, &sa) < 0) {
goterr++;
@@ -409,7 +409,7 @@ int ifconfig_main(int argc, char **argv)
if (!strcmp(*spp, "hw")) {
if (*++spp == NULL || strcmp("ether", *spp)) {
- usage(ifconfig_usage);
+ show_usage();
}
if (*++spp == NULL) {
@@ -438,7 +438,7 @@ int ifconfig_main(int argc, char **argv)
safe_strncpy(host, *spp, (sizeof host));
if (INET_resolve(host, &sa) < 0) {
- usage(ifconfig_usage);
+ show_usage();
}
memcpy((char *) &ifr.ifr_addr,
(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)
lport = atoi(optarg);
break;
default:
- usage(nc_usage);
+ show_usage();
}
}
if ((do_listen && optind != argc) || (!do_listen && optind + 2 != argc))
- usage(nc_usage);
+ show_usage();
if ((sfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
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)
struct hostent *host;
if (argc < 2 || *argv[1]=='-') {
- usage(nslookup_usage);
+ show_usage();
}
server_print();
@@ -170,4 +170,4 @@ int nslookup_main(int argc, char **argv)
return EXIT_SUCCESS;
}
-/* $Id: nslookup.c,v 1.20 2001/01/27 09:33:38 andersen Exp $ */
+/* $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 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.36 2001/01/31 19:00:21 kraai Exp $
+ * $Id: ping.c,v 1.37 2001/02/14 21:23:06 andersen Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -251,7 +251,7 @@ extern int ping_main(int argc, char **argv)
argc--;
argv++;
if (argc < 1)
- usage(ping_usage);
+ show_usage();
ping(*argv);
return EXIT_SUCCESS;
}
@@ -522,24 +522,24 @@ extern int ping_main(int argc, char **argv)
break;
case 'c':
if (--argc <= 0)
- usage(ping_usage);
+ show_usage();
argv++;
pingcount = atoi(*argv);
break;
case 's':
if (--argc <= 0)
- usage(ping_usage);
+ show_usage();
argv++;
datalen = atoi(*argv);
break;
default:
- usage(ping_usage);
+ show_usage();
}
argc--;
argv++;
}
if (argc < 1)
- usage(ping_usage);
+ show_usage();
myid = getpid() & 0xFFFF;
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 @@
* Foundation; either version 2 of the License, or (at
* your option) any later version.
*
- * $Id: route.c,v 1.2 2001/02/14 19:26:39 andersen Exp $
+ * $Id: route.c,v 1.3 2001/02/14 21:23:06 andersen Exp $
*
* displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
*/
@@ -115,7 +115,7 @@ INET_setroute(int action, int options, char **args)
args++;
}
if (*args == NULL)
- usage(route_usage);
+ show_usage();
safe_strncpy(target, *args++, (sizeof target));
@@ -152,7 +152,7 @@ INET_setroute(int action, int options, char **args)
args++;
if (!*args || !isdigit(**args))
- usage(route_usage);
+ show_usage();
metric = atoi(*args);
#if HAVE_NEW_ADDRT
rt.rt_metric = metric + 1;
@@ -168,7 +168,7 @@ INET_setroute(int action, int options, char **args)
args++;
if (!*args || mask_in_addr(rt))
- usage(route_usage);
+ show_usage();
safe_strncpy(netmask, *args, (sizeof netmask));
if ((isnet = INET_resolve(netmask, &mask)) < 0) {
fprintf(stderr, "cant resolve netmask %s\n", netmask);
@@ -182,9 +182,9 @@ INET_setroute(int action, int options, char **args)
if (!strcmp(*args, "gw") || !strcmp(*args, "gateway")) {
args++;
if (!*args)
- usage(route_usage);
+ show_usage();
if (rt.rt_flags & RTF_GATEWAY)
- usage(route_usage);
+ show_usage();
safe_strncpy(gateway, *args, (sizeof gateway));
if ((isnet = INET_resolve(gateway, &rt.rt_gateway)) < 0) {
fprintf(stderr, "cant resolve gw %s\n", gateway);
@@ -205,7 +205,7 @@ INET_setroute(int action, int options, char **args)
args++;
rt.rt_flags |= RTF_MSS;
if (!*args)
- usage(route_usage);
+ show_usage();
rt.rt_mss = atoi(*args);
args++;
if (rt.rt_mss < 64 || rt.rt_mss > 32768) {
@@ -218,7 +218,7 @@ INET_setroute(int action, int options, char **args)
if (!strcmp(*args, "window")) {
args++;
if (!*args)
- usage(route_usage);
+ show_usage();
rt.rt_flags |= RTF_WINDOW;
rt.rt_window = atoi(*args);
args++;
@@ -232,7 +232,7 @@ INET_setroute(int action, int options, char **args)
if (!strcmp(*args, "irtt")) {
args++;
if (!*args)
- usage(route_usage);
+ show_usage();
args++;
#if HAVE_RTF_IRTT
rt.rt_flags |= RTF_IRTT;
@@ -277,7 +277,7 @@ INET_setroute(int action, int options, char **args)
if (!strcmp(*args, "device") || !strcmp(*args, "dev")) {
args++;
if (rt.rt_dev || *args == NULL)
- usage(route_usage);
+ show_usage();
rt.rt_dev = *args++;
continue;
}
@@ -285,9 +285,9 @@ INET_setroute(int action, int options, char **args)
if (!rt.rt_dev) {
rt.rt_dev = *args++;
if (*args)
- usage(route_usage); /* must be last to catch typos */
+ show_usage(); /* must be last to catch typos */
} else
- usage(route_usage);
+ show_usage();
}
#if HAVE_RTF_REJECT
@@ -420,7 +420,7 @@ int route_main(int argc, char **argv)
else if (!strcmp(*argv, "flush"))
what = RTACTION_FLUSH;
else
- usage(route_usage);
+ show_usage();
}
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)
cfmakeraw(&G.termios_raw);
- if (argc < 2) usage(telnet_usage);
+ if (argc < 2) show_usage();
port = (argc > 2)? getport(argv[2]): 23;
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)
fname_out = (strcmp(optarg, "-") == 0 ? (char *)1 : optarg);
break;
default:
- usage(wget_usage);
+ show_usage();
}
}
if (argc - optind != 1)
- usage(wget_usage);
+ show_usage();
/*
* Use the proxy if necessary.
@@ -533,7 +533,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.26 2001/02/01 16:49:30 kraai Exp $
+ * $Id: wget.c,v 1.27 2001/02/14 21:23:06 andersen Exp $
*/