[BusyBox-cvs] busybox/networking ipaddr.c,NONE,1.1 iplink.c,NONE,1.1 iproute.c,NONE,1.1 iptunnel.c,NONE,1.1 Makefile.in,1.8,1.9 config.in,1.14,1.15 ip.c,1.1,1.2
Glenn McGrath
bug1 at busybox.net
Sun Dec 1 23:04:10 UTC 2002
- Previous message: [BusyBox-cvs] busybox/include applets.h,1.80,1.81 usage.h,1.124,1.125
- Next message: [BusyBox-cvs] busybox/networking/libiproute ip_parse_common_args.c,NONE,1.1 Makefile.in,1.2,1.3 ip_common.h,1.1,1.2 ipaddress.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/busybox/networking
In directory winder:/tmp/cvs-serv5851/networking
Modified Files:
Makefile.in config.in ip.c
Added Files:
ipaddr.c iplink.c iproute.c iptunnel.c
Log Message:
Enable ip commands to be compiled seperate from ip, modifed patch from Bastian Blank
--- NEW FILE: ipaddr.c ---
/*
* ip.c "ip" utility frontend.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet at ms2.inr.ac.ru>
*
*
* Changes:
*
* Rani Assaf <rani at magic.metawire.com> 980929: resolve addresses
*/
#include "./libiproute/utils.h"
#include "./libiproute/ip_common.h"
#include "busybox.h"
int ipaddr_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_ipaddr(argc-1, argv+1);
}
--- NEW FILE: iplink.c ---
/*
* ip.c "ip" utility frontend.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet at ms2.inr.ac.ru>
*
*
* Changes:
*
* Rani Assaf <rani at magic.metawire.com> 980929: resolve addresses
*/
#include "./libiproute/utils.h"
#include "./libiproute/ip_common.h"
#include "busybox.h"
int iplink_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_iplink(argc-1, argv+1);
}
--- NEW FILE: iproute.c ---
/*
* ip.c "ip" utility frontend.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet at ms2.inr.ac.ru>
*
*
* Changes:
*
* Rani Assaf <rani at magic.metawire.com> 980929: resolve addresses
*/
#include "./libiproute/utils.h"
#include "./libiproute/ip_common.h"
#include "busybox.h"
int iproute_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_iproute(argc-1, argv+1);
}
--- NEW FILE: iptunnel.c ---
/*
* ip.c "ip" utility frontend.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Authors: Alexey Kuznetsov, <kuznet at ms2.inr.ac.ru>
*
*
* Changes:
*
* Rani Assaf <rani at magic.metawire.com> 980929: resolve addresses
*/
#include "./libiproute/utils.h"
#include "./libiproute/ip_common.h"
#include "busybox.h"
int iptunnel_main(int argc, char **argv)
{
ip_parse_common_args(&argc, &argv);
return do_iptunnel(argc-1, argv+1);
}
Index: Makefile.in
===================================================================
RCS file: /var/cvs/busybox/networking/Makefile.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- Makefile.in 10 Nov 2002 23:42:27 -0000 1.8
+++ Makefile.in 1 Dec 2002 23:04:05 -0000 1.9
@@ -23,21 +23,25 @@
endif
NETWORKING-y:=
-NETWORKING-$(CONFIG_HOSTNAME) += hostname.o
-NETWORKING-$(CONFIG_IFCONFIG) += ifconfig.o
-NETWORKING-$(CONFIG_IFUPDOWN) += ifupdown.o
-NETWORKING-$(CONFIG_IP) += ip.o
-NETWORKING-$(CONFIG_IPCALC) += ipcalc.o
+NETWORKING-$(CONFIG_HOSTNAME) += hostname.o
+NETWORKING-$(CONFIG_IFCONFIG) += ifconfig.o
+NETWORKING-$(CONFIG_IFUPDOWN) += ifupdown.o
+NETWORKING-$(CONFIG_IP) += ip.o
+NETWORKING-$(CONFIG_IPCALC) += ipcalc.o
+NETWORKING-$(CONFIG_IPADDR) += ipaddr.o
+NETWORKING-$(CONFIG_IPLINK) += iplink.o
+NETWORKING-$(CONFIG_IPROUTE) += iproute.o
+NETWORKING-$(CONFIG_IPTUNNEL) += iptunnel.o
NETWORKING-$(CONFIG_NC) += nc.o
-NETWORKING-$(CONFIG_NETSTAT) += netstat.o
-NETWORKING-$(CONFIG_NSLOOKUP) += nslookup.o
+NETWORKING-$(CONFIG_NETSTAT) += netstat.o
+NETWORKING-$(CONFIG_NSLOOKUP) += nslookup.o
NETWORKING-$(CONFIG_PING) += ping.o
NETWORKING-$(CONFIG_PING6) += ping6.o
NETWORKING-$(CONFIG_ROUTE) += route.o
NETWORKING-$(CONFIG_TELNET) += telnet.o
-NETWORKING-$(CONFIG_TELNETD) += telnetd.o
+NETWORKING-$(CONFIG_TELNETD) += telnetd.o
NETWORKING-$(CONFIG_TFTP) += tftp.o
-NETWORKING-$(CONFIG_TRACEROUTE) += traceroute.o
+NETWORKING-$(CONFIG_TRACEROUTE) += traceroute.o
NETWORKING-$(CONFIG_WGET) += wget.o
libraries-y+=$(NETWORKING_DIR)$(NETWORKING_AR)
Index: config.in
===================================================================
RCS file: /var/cvs/busybox/networking/config.in,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- config.in 17 Nov 2002 21:48:11 -0000 1.14
+++ config.in 1 Dec 2002 23:04:05 -0000 1.15
@@ -33,10 +33,26 @@
if [ "$CONFIG_IPCALC" = "y" ]; then
bool ' Fancy IPCALC, more options, adds 300 bytes' CONFIG_FEATURE_IPCALC_FANCY
fi
-bool 'nc' CONFIG_NC
+bool 'ipaddr' CONFIG_IPADDR
+if [ "$CONFIG_IP" = "y" ] && [ "$CONFIG_IPADDR" = "y" ]; then
+ define_bool CONFIG_FEATURE_IP_ADDRESS y
+fi
+bool 'iplink' CONFIG_IPLINK
+if [ "$CONFIG_IP" = "y" ] && [ "$CONFIG_IPLINK" = "y" ]; then
+ define_bool CONFIG_FEATURE_IP_LINK y
+fi
+bool 'iproute' CONFIG_IPROUTE
+if [ "$CONFIG_IP" = "y" ] && [ "$CONFIG_IPROUTE" = "y" ]; then
+ define_bool CONFIG_FEATURE_IP_ROUTE y
+fi
+bool 'iptunnel' CONFIG_IPTUNNEL
+if [ "$CONFIG_IP" = "y" ] && [ "$CONFIG_IPTUNNEL" = "y" ]; then
+ define_bool CONFIG_FEATURE_IP_TUNNEL y
+fi
+bool 'nc' CONFIG_NC
bool 'netstat' CONFIG_NETSTAT
bool 'nslookup' CONFIG_NSLOOKUP
-bool 'ping' CONFIG_PING
+bool 'ping' CONFIG_PING
if [ "$CONFIG_PING" = "y" ]; then
bool ' Enable fancy ping output' CONFIG_FEATURE_FANCY_PING
fi
Index: ip.c
===================================================================
RCS file: /var/cvs/busybox/networking/ip.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ip.c 10 Nov 2002 01:33:49 -0000 1.1
+++ ip.c 1 Dec 2002 23:04:05 -0000 1.2
@@ -28,30 +28,30 @@
#include "busybox.h"
+#if 0
int preferred_family = AF_UNSPEC;
int oneline = 0;
char * _SL_ = NULL;
-int ip_main(int argc, char **argv)
+void ip_parse_common_args(int *argcp, char ***argvp)
{
- char *basename;
+ int argc = *argcp;
+ char **argv = *argvp;
- basename = strrchr(argv[0], '/');
- if (basename == NULL)
- basename = argv[0];
- else
- basename++;
-
while (argc > 1) {
char *opt = argv[1];
+
if (strcmp(opt,"--") == 0) {
argc--; argv++;
break;
}
+
if (opt[0] != '-')
break;
+
if (opt[1] == '-')
opt++;
+
if (matches(opt, "-family") == 0) {
argc--;
argv++;
@@ -72,33 +72,44 @@
} else if (matches(opt, "-oneline") == 0) {
++oneline;
} else {
- fprintf(stderr, "Option \"%s\" is unknown, try \"ip -help\".\n", opt);
- exit(-1);
+ show_usage();
}
argc--; argv++;
}
-
_SL_ = oneline ? "\\" : "\n" ;
+}
+#endif
+
+int ip_main(int argc, char **argv)
+{
+ int ret = EXIT_FAILURE;
+
+ ip_parse_common_args(&argc, &argv);
if (argc > 1) {
#ifdef CONFIG_FEATURE_IP_ADDRESS
- if (matches(argv[1], "address") == 0)
- return do_ipaddr(argc-2, argv+2);
+ if (matches(argv[1], "address") == 0) {
+ ret = do_ipaddr(argc-2, argv+2);
+ }
#endif
#ifdef CONFIG_FEATURE_IP_ROUTE
- if (matches(argv[1], "route") == 0)
- return do_iproute(argc-2, argv+2);
+ else if (matches(argv[1], "route") == 0) {
+ ret = do_iproute(argc-2, argv+2);
+ }
#endif
#ifdef CONFIG_FEATURE_IP_LINK
- if (matches(argv[1], "link") == 0)
- return do_iplink(argc-2, argv+2);
+ else if (matches(argv[1], "link") == 0) {
+ ret = do_iplink(argc-2, argv+2);
+ }
#endif
#ifdef CONFIG_FEATURE_IP_TUNNEL
- if (matches(argv[1], "tunnel") == 0 ||
- strcmp(argv[1], "tunl") == 0)
- return do_iptunnel(argc-2, argv+2);
+ else if (matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0) {
+ ret = do_iptunnel(argc-2, argv+2);
+ }
#endif
- fprintf(stderr, "Object \"%s\" is unknown, try \"ip help\".\n", argv[1]);
- exit(-1);
}
+ if (ret) {
+ show_usage();
+ }
+ return(EXIT_SUCCESS);
}
- Previous message: [BusyBox-cvs] busybox/include applets.h,1.80,1.81 usage.h,1.124,1.125
- Next message: [BusyBox-cvs] busybox/networking/libiproute ip_parse_common_args.c,NONE,1.1 Makefile.in,1.2,1.3 ip_common.h,1.1,1.2 ipaddress.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the busybox-cvs
mailing list