aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-10-24 05:00:29 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-10-24 05:00:29 +0000
commit1e2799601614452a40df7862e6ca180ecb08c04d (patch)
tree153a573095afac8d8d0ea857759ecabd77fb28b7 /networking
parent47f91d1f7fc06cf27e2a6c3c2ada99226ba50cb9 (diff)
downloadbusybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.gz
busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.bz2
busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.zip
Major rework of the directory structure and the entire build system.
-Erik git-svn-id: svn://busybox.net/trunk/busybox@3561 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking')
-rw-r--r--networking/Makefile45
-rw-r--r--networking/config.in21
-rw-r--r--networking/hostname.c4
-rw-r--r--networking/ifconfig.c30
-rw-r--r--networking/nslookup.c6
-rw-r--r--networking/ping.c8
-rw-r--r--networking/telnet.c12
-rw-r--r--networking/tftp.c38
-rw-r--r--networking/traceroute.c26
-rw-r--r--networking/wget.c24
10 files changed, 140 insertions, 74 deletions
diff --git a/networking/Makefile b/networking/Makefile
new file mode 100644
index 000000000..4dd0cdb56
--- /dev/null
+++ b/networking/Makefile
@@ -0,0 +1,45 @@
1# Makefile for busybox
2#
3# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
19
20TOPDIR :=..
21L_TARGET := networking.a
22
23obj-y :=
24obj-n :=
25obj- :=
26
27
28obj-$(CONFIG_HOSTNAME) += hostname.o
29obj-$(CONFIG_IFCONFIG) += ifconfig.o
30obj-$(CONFIG_NC) += nc.o
31obj-$(CONFIG_NSLOOKUP) += nslookup.o
32obj-$(CONFIG_PING) += ping.o
33obj-$(CONFIG_ROUTE) += route.o
34obj-$(CONFIG_TELNET) += telnet.o
35obj-$(CONFIG_TFTP) += tftp.o
36obj-$(CONFIG_TRACEROUTE) += traceroute.o
37obj-$(CONFIG_WGET) += wget.o
38
39
40# Hand off to toplevel Rules.mak
41include $(TOPDIR)/Rules.mak
42
43clean:
44 rm -f $(L_TARGET) *.o core
45
diff --git a/networking/config.in b/networking/config.in
new file mode 100644
index 000000000..577d925c3
--- /dev/null
+++ b/networking/config.in
@@ -0,0 +1,21 @@
1#
2# For a description of the syntax of this configuration file,
3# see scripts/kbuild/config-language.txt.
4#
5
6mainmenu_option next_comment
7comment 'Networking Utilities'
8
9bool 'hostname' CONFIG_HOSTNAME
10bool 'ifconfig' CONFIG_IFCONFIG
11bool 'nc' CONFIG_NC
12bool 'nslookup' CONFIG_NSLOOKUP
13bool 'ping' CONFIG_PING
14bool 'route' CONFIG_ROUTE
15bool 'telnet' CONFIG_TELNET
16bool 'tftp' CONFIG_TFTP
17bool 'traceroute' CONFIG_TRACEROUTE
18bool 'wget' CONFIG_WGET
19
20endmenu
21
diff --git a/networking/hostname.c b/networking/hostname.c
index d87851509..7a26c1b2c 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.30 2001/06/26 02:06:08 bug1 Exp $ 3 * $Id: hostname.c,v 1.31 2001/10/24 04:59:56 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>
@@ -49,7 +49,7 @@ static void do_sethostname(char *s, int isfile)
49 } else { 49 } else {
50 f = xfopen(s, "r"); 50 f = xfopen(s, "r");
51 fgets(buf, 255, f); 51 fgets(buf, 255, f);
52#ifdef BB_FEATURE_CLEAN_UP 52#ifdef CONFIG_FEATURE_CLEAN_UP
53 fclose(f); 53 fclose(f);
54#endif 54#endif
55 chomp(buf); 55 chomp(buf);
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index c77ea04b1..3beecaf3d 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.12 2001/08/10 06:02:23 mjn3 Exp $ 18 * $Id: ifconfig.c,v 1.13 2001/10/24 04:59:56 andersen Exp $
19 * 19 *
20 */ 20 */
21 21
@@ -44,7 +44,7 @@
44#include <linux/if_ether.h> 44#include <linux/if_ether.h>
45#include "busybox.h" 45#include "busybox.h"
46 46
47#ifdef BB_FEATURE_IFCONFIG_SLIP 47#ifdef CONFIG_FEATURE_IFCONFIG_SLIP
48#include <linux/if_slip.h> 48#include <linux/if_slip.h>
49#endif 49#endif
50 50
@@ -173,7 +173,7 @@ static const struct arg1opt Arg1Opt[] = {
173 {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)}, 173 {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)},
174 {"SIOCSIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask)}, 174 {"SIOCSIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask)},
175 {"SIOCSIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr)}, 175 {"SIOCSIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr)},
176#ifdef BB_FEATURE_IFCONFIG_HW 176#ifdef CONFIG_FEATURE_IFCONFIG_HW
177 {"SIOCSIFHWADDR", SIOCSIFHWADDR, ifreq_offsetof(ifr_hwaddr)}, 177 {"SIOCSIFHWADDR", SIOCSIFHWADDR, ifreq_offsetof(ifr_hwaddr)},
178#endif 178#endif
179 {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)}, 179 {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)},
@@ -183,7 +183,7 @@ static const struct arg1opt Arg1Opt[] = {
183#ifdef SIOCSOUTFILL 183#ifdef SIOCSOUTFILL
184 {"SIOCSOUTFILL", SIOCSOUTFILL, ifreq_offsetof(ifr_data)}, 184 {"SIOCSOUTFILL", SIOCSOUTFILL, ifreq_offsetof(ifr_data)},
185#endif 185#endif
186#ifdef BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ 186#ifdef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
187 {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.mem_start)}, 187 {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.mem_start)},
188 {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.base_addr)}, 188 {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.base_addr)},
189 {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.irq)}, 189 {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.irq)},
@@ -199,7 +199,7 @@ static const struct options OptArray[] = {
199 {"dstaddr", N_ARG, ARG_DSTADDR, 0}, 199 {"dstaddr", N_ARG, ARG_DSTADDR, 0},
200 {"netmask", N_ARG, ARG_NETMASK, 0}, 200 {"netmask", N_ARG, ARG_NETMASK, 0},
201 {"broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST}, 201 {"broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST},
202#ifdef BB_FEATURE_IFCONFIG_HW 202#ifdef CONFIG_FEATURE_IFCONFIG_HW
203 {"hw", N_ARG, ARG_HW, 0}, 203 {"hw", N_ARG, ARG_HW, 0},
204#endif 204#endif
205 {"pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT}, 205 {"pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT},
@@ -209,7 +209,7 @@ static const struct options OptArray[] = {
209#ifdef SIOCSOUTFILL 209#ifdef SIOCSOUTFILL
210 {"outfill", N_ARG, ARG_OUTFILL, 0}, 210 {"outfill", N_ARG, ARG_OUTFILL, 0},
211#endif 211#endif
212#ifdef BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ 212#ifdef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
213 {"mem_start", N_ARG, ARG_MEM_START, 0}, 213 {"mem_start", N_ARG, ARG_MEM_START, 0},
214 {"io_addr", N_ARG, ARG_IO_ADDR, 0}, 214 {"io_addr", N_ARG, ARG_IO_ADDR, 0},
215 {"irq", N_ARG, ARG_IRQ, 0}, 215 {"irq", N_ARG, ARG_IRQ, 0},
@@ -229,11 +229,11 @@ static const struct options OptArray[] = {
229 * A couple of prototypes. 229 * A couple of prototypes.
230 */ 230 */
231 231
232#ifdef BB_FEATURE_IFCONFIG_HW 232#ifdef CONFIG_FEATURE_IFCONFIG_HW
233static int in_ether(char *bufp, struct sockaddr *sap); 233static int in_ether(char *bufp, struct sockaddr *sap);
234#endif 234#endif
235 235
236#ifdef BB_FEATURE_IFCONFIG_STATUS 236#ifdef CONFIG_FEATURE_IFCONFIG_STATUS
237extern int interface_opt_a; 237extern int interface_opt_a;
238extern int display_interfaces(char *ifname); 238extern int display_interfaces(char *ifname);
239#endif 239#endif
@@ -246,7 +246,7 @@ int ifconfig_main(int argc, char **argv)
246{ 246{
247 struct ifreq ifr; 247 struct ifreq ifr;
248 struct sockaddr_in sai; 248 struct sockaddr_in sai;
249#ifdef BB_FEATURE_IFCONFIG_HW 249#ifdef CONFIG_FEATURE_IFCONFIG_HW
250 struct sockaddr sa; 250 struct sockaddr sa;
251#endif 251#endif
252 const struct arg1opt *a1op; 252 const struct arg1opt *a1op;
@@ -266,7 +266,7 @@ int ifconfig_main(int argc, char **argv)
266 ++argv; 266 ++argv;
267 --argc; 267 --argc;
268 268
269#ifdef BB_FEATURE_IFCONFIG_STATUS 269#ifdef CONFIG_FEATURE_IFCONFIG_STATUS
270 if ((argc > 0) && (strcmp(*argv,"-a") == 0)) { 270 if ((argc > 0) && (strcmp(*argv,"-a") == 0)) {
271 interface_opt_a = 1; 271 interface_opt_a = 1;
272 --argc; 272 --argc;
@@ -275,7 +275,7 @@ int ifconfig_main(int argc, char **argv)
275#endif 275#endif
276 276
277 if(argc <= 1) { 277 if(argc <= 1) {
278#ifdef BB_FEATURE_IFCONFIG_STATUS 278#ifdef CONFIG_FEATURE_IFCONFIG_STATUS
279 return display_interfaces(argc ? *argv : NULL); 279 return display_interfaces(argc ? *argv : NULL);
280#else 280#else
281 error_msg_and_die( "ifconfig was not compiled with interface status display support."); 281 error_msg_and_die( "ifconfig was not compiled with interface status display support.");
@@ -333,7 +333,7 @@ int ifconfig_main(int argc, char **argv)
333 HOSTNAME: 333 HOSTNAME:
334 did_flags |= (mask & A_NETMASK); 334 did_flags |= (mask & A_NETMASK);
335 if (mask & A_CAST_HOST_COPY) { 335 if (mask & A_CAST_HOST_COPY) {
336#ifdef BB_FEATURE_IFCONFIG_HW 336#ifdef CONFIG_FEATURE_IFCONFIG_HW
337 if (mask & A_CAST_RESOLVE) { 337 if (mask & A_CAST_RESOLVE) {
338#endif 338#endif
339 safe_strncpy(host, *argv, (sizeof host)); 339 safe_strncpy(host, *argv, (sizeof host));
@@ -348,7 +348,7 @@ int ifconfig_main(int argc, char **argv)
348 continue; 348 continue;
349 } 349 }
350 p = (char *) &sai; 350 p = (char *) &sai;
351#ifdef BB_FEATURE_IFCONFIG_HW 351#ifdef CONFIG_FEATURE_IFCONFIG_HW
352 } else { /* A_CAST_HOST_COPY_IN_ETHER */ 352 } else { /* A_CAST_HOST_COPY_IN_ETHER */
353 /* This is the "hw" arg case. */ 353 /* This is the "hw" arg case. */
354 if (strcmp("ether", *argv) || (*++argv == NULL)) { 354 if (strcmp("ether", *argv) || (*++argv == NULL)) {
@@ -368,7 +368,7 @@ int ifconfig_main(int argc, char **argv)
368 } else { 368 } else {
369 unsigned int i = strtoul(*argv,NULL,0); 369 unsigned int i = strtoul(*argv,NULL,0);
370 p = ((char *)(&ifr)) + a1op->ifr_offset; 370 p = ((char *)(&ifr)) + a1op->ifr_offset;
371#ifdef BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ 371#ifdef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
372 if (mask & A_MAP_TYPE) { 372 if (mask & A_MAP_TYPE) {
373 if (ioctl(sockfd, SIOCGIFMAP, &ifr) < 0) { 373 if (ioctl(sockfd, SIOCGIFMAP, &ifr) < 0) {
374 ++goterr; 374 ++goterr;
@@ -446,7 +446,7 @@ int ifconfig_main(int argc, char **argv)
446 return goterr; 446 return goterr;
447} 447}
448 448
449#ifdef BB_FEATURE_IFCONFIG_HW 449#ifdef CONFIG_FEATURE_IFCONFIG_HW
450/* Input an Ethernet address and convert to binary. */ 450/* Input an Ethernet address and convert to binary. */
451static int 451static int
452in_ether(char *bufp, struct sockaddr *sap) 452in_ether(char *bufp, struct sockaddr *sap)
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 3e32ca9c0..a1a12d992 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -2,8 +2,8 @@
2/* 2/*
3 * Mini nslookup implementation for busybox 3 * Mini nslookup implementation for busybox
4 * 4 *
5 * Copyright (C) 1999,2000,2001 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc. and John Beppu
6 * Written by John Beppu <beppu@lineo.com> 6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -180,4 +180,4 @@ int nslookup_main(int argc, char **argv)
180 return EXIT_SUCCESS; 180 return EXIT_SUCCESS;
181} 181}
182 182
183/* $Id: nslookup.c,v 1.25 2001/10/01 17:50:25 kraai Exp $ */ 183/* $Id: nslookup.c,v 1.26 2001/10/24 04:59:56 andersen Exp $ */
diff --git a/networking/ping.c b/networking/ping.c
index 5ca5dd9e0..476c15cea 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.46 2001/07/17 01:12:36 andersen Exp $ 3 * $Id: ping.c,v 1.47 2001/10/24 04:59:56 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>
@@ -174,7 +174,7 @@ static int in_cksum(unsigned short *buf, int sz)
174} 174}
175 175
176/* simple version */ 176/* simple version */
177#ifndef BB_FEATURE_FANCY_PING 177#ifndef CONFIG_FEATURE_FANCY_PING
178static char *hostname = NULL; 178static char *hostname = NULL;
179 179
180static void noresp(int ign) 180static void noresp(int ign)
@@ -247,7 +247,7 @@ extern int ping_main(int argc, char **argv)
247 return EXIT_SUCCESS; 247 return EXIT_SUCCESS;
248} 248}
249 249
250#else /* ! BB_FEATURE_FANCY_PING */ 250#else /* ! CONFIG_FEATURE_FANCY_PING */
251/* full(er) version */ 251/* full(er) version */
252static char *hostname = NULL; 252static char *hostname = NULL;
253static struct sockaddr_in pingaddr; 253static struct sockaddr_in pingaddr;
@@ -516,7 +516,7 @@ extern int ping_main(int argc, char **argv)
516 ping(*argv); 516 ping(*argv);
517 return EXIT_SUCCESS; 517 return EXIT_SUCCESS;
518} 518}
519#endif /* ! BB_FEATURE_FANCY_PING */ 519#endif /* ! CONFIG_FEATURE_FANCY_PING */
520 520
521/* 521/*
522 * Copyright (c) 1989 The Regents of the University of California. 522 * Copyright (c) 1989 The Regents of the University of California.
diff --git a/networking/telnet.c b/networking/telnet.c
index ce82a0ee8..57494089d 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -137,7 +137,7 @@ static int local_bind(int port);
137/* Some globals */ 137/* Some globals */
138static int one = 1; 138static int one = 1;
139 139
140#ifdef BB_FEATURE_TELNET_TTYPE 140#ifdef CONFIG_FEATURE_TELNET_TTYPE
141static char *ttype; 141static char *ttype;
142#endif 142#endif
143 143
@@ -326,7 +326,7 @@ static void putiac1(byte c)
326} 326}
327#endif 327#endif
328 328
329#ifdef BB_FEATURE_TELNET_TTYPE 329#ifdef CONFIG_FEATURE_TELNET_TTYPE
330static void putiac_subopt(byte c, char *str) 330static void putiac_subopt(byte c, char *str)
331{ 331{
332 int len = strlen(str) + 6; // ( 2 + 1 + 1 + strlen + 2 ) 332 int len = strlen(str) + 6; // ( 2 + 1 + 1 + strlen + 2 )
@@ -453,7 +453,7 @@ static inline void to_sga()
453 return; 453 return;
454} 454}
455 455
456#ifdef BB_FEATURE_TELNET_TTYPE 456#ifdef CONFIG_FEATURE_TELNET_TTYPE
457static inline void to_ttype() 457static inline void to_ttype()
458{ 458{
459 /* Tell server we will (or won't) do TTYPE */ 459 /* Tell server we will (or won't) do TTYPE */
@@ -473,7 +473,7 @@ static void telopt(byte c)
473 { 473 {
474 case TELOPT_ECHO: to_echo(c); break; 474 case TELOPT_ECHO: to_echo(c); break;
475 case TELOPT_SGA: to_sga(c); break; 475 case TELOPT_SGA: to_sga(c); break;
476#ifdef BB_FEATURE_TELNET_TTYPE 476#ifdef CONFIG_FEATURE_TELNET_TTYPE
477 case TELOPT_TTYPE: to_ttype(c); break; 477 case TELOPT_TTYPE: to_ttype(c); break;
478#endif 478#endif
479 default: to_notsup(c); break; 479 default: to_notsup(c); break;
@@ -492,7 +492,7 @@ static int subneg(byte c)
492 case TS_SUB1: 492 case TS_SUB1:
493 if (c == IAC) 493 if (c == IAC)
494 G.telstate = TS_SUB2; 494 G.telstate = TS_SUB2;
495#ifdef BB_FEATURE_TELNET_TTYPE 495#ifdef CONFIG_FEATURE_TELNET_TTYPE
496 else 496 else
497 if (c == TELOPT_TTYPE) 497 if (c == TELOPT_TTYPE)
498 putiac_subopt(TELOPT_TTYPE,ttype); 498 putiac_subopt(TELOPT_TTYPE,ttype);
@@ -537,7 +537,7 @@ extern int telnet_main(int argc, char** argv)
537 int maxfd; 537 int maxfd;
538#endif 538#endif
539 539
540#ifdef BB_FEATURE_TELNET_TTYPE 540#ifdef CONFIG_FEATURE_TELNET_TTYPE
541 ttype = getenv("TERM"); 541 ttype = getenv("TERM");
542#endif 542#endif
543 543
diff --git a/networking/tftp.c b/networking/tftp.c
index 530b3d134..38a6f81f0 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -46,7 +46,7 @@
46 46
47#include "busybox.h" 47#include "busybox.h"
48 48
49//#define BB_FEATURE_TFTP_DEBUG 49//#define CONFIG_FEATURE_TFTP_DEBUG
50 50
51#define TFTP_BLOCKSIZE_DEFAULT 512 /* according to RFC 1350, don't change */ 51#define TFTP_BLOCKSIZE_DEFAULT 512 /* according to RFC 1350, don't change */
52#define TFTP_TIMEOUT 5 /* seconds */ 52#define TFTP_TIMEOUT 5 /* seconds */
@@ -74,7 +74,7 @@ static const char *tftp_error_msg[] = {
74const int tftp_cmd_get = 1; 74const int tftp_cmd_get = 1;
75const int tftp_cmd_put = 2; 75const int tftp_cmd_put = 2;
76 76
77#ifdef BB_FEATURE_TFTP_BLOCKSIZE 77#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
78 78
79static int tftp_blocksize_check(int blocksize, int bufsize) 79static int tftp_blocksize_check(int blocksize, int bufsize)
80{ 80{
@@ -158,11 +158,11 @@ static inline int tftp(const int cmd, const struct hostent *host,
158 int timeout = bb_tftp_num_retries; 158 int timeout = bb_tftp_num_retries;
159 int block_nr = 1; 159 int block_nr = 1;
160 160
161#ifdef BB_FEATURE_TFTP_BLOCKSIZE 161#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
162 int want_option_ack = 0; 162 int want_option_ack = 0;
163#endif 163#endif
164 164
165 RESERVE_BB_BUFFER(buf, tftp_bufsize + 4); /* Opcode + Block # + Data */ 165 RESERVE_CONFIG_BUFFER(buf, tftp_bufsize + 4); /* Opcode + Block # + Data */
166 166
167 tftp_bufsize += 4; 167 tftp_bufsize += 4;
168 168
@@ -230,7 +230,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
230 memcpy(cp, "octet", 6); 230 memcpy(cp, "octet", 6);
231 cp += 6; 231 cp += 6;
232 232
233#ifdef BB_FEATURE_TFTP_BLOCKSIZE 233#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
234 234
235 len = tftp_bufsize - 4; /* data block size */ 235 len = tftp_bufsize - 4; /* data block size */
236 236
@@ -290,7 +290,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
290 290
291 len = cp - buf; 291 len = cp - buf;
292 292
293#ifdef BB_FEATURE_TFTP_DEBUG 293#ifdef CONFIG_FEATURE_TFTP_DEBUG
294 printf("sending %u bytes\n", len); 294 printf("sending %u bytes\n", len);
295 for (cp = buf; cp < &buf[len]; cp++) 295 for (cp = buf; cp < &buf[len]; cp++)
296 printf("%02x ", *cp); 296 printf("%02x ", *cp);
@@ -367,7 +367,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
367 opcode = ntohs(*((unsigned short *) buf)); 367 opcode = ntohs(*((unsigned short *) buf));
368 tmp = ntohs(*((unsigned short *) &buf[2])); 368 tmp = ntohs(*((unsigned short *) &buf[2]));
369 369
370#ifdef BB_FEATURE_TFTP_DEBUG 370#ifdef CONFIG_FEATURE_TFTP_DEBUG
371 printf("received %d bytes: %04x %04x\n", len, opcode, tmp); 371 printf("received %d bytes: %04x %04x\n", len, opcode, tmp);
372#endif 372#endif
373 373
@@ -390,7 +390,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
390 break; 390 break;
391 } 391 }
392 392
393#ifdef BB_FEATURE_TFTP_BLOCKSIZE 393#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
394 if (want_option_ack) { 394 if (want_option_ack) {
395 395
396 want_option_ack = 0; 396 want_option_ack = 0;
@@ -416,7 +416,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
416 else { 416 else {
417 opcode = TFTP_ACK; 417 opcode = TFTP_ACK;
418 } 418 }
419#ifdef BB_FEATURE_TFTP_DEBUG 419#ifdef CONFIG_FEATURE_TFTP_DEBUG
420 printf("using blksize %u\n"); 420 printf("using blksize %u\n");
421#endif 421#endif
422 tftp_bufsize = foo + 4; 422 tftp_bufsize = foo + 4;
@@ -470,10 +470,10 @@ static inline int tftp(const int cmd, const struct hostent *host,
470 } 470 }
471 } 471 }
472 472
473#ifdef BB_FEATURE_CLEAN_UP 473#ifdef CONFIG_FEATURE_CLEAN_UP
474 close(socketfd); 474 close(socketfd);
475 475
476 RELEASE_BB_BUFFER(buf); 476 RELEASE_CONFIG_BUFFER(buf);
477#endif 477#endif
478 478
479 return finished ? EXIT_SUCCESS : EXIT_FAILURE; 479 return finished ? EXIT_SUCCESS : EXIT_FAILURE;
@@ -494,19 +494,19 @@ int tftp_main(int argc, char **argv)
494 494
495 /* figure out what to pass to getopt */ 495 /* figure out what to pass to getopt */
496 496
497#ifdef BB_FEATURE_TFTP_BLOCKSIZE 497#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
498#define BS "b:" 498#define BS "b:"
499#else 499#else
500#define BS 500#define BS
501#endif 501#endif
502 502
503#ifdef BB_FEATURE_TFTP_GET 503#ifdef CONFIG_FEATURE_TFTP_GET
504#define GET "g" 504#define GET "g"
505#else 505#else
506#define GET 506#define GET
507#endif 507#endif
508 508
509#ifdef BB_FEATURE_TFTP_PUT 509#ifdef CONFIG_FEATURE_TFTP_PUT
510#define PUT "p" 510#define PUT "p"
511#else 511#else
512#define PUT 512#define PUT
@@ -514,7 +514,7 @@ int tftp_main(int argc, char **argv)
514 514
515 while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) { 515 while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) {
516 switch (opt) { 516 switch (opt) {
517#ifdef BB_FEATURE_TFTP_BLOCKSIZE 517#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
518 case 'b': 518 case 'b':
519 blocksize = atoi(optarg); 519 blocksize = atoi(optarg);
520 if (!tftp_blocksize_check(blocksize, 0)) { 520 if (!tftp_blocksize_check(blocksize, 0)) {
@@ -522,13 +522,13 @@ int tftp_main(int argc, char **argv)
522 } 522 }
523 break; 523 break;
524#endif 524#endif
525#ifdef BB_FEATURE_TFTP_GET 525#ifdef CONFIG_FEATURE_TFTP_GET
526 case 'g': 526 case 'g':
527 cmd = tftp_cmd_get; 527 cmd = tftp_cmd_get;
528 flags = O_WRONLY | O_CREAT; 528 flags = O_WRONLY | O_CREAT;
529 break; 529 break;
530#endif 530#endif
531#ifdef BB_FEATURE_TFTP_PUT 531#ifdef CONFIG_FEATURE_TFTP_PUT
532 case 'p': 532 case 'p':
533 cmd = tftp_cmd_put; 533 cmd = tftp_cmd_put;
534 flags = O_RDONLY; 534 flags = O_RDONLY;
@@ -558,7 +558,7 @@ int tftp_main(int argc, char **argv)
558 port = atoi(argv[optind + 1]); 558 port = atoi(argv[optind + 1]);
559 } 559 }
560 560
561#ifdef BB_FEATURE_TFTP_DEBUG 561#ifdef CONFIG_FEATURE_TFTP_DEBUG
562 printf("using server \"%s\", remotefile \"%s\", " 562 printf("using server \"%s\", remotefile \"%s\", "
563 "localfile \"%s\".\n", 563 "localfile \"%s\".\n",
564 inet_ntoa(*((struct in_addr *) host->h_addr)), 564 inet_ntoa(*((struct in_addr *) host->h_addr)),
@@ -567,7 +567,7 @@ int tftp_main(int argc, char **argv)
567 567
568 result = tftp(cmd, host, remotefile, fd, port, blocksize); 568 result = tftp(cmd, host, remotefile, fd, port, blocksize);
569 569
570#ifdef BB_FEATURE_CLEAN_UP 570#ifdef CONFIG_FEATURE_CLEAN_UP
571 close(fd); 571 close(fd);
572#endif 572#endif
573 return(result); 573 return(result);
diff --git a/networking/traceroute.c b/networking/traceroute.c
index a3abd0a00..e7d9725af 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -62,9 +62,9 @@
62 * Tue Dec 20 03:50:13 PST 1988 62 * Tue Dec 20 03:50:13 PST 1988
63 */ 63 */
64 64
65#undef BB_FEATURE_TRACEROUTE_VERBOSE 65#undef CONFIG_FEATURE_TRACEROUTE_VERBOSE
66//#define BB_FEATURE_TRACEROUTE_VERBOSE 66//#define CONFIG_FEATURE_TRACEROUTE_VERBOSE
67#undef BB_FEATURE_TRACEROUTE_SO_DEBUG /* not in documentation man */ 67#undef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG /* not in documentation man */
68 68
69#include <stdio.h> 69#include <stdio.h>
70#include <errno.h> 70#include <errno.h>
@@ -213,7 +213,7 @@ static int max_ttl = 30;
213static u_short ident; 213static u_short ident;
214static u_short port = 32768+666; /* start udp dest port # for probe packets */ 214static u_short port = 32768+666; /* start udp dest port # for probe packets */
215 215
216#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 216#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
217static int verbose; 217static int verbose;
218#endif 218#endif
219static int waittime = 5; /* time to wait for response (in seconds) */ 219static int waittime = 5; /* time to wait for response (in seconds) */
@@ -269,7 +269,7 @@ print(u_char *buf, int cc, struct sockaddr_in *from)
269 cc -= hlen; 269 cc -= hlen;
270 270
271 inetname(from); 271 inetname(from);
272#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 272#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
273 if (verbose) 273 if (verbose)
274 printf (" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); 274 printf (" %d bytes to %s", cc, inet_ntoa (ip->ip_dst));
275#endif 275#endif
@@ -319,7 +319,7 @@ wait_for_reply(int sock, struct sockaddr_in *from, int reset_timer)
319 return(cc); 319 return(cc);
320} 320}
321 321
322#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 322#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
323/* 323/*
324 * Convert an ICMP "type" field to a printable string. 324 * Convert an ICMP "type" field to a printable string.
325 */ 325 */
@@ -353,7 +353,7 @@ packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq)
353 ip = (struct ip *) buf; 353 ip = (struct ip *) buf;
354 hlen = ip->ip_hl << 2; 354 hlen = ip->ip_hl << 2;
355 if (cc < hlen + ICMP_MINLEN) { 355 if (cc < hlen + ICMP_MINLEN) {
356#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 356#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
357 if (verbose) 357 if (verbose)
358 printf("packet too short (%d bytes) from %s\n", cc, 358 printf("packet too short (%d bytes) from %s\n", cc,
359 inet_ntoa(from->sin_addr)); 359 inet_ntoa(from->sin_addr));
@@ -376,7 +376,7 @@ packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq)
376 up->dest == htons(port+seq)) 376 up->dest == htons(port+seq))
377 return (type == ICMP_TIMXCEED? -1 : code+1); 377 return (type == ICMP_TIMXCEED? -1 : code+1);
378 } 378 }
379#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 379#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
380 if (verbose) { 380 if (verbose) {
381 int i; 381 int i;
382 u_long *lp = (u_long *)&icp->icmp_ip; 382 u_long *lp = (u_long *)&icp->icmp_ip;
@@ -430,7 +430,7 @@ send_probe(int seq, int ttl)
430 430
431 431
432int 432int
433#ifndef BB_TRACEROUTE 433#ifndef CONFIG_TRACEROUTE
434main(argc, argv) 434main(argc, argv)
435#else 435#else
436traceroute_main(argc, argv) 436traceroute_main(argc, argv)
@@ -454,7 +454,7 @@ traceroute_main(argc, argv)
454 while ((ch = getopt(argc, argv, "dm:np:q:rs:t:w:v")) != EOF) 454 while ((ch = getopt(argc, argv, "dm:np:q:rs:t:w:v")) != EOF)
455 switch(ch) { 455 switch(ch) {
456 case 'd': 456 case 'd':
457#ifdef BB_FEATURE_TRACEROUTE_SO_DEBUG 457#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
458 options |= SO_DEBUG; 458 options |= SO_DEBUG;
459#endif 459#endif
460 break; 460 break;
@@ -492,7 +492,7 @@ traceroute_main(argc, argv)
492 error_msg_and_die("tos must be 0 to 255."); 492 error_msg_and_die("tos must be 0 to 255.");
493 break; 493 break;
494 case 'v': 494 case 'v':
495#ifdef BB_FEATURE_TRACEROUTE_VERBOSE 495#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
496 verbose++; 496 verbose++;
497#endif 497#endif
498 break; 498 break;
@@ -537,7 +537,7 @@ traceroute_main(argc, argv)
537 537
538 s = create_icmp_socket(); 538 s = create_icmp_socket();
539 539
540#ifdef BB_FEATURE_TRACEROUTE_SO_DEBUG 540#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
541 if (options & SO_DEBUG) 541 if (options & SO_DEBUG)
542 (void) setsockopt(s, SOL_SOCKET, SO_DEBUG, 542 (void) setsockopt(s, SOL_SOCKET, SO_DEBUG,
543 (char *)&on, sizeof(on)); 543 (char *)&on, sizeof(on));
@@ -555,7 +555,7 @@ traceroute_main(argc, argv)
555 sizeof(on)) < 0) 555 sizeof(on)) < 0)
556 perror_msg_and_die("IP_HDRINCL"); 556 perror_msg_and_die("IP_HDRINCL");
557#endif IP_HDRINCL 557#endif IP_HDRINCL
558#ifdef BB_FEATURE_TRACEROUTE_SO_DEBUG 558#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
559 if (options & SO_DEBUG) 559 if (options & SO_DEBUG)
560 (void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG, 560 (void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG,
561 (char *)&on, sizeof(on)); 561 (char *)&on, sizeof(on));
diff --git a/networking/wget.c b/networking/wget.c
index 59373d1d9..41b4e30af 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -60,7 +60,7 @@ static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
60/* Globals (can be accessed from signal handlers */ 60/* Globals (can be accessed from signal handlers */
61static off_t filesize = 0; /* content-length of the file */ 61static off_t filesize = 0; /* content-length of the file */
62static int chunked = 0; /* chunked transfer encoding */ 62static int chunked = 0; /* chunked transfer encoding */
63#ifdef BB_FEATURE_WGET_STATUSBAR 63#ifdef CONFIG_FEATURE_WGET_STATUSBAR
64static void progressmeter(int flag); 64static void progressmeter(int flag);
65static char *curfile; /* Name of current file being transferred. */ 65static char *curfile; /* Name of current file being transferred. */
66static struct timeval start; /* Time a transfer started. */ 66static struct timeval start; /* Time a transfer started. */
@@ -126,7 +126,7 @@ static char *safe_fgets(char *s, int size, FILE *stream)
126 error_msg_and_die(s); } 126 error_msg_and_die(s); }
127 127
128 128
129#ifdef BB_FEATURE_WGET_AUTHENTICATION 129#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
130/* 130/*
131 * Base64-encode character string 131 * Base64-encode character string
132 * oops... isn't something similar in uuencode.c? 132 * oops... isn't something similar in uuencode.c?
@@ -245,20 +245,20 @@ int wget_main(int argc, char **argv)
245 /* Guess an output filename */ 245 /* Guess an output filename */
246 if (!fname_out) { 246 if (!fname_out) {
247 fname_out = 247 fname_out =
248#ifdef BB_FEATURE_WGET_STATUSBAR 248#ifdef CONFIG_FEATURE_WGET_STATUSBAR
249 curfile = 249 curfile =
250#endif 250#endif
251 get_last_path_component(target.path); 251 get_last_path_component(target.path);
252 if (fname_out==NULL || strlen(fname_out)<1) { 252 if (fname_out==NULL || strlen(fname_out)<1) {
253 fname_out = 253 fname_out =
254#ifdef BB_FEATURE_WGET_STATUSBAR 254#ifdef CONFIG_FEATURE_WGET_STATUSBAR
255 curfile = 255 curfile =
256#endif 256#endif
257 "index.html"; 257 "index.html";
258 } 258 }
259 if (dir_prefix != NULL) 259 if (dir_prefix != NULL)
260 fname_out = concat_path_file(dir_prefix, fname_out); 260 fname_out = concat_path_file(dir_prefix, fname_out);
261#ifdef BB_FEATURE_WGET_STATUSBAR 261#ifdef CONFIG_FEATURE_WGET_STATUSBAR
262 } else { 262 } else {
263 curfile = get_last_path_component(fname_out); 263 curfile = get_last_path_component(fname_out);
264#endif 264#endif
@@ -316,7 +316,7 @@ int wget_main(int argc, char **argv)
316 316
317 fprintf(sfp, "Host: %s\r\nUser-Agent: Wget\r\n", target.host); 317 fprintf(sfp, "Host: %s\r\nUser-Agent: Wget\r\n", target.host);
318 318
319#ifdef BB_FEATURE_WGET_AUTHENTICATION 319#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
320 if (target.user) { 320 if (target.user) {
321 fprintf(sfp, "Authorization: Basic %s\r\n", 321 fprintf(sfp, "Authorization: Basic %s\r\n",
322 base64enc(target.user, buf, sizeof(buf))); 322 base64enc(target.user, buf, sizeof(buf)));
@@ -475,14 +475,14 @@ read_response: if (fgets(buf, sizeof(buf), sfp) == NULL)
475 fgets(buf, sizeof(buf), dfp); 475 fgets(buf, sizeof(buf), dfp);
476 filesize = strtol(buf, (char **) NULL, 16); 476 filesize = strtol(buf, (char **) NULL, 16);
477 } 477 }
478#ifdef BB_FEATURE_WGET_STATUSBAR 478#ifdef CONFIG_FEATURE_WGET_STATUSBAR
479 if (quiet_flag==FALSE) 479 if (quiet_flag==FALSE)
480 progressmeter(-1); 480 progressmeter(-1);
481#endif 481#endif
482 do { 482 do {
483 while ((filesize > 0 || !got_clen) && (n = safe_fread(buf, 1, chunked ? (filesize > sizeof(buf) ? sizeof(buf) : filesize) : sizeof(buf), dfp)) > 0) { 483 while ((filesize > 0 || !got_clen) && (n = safe_fread(buf, 1, chunked ? (filesize > sizeof(buf) ? sizeof(buf) : filesize) : sizeof(buf), dfp)) > 0) {
484 safe_fwrite(buf, 1, n, output); 484 safe_fwrite(buf, 1, n, output);
485#ifdef BB_FEATURE_WGET_STATUSBAR 485#ifdef CONFIG_FEATURE_WGET_STATUSBAR
486 statbytes+=n; 486 statbytes+=n;
487#endif 487#endif
488 if (got_clen) 488 if (got_clen)
@@ -499,7 +499,7 @@ read_response: if (fgets(buf, sizeof(buf), sfp) == NULL)
499 if (n == 0 && ferror(dfp)) 499 if (n == 0 && ferror(dfp))
500 perror_msg_and_die("network read error"); 500 perror_msg_and_die("network read error");
501 } while (chunked); 501 } while (chunked);
502#ifdef BB_FEATURE_WGET_STATUSBAR 502#ifdef CONFIG_FEATURE_WGET_STATUSBAR
503 if (quiet_flag==FALSE) 503 if (quiet_flag==FALSE)
504 progressmeter(1); 504 progressmeter(1);
505#endif 505#endif
@@ -645,7 +645,7 @@ static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf)
645 return atoi(buf); 645 return atoi(buf);
646} 646}
647 647
648#ifdef BB_FEATURE_WGET_STATUSBAR 648#ifdef CONFIG_FEATURE_WGET_STATUSBAR
649/* Stuff below is from BSD rcp util.c, as added to openshh. 649/* Stuff below is from BSD rcp util.c, as added to openshh.
650 * Original copyright notice is retained at the end of this file. 650 * Original copyright notice is retained at the end of this file.
651 * 651 *
@@ -782,7 +782,7 @@ progressmeter(int flag)
782} 782}
783#endif 783#endif
784 784
785/* Original copyright notice which applies to the BB_FEATURE_WGET_STATUSBAR stuff, 785/* Original copyright notice which applies to the CONFIG_FEATURE_WGET_STATUSBAR stuff,
786 * much of which was blatently stolen from openssh. */ 786 * much of which was blatently stolen from openssh. */
787 787
788/*- 788/*-
@@ -817,7 +817,7 @@ progressmeter(int flag)
817 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 817 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
818 * SUCH DAMAGE. 818 * SUCH DAMAGE.
819 * 819 *
820 * $Id: wget.c,v 1.45 2001/07/19 22:28:01 andersen Exp $ 820 * $Id: wget.c,v 1.46 2001/10/24 04:59:56 andersen Exp $
821 */ 821 */
822 822
823 823