Major rework of the directory structure and the entire build system.
-Erik
This commit is contained in:
45
networking/Makefile
Normal file
45
networking/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
# Makefile for busybox
|
||||
#
|
||||
# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
TOPDIR :=..
|
||||
L_TARGET := networking.a
|
||||
|
||||
obj-y :=
|
||||
obj-n :=
|
||||
obj- :=
|
||||
|
||||
|
||||
obj-$(CONFIG_HOSTNAME) += hostname.o
|
||||
obj-$(CONFIG_IFCONFIG) += ifconfig.o
|
||||
obj-$(CONFIG_NC) += nc.o
|
||||
obj-$(CONFIG_NSLOOKUP) += nslookup.o
|
||||
obj-$(CONFIG_PING) += ping.o
|
||||
obj-$(CONFIG_ROUTE) += route.o
|
||||
obj-$(CONFIG_TELNET) += telnet.o
|
||||
obj-$(CONFIG_TFTP) += tftp.o
|
||||
obj-$(CONFIG_TRACEROUTE) += traceroute.o
|
||||
obj-$(CONFIG_WGET) += wget.o
|
||||
|
||||
|
||||
# Hand off to toplevel Rules.mak
|
||||
include $(TOPDIR)/Rules.mak
|
||||
|
||||
clean:
|
||||
rm -f $(L_TARGET) *.o core
|
||||
|
||||
21
networking/config.in
Normal file
21
networking/config.in
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see scripts/kbuild/config-language.txt.
|
||||
#
|
||||
|
||||
mainmenu_option next_comment
|
||||
comment 'Networking Utilities'
|
||||
|
||||
bool 'hostname' CONFIG_HOSTNAME
|
||||
bool 'ifconfig' CONFIG_IFCONFIG
|
||||
bool 'nc' CONFIG_NC
|
||||
bool 'nslookup' CONFIG_NSLOOKUP
|
||||
bool 'ping' CONFIG_PING
|
||||
bool 'route' CONFIG_ROUTE
|
||||
bool 'telnet' CONFIG_TELNET
|
||||
bool 'tftp' CONFIG_TFTP
|
||||
bool 'traceroute' CONFIG_TRACEROUTE
|
||||
bool 'wget' CONFIG_WGET
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* $Id: hostname.c,v 1.30 2001/06/26 02:06:08 bug1 Exp $
|
||||
* $Id: hostname.c,v 1.31 2001/10/24 04:59:56 andersen Exp $
|
||||
* Mini hostname implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||
@@ -49,7 +49,7 @@ static void do_sethostname(char *s, int isfile)
|
||||
} else {
|
||||
f = xfopen(s, "r");
|
||||
fgets(buf, 255, f);
|
||||
#ifdef BB_FEATURE_CLEAN_UP
|
||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||
fclose(f);
|
||||
#endif
|
||||
chomp(buf);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* $Id: ifconfig.c,v 1.12 2001/08/10 06:02:23 mjn3 Exp $
|
||||
* $Id: ifconfig.c,v 1.13 2001/10/24 04:59:56 andersen Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <linux/if_ether.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#ifdef BB_FEATURE_IFCONFIG_SLIP
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_SLIP
|
||||
#include <linux/if_slip.h>
|
||||
#endif
|
||||
|
||||
@@ -173,7 +173,7 @@ static const struct arg1opt Arg1Opt[] = {
|
||||
{"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)},
|
||||
{"SIOCSIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask)},
|
||||
{"SIOCSIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr)},
|
||||
#ifdef BB_FEATURE_IFCONFIG_HW
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_HW
|
||||
{"SIOCSIFHWADDR", SIOCSIFHWADDR, ifreq_offsetof(ifr_hwaddr)},
|
||||
#endif
|
||||
{"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)},
|
||||
@@ -183,7 +183,7 @@ static const struct arg1opt Arg1Opt[] = {
|
||||
#ifdef SIOCSOUTFILL
|
||||
{"SIOCSOUTFILL", SIOCSOUTFILL, ifreq_offsetof(ifr_data)},
|
||||
#endif
|
||||
#ifdef BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
|
||||
{"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.mem_start)},
|
||||
{"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.base_addr)},
|
||||
{"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.irq)},
|
||||
@@ -199,7 +199,7 @@ static const struct options OptArray[] = {
|
||||
{"dstaddr", N_ARG, ARG_DSTADDR, 0},
|
||||
{"netmask", N_ARG, ARG_NETMASK, 0},
|
||||
{"broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST},
|
||||
#ifdef BB_FEATURE_IFCONFIG_HW
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_HW
|
||||
{"hw", N_ARG, ARG_HW, 0},
|
||||
#endif
|
||||
{"pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT},
|
||||
@@ -209,7 +209,7 @@ static const struct options OptArray[] = {
|
||||
#ifdef SIOCSOUTFILL
|
||||
{"outfill", N_ARG, ARG_OUTFILL, 0},
|
||||
#endif
|
||||
#ifdef BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
|
||||
{"mem_start", N_ARG, ARG_MEM_START, 0},
|
||||
{"io_addr", N_ARG, ARG_IO_ADDR, 0},
|
||||
{"irq", N_ARG, ARG_IRQ, 0},
|
||||
@@ -229,11 +229,11 @@ static const struct options OptArray[] = {
|
||||
* A couple of prototypes.
|
||||
*/
|
||||
|
||||
#ifdef BB_FEATURE_IFCONFIG_HW
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_HW
|
||||
static int in_ether(char *bufp, struct sockaddr *sap);
|
||||
#endif
|
||||
|
||||
#ifdef BB_FEATURE_IFCONFIG_STATUS
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_STATUS
|
||||
extern int interface_opt_a;
|
||||
extern int display_interfaces(char *ifname);
|
||||
#endif
|
||||
@@ -246,7 +246,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
struct sockaddr_in sai;
|
||||
#ifdef BB_FEATURE_IFCONFIG_HW
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_HW
|
||||
struct sockaddr sa;
|
||||
#endif
|
||||
const struct arg1opt *a1op;
|
||||
@@ -266,7 +266,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
++argv;
|
||||
--argc;
|
||||
|
||||
#ifdef BB_FEATURE_IFCONFIG_STATUS
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_STATUS
|
||||
if ((argc > 0) && (strcmp(*argv,"-a") == 0)) {
|
||||
interface_opt_a = 1;
|
||||
--argc;
|
||||
@@ -275,7 +275,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
if(argc <= 1) {
|
||||
#ifdef BB_FEATURE_IFCONFIG_STATUS
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_STATUS
|
||||
return display_interfaces(argc ? *argv : NULL);
|
||||
#else
|
||||
error_msg_and_die( "ifconfig was not compiled with interface status display support.");
|
||||
@@ -333,7 +333,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
HOSTNAME:
|
||||
did_flags |= (mask & A_NETMASK);
|
||||
if (mask & A_CAST_HOST_COPY) {
|
||||
#ifdef BB_FEATURE_IFCONFIG_HW
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_HW
|
||||
if (mask & A_CAST_RESOLVE) {
|
||||
#endif
|
||||
safe_strncpy(host, *argv, (sizeof host));
|
||||
@@ -348,7 +348,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
continue;
|
||||
}
|
||||
p = (char *) &sai;
|
||||
#ifdef BB_FEATURE_IFCONFIG_HW
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_HW
|
||||
} else { /* A_CAST_HOST_COPY_IN_ETHER */
|
||||
/* This is the "hw" arg case. */
|
||||
if (strcmp("ether", *argv) || (*++argv == NULL)) {
|
||||
@@ -368,7 +368,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
} else {
|
||||
unsigned int i = strtoul(*argv,NULL,0);
|
||||
p = ((char *)(&ifr)) + a1op->ifr_offset;
|
||||
#ifdef BB_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
|
||||
if (mask & A_MAP_TYPE) {
|
||||
if (ioctl(sockfd, SIOCGIFMAP, &ifr) < 0) {
|
||||
++goterr;
|
||||
@@ -446,7 +446,7 @@ int ifconfig_main(int argc, char **argv)
|
||||
return goterr;
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_IFCONFIG_HW
|
||||
#ifdef CONFIG_FEATURE_IFCONFIG_HW
|
||||
/* Input an Ethernet address and convert to binary. */
|
||||
static int
|
||||
in_ether(char *bufp, struct sockaddr *sap)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/*
|
||||
* Mini nslookup implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by John Beppu <beppu@lineo.com>
|
||||
* Copyright (C) 1999,2000 by Lineo, inc. and John Beppu
|
||||
* Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
|
||||
*
|
||||
* 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
|
||||
@@ -180,4 +180,4 @@ int nslookup_main(int argc, char **argv)
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* $Id: nslookup.c,v 1.25 2001/10/01 17:50:25 kraai Exp $ */
|
||||
/* $Id: nslookup.c,v 1.26 2001/10/24 04:59:56 andersen Exp $ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* $Id: ping.c,v 1.46 2001/07/17 01:12:36 andersen Exp $
|
||||
* $Id: ping.c,v 1.47 2001/10/24 04:59:56 andersen Exp $
|
||||
* Mini ping implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||
@@ -174,7 +174,7 @@ static int in_cksum(unsigned short *buf, int sz)
|
||||
}
|
||||
|
||||
/* simple version */
|
||||
#ifndef BB_FEATURE_FANCY_PING
|
||||
#ifndef CONFIG_FEATURE_FANCY_PING
|
||||
static char *hostname = NULL;
|
||||
|
||||
static void noresp(int ign)
|
||||
@@ -247,7 +247,7 @@ extern int ping_main(int argc, char **argv)
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#else /* ! BB_FEATURE_FANCY_PING */
|
||||
#else /* ! CONFIG_FEATURE_FANCY_PING */
|
||||
/* full(er) version */
|
||||
static char *hostname = NULL;
|
||||
static struct sockaddr_in pingaddr;
|
||||
@@ -516,7 +516,7 @@ extern int ping_main(int argc, char **argv)
|
||||
ping(*argv);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif /* ! BB_FEATURE_FANCY_PING */
|
||||
#endif /* ! CONFIG_FEATURE_FANCY_PING */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
||||
@@ -137,7 +137,7 @@ static int local_bind(int port);
|
||||
/* Some globals */
|
||||
static int one = 1;
|
||||
|
||||
#ifdef BB_FEATURE_TELNET_TTYPE
|
||||
#ifdef CONFIG_FEATURE_TELNET_TTYPE
|
||||
static char *ttype;
|
||||
#endif
|
||||
|
||||
@@ -326,7 +326,7 @@ static void putiac1(byte c)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BB_FEATURE_TELNET_TTYPE
|
||||
#ifdef CONFIG_FEATURE_TELNET_TTYPE
|
||||
static void putiac_subopt(byte c, char *str)
|
||||
{
|
||||
int len = strlen(str) + 6; // ( 2 + 1 + 1 + strlen + 2 )
|
||||
@@ -453,7 +453,7 @@ static inline void to_sga()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_TELNET_TTYPE
|
||||
#ifdef CONFIG_FEATURE_TELNET_TTYPE
|
||||
static inline void to_ttype()
|
||||
{
|
||||
/* Tell server we will (or won't) do TTYPE */
|
||||
@@ -473,7 +473,7 @@ static void telopt(byte c)
|
||||
{
|
||||
case TELOPT_ECHO: to_echo(c); break;
|
||||
case TELOPT_SGA: to_sga(c); break;
|
||||
#ifdef BB_FEATURE_TELNET_TTYPE
|
||||
#ifdef CONFIG_FEATURE_TELNET_TTYPE
|
||||
case TELOPT_TTYPE: to_ttype(c); break;
|
||||
#endif
|
||||
default: to_notsup(c); break;
|
||||
@@ -492,7 +492,7 @@ static int subneg(byte c)
|
||||
case TS_SUB1:
|
||||
if (c == IAC)
|
||||
G.telstate = TS_SUB2;
|
||||
#ifdef BB_FEATURE_TELNET_TTYPE
|
||||
#ifdef CONFIG_FEATURE_TELNET_TTYPE
|
||||
else
|
||||
if (c == TELOPT_TTYPE)
|
||||
putiac_subopt(TELOPT_TTYPE,ttype);
|
||||
@@ -537,7 +537,7 @@ extern int telnet_main(int argc, char** argv)
|
||||
int maxfd;
|
||||
#endif
|
||||
|
||||
#ifdef BB_FEATURE_TELNET_TTYPE
|
||||
#ifdef CONFIG_FEATURE_TELNET_TTYPE
|
||||
ttype = getenv("TERM");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
#include "busybox.h"
|
||||
|
||||
//#define BB_FEATURE_TFTP_DEBUG
|
||||
//#define CONFIG_FEATURE_TFTP_DEBUG
|
||||
|
||||
#define TFTP_BLOCKSIZE_DEFAULT 512 /* according to RFC 1350, don't change */
|
||||
#define TFTP_TIMEOUT 5 /* seconds */
|
||||
@@ -74,7 +74,7 @@ static const char *tftp_error_msg[] = {
|
||||
const int tftp_cmd_get = 1;
|
||||
const int tftp_cmd_put = 2;
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_BLOCKSIZE
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
|
||||
static int tftp_blocksize_check(int blocksize, int bufsize)
|
||||
{
|
||||
@@ -158,11 +158,11 @@ static inline int tftp(const int cmd, const struct hostent *host,
|
||||
int timeout = bb_tftp_num_retries;
|
||||
int block_nr = 1;
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_BLOCKSIZE
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
int want_option_ack = 0;
|
||||
#endif
|
||||
|
||||
RESERVE_BB_BUFFER(buf, tftp_bufsize + 4); /* Opcode + Block # + Data */
|
||||
RESERVE_CONFIG_BUFFER(buf, tftp_bufsize + 4); /* Opcode + Block # + Data */
|
||||
|
||||
tftp_bufsize += 4;
|
||||
|
||||
@@ -230,7 +230,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
|
||||
memcpy(cp, "octet", 6);
|
||||
cp += 6;
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_BLOCKSIZE
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
|
||||
len = tftp_bufsize - 4; /* data block size */
|
||||
|
||||
@@ -290,7 +290,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
|
||||
|
||||
len = cp - buf;
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_DEBUG
|
||||
#ifdef CONFIG_FEATURE_TFTP_DEBUG
|
||||
printf("sending %u bytes\n", len);
|
||||
for (cp = buf; cp < &buf[len]; cp++)
|
||||
printf("%02x ", *cp);
|
||||
@@ -367,7 +367,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
|
||||
opcode = ntohs(*((unsigned short *) buf));
|
||||
tmp = ntohs(*((unsigned short *) &buf[2]));
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_DEBUG
|
||||
#ifdef CONFIG_FEATURE_TFTP_DEBUG
|
||||
printf("received %d bytes: %04x %04x\n", len, opcode, tmp);
|
||||
#endif
|
||||
|
||||
@@ -390,7 +390,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_BLOCKSIZE
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
if (want_option_ack) {
|
||||
|
||||
want_option_ack = 0;
|
||||
@@ -416,7 +416,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
|
||||
else {
|
||||
opcode = TFTP_ACK;
|
||||
}
|
||||
#ifdef BB_FEATURE_TFTP_DEBUG
|
||||
#ifdef CONFIG_FEATURE_TFTP_DEBUG
|
||||
printf("using blksize %u\n");
|
||||
#endif
|
||||
tftp_bufsize = foo + 4;
|
||||
@@ -470,10 +470,10 @@ static inline int tftp(const int cmd, const struct hostent *host,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_CLEAN_UP
|
||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||
close(socketfd);
|
||||
|
||||
RELEASE_BB_BUFFER(buf);
|
||||
RELEASE_CONFIG_BUFFER(buf);
|
||||
#endif
|
||||
|
||||
return finished ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
@@ -494,19 +494,19 @@ int tftp_main(int argc, char **argv)
|
||||
|
||||
/* figure out what to pass to getopt */
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_BLOCKSIZE
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
#define BS "b:"
|
||||
#else
|
||||
#define BS
|
||||
#endif
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_GET
|
||||
#ifdef CONFIG_FEATURE_TFTP_GET
|
||||
#define GET "g"
|
||||
#else
|
||||
#define GET
|
||||
#endif
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_PUT
|
||||
#ifdef CONFIG_FEATURE_TFTP_PUT
|
||||
#define PUT "p"
|
||||
#else
|
||||
#define PUT
|
||||
@@ -514,7 +514,7 @@ int tftp_main(int argc, char **argv)
|
||||
|
||||
while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) {
|
||||
switch (opt) {
|
||||
#ifdef BB_FEATURE_TFTP_BLOCKSIZE
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
case 'b':
|
||||
blocksize = atoi(optarg);
|
||||
if (!tftp_blocksize_check(blocksize, 0)) {
|
||||
@@ -522,13 +522,13 @@ int tftp_main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef BB_FEATURE_TFTP_GET
|
||||
#ifdef CONFIG_FEATURE_TFTP_GET
|
||||
case 'g':
|
||||
cmd = tftp_cmd_get;
|
||||
flags = O_WRONLY | O_CREAT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef BB_FEATURE_TFTP_PUT
|
||||
#ifdef CONFIG_FEATURE_TFTP_PUT
|
||||
case 'p':
|
||||
cmd = tftp_cmd_put;
|
||||
flags = O_RDONLY;
|
||||
@@ -558,7 +558,7 @@ int tftp_main(int argc, char **argv)
|
||||
port = atoi(argv[optind + 1]);
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_TFTP_DEBUG
|
||||
#ifdef CONFIG_FEATURE_TFTP_DEBUG
|
||||
printf("using server \"%s\", remotefile \"%s\", "
|
||||
"localfile \"%s\".\n",
|
||||
inet_ntoa(*((struct in_addr *) host->h_addr)),
|
||||
@@ -567,7 +567,7 @@ int tftp_main(int argc, char **argv)
|
||||
|
||||
result = tftp(cmd, host, remotefile, fd, port, blocksize);
|
||||
|
||||
#ifdef BB_FEATURE_CLEAN_UP
|
||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||
close(fd);
|
||||
#endif
|
||||
return(result);
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
* Tue Dec 20 03:50:13 PST 1988
|
||||
*/
|
||||
|
||||
#undef BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
//#define BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
#undef BB_FEATURE_TRACEROUTE_SO_DEBUG /* not in documentation man */
|
||||
#undef CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
//#define CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
#undef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG /* not in documentation man */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@@ -213,7 +213,7 @@ static int max_ttl = 30;
|
||||
static u_short ident;
|
||||
static u_short port = 32768+666; /* start udp dest port # for probe packets */
|
||||
|
||||
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
static int verbose;
|
||||
#endif
|
||||
static int waittime = 5; /* time to wait for response (in seconds) */
|
||||
@@ -269,7 +269,7 @@ print(u_char *buf, int cc, struct sockaddr_in *from)
|
||||
cc -= hlen;
|
||||
|
||||
inetname(from);
|
||||
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
if (verbose)
|
||||
printf (" %d bytes to %s", cc, inet_ntoa (ip->ip_dst));
|
||||
#endif
|
||||
@@ -319,7 +319,7 @@ wait_for_reply(int sock, struct sockaddr_in *from, int reset_timer)
|
||||
return(cc);
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
/*
|
||||
* Convert an ICMP "type" field to a printable string.
|
||||
*/
|
||||
@@ -353,7 +353,7 @@ packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq)
|
||||
ip = (struct ip *) buf;
|
||||
hlen = ip->ip_hl << 2;
|
||||
if (cc < hlen + ICMP_MINLEN) {
|
||||
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
if (verbose)
|
||||
printf("packet too short (%d bytes) from %s\n", cc,
|
||||
inet_ntoa(from->sin_addr));
|
||||
@@ -376,7 +376,7 @@ packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq)
|
||||
up->dest == htons(port+seq))
|
||||
return (type == ICMP_TIMXCEED? -1 : code+1);
|
||||
}
|
||||
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
if (verbose) {
|
||||
int i;
|
||||
u_long *lp = (u_long *)&icp->icmp_ip;
|
||||
@@ -430,7 +430,7 @@ send_probe(int seq, int ttl)
|
||||
|
||||
|
||||
int
|
||||
#ifndef BB_TRACEROUTE
|
||||
#ifndef CONFIG_TRACEROUTE
|
||||
main(argc, argv)
|
||||
#else
|
||||
traceroute_main(argc, argv)
|
||||
@@ -454,7 +454,7 @@ traceroute_main(argc, argv)
|
||||
while ((ch = getopt(argc, argv, "dm:np:q:rs:t:w:v")) != EOF)
|
||||
switch(ch) {
|
||||
case 'd':
|
||||
#ifdef BB_FEATURE_TRACEROUTE_SO_DEBUG
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
|
||||
options |= SO_DEBUG;
|
||||
#endif
|
||||
break;
|
||||
@@ -492,7 +492,7 @@ traceroute_main(argc, argv)
|
||||
error_msg_and_die("tos must be 0 to 255.");
|
||||
break;
|
||||
case 'v':
|
||||
#ifdef BB_FEATURE_TRACEROUTE_VERBOSE
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_VERBOSE
|
||||
verbose++;
|
||||
#endif
|
||||
break;
|
||||
@@ -537,7 +537,7 @@ traceroute_main(argc, argv)
|
||||
|
||||
s = create_icmp_socket();
|
||||
|
||||
#ifdef BB_FEATURE_TRACEROUTE_SO_DEBUG
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
|
||||
if (options & SO_DEBUG)
|
||||
(void) setsockopt(s, SOL_SOCKET, SO_DEBUG,
|
||||
(char *)&on, sizeof(on));
|
||||
@@ -555,7 +555,7 @@ traceroute_main(argc, argv)
|
||||
sizeof(on)) < 0)
|
||||
perror_msg_and_die("IP_HDRINCL");
|
||||
#endif IP_HDRINCL
|
||||
#ifdef BB_FEATURE_TRACEROUTE_SO_DEBUG
|
||||
#ifdef CONFIG_FEATURE_TRACEROUTE_SO_DEBUG
|
||||
if (options & SO_DEBUG)
|
||||
(void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG,
|
||||
(char *)&on, sizeof(on));
|
||||
|
||||
@@ -60,7 +60,7 @@ static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
|
||||
/* Globals (can be accessed from signal handlers */
|
||||
static off_t filesize = 0; /* content-length of the file */
|
||||
static int chunked = 0; /* chunked transfer encoding */
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
static void progressmeter(int flag);
|
||||
static char *curfile; /* Name of current file being transferred. */
|
||||
static struct timeval start; /* Time a transfer started. */
|
||||
@@ -126,7 +126,7 @@ static char *safe_fgets(char *s, int size, FILE *stream)
|
||||
error_msg_and_die(s); }
|
||||
|
||||
|
||||
#ifdef BB_FEATURE_WGET_AUTHENTICATION
|
||||
#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
|
||||
/*
|
||||
* Base64-encode character string
|
||||
* oops... isn't something similar in uuencode.c?
|
||||
@@ -245,20 +245,20 @@ int wget_main(int argc, char **argv)
|
||||
/* Guess an output filename */
|
||||
if (!fname_out) {
|
||||
fname_out =
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
curfile =
|
||||
#endif
|
||||
get_last_path_component(target.path);
|
||||
if (fname_out==NULL || strlen(fname_out)<1) {
|
||||
fname_out =
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
curfile =
|
||||
#endif
|
||||
"index.html";
|
||||
}
|
||||
if (dir_prefix != NULL)
|
||||
fname_out = concat_path_file(dir_prefix, fname_out);
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
} else {
|
||||
curfile = get_last_path_component(fname_out);
|
||||
#endif
|
||||
@@ -316,7 +316,7 @@ int wget_main(int argc, char **argv)
|
||||
|
||||
fprintf(sfp, "Host: %s\r\nUser-Agent: Wget\r\n", target.host);
|
||||
|
||||
#ifdef BB_FEATURE_WGET_AUTHENTICATION
|
||||
#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
|
||||
if (target.user) {
|
||||
fprintf(sfp, "Authorization: Basic %s\r\n",
|
||||
base64enc(target.user, buf, sizeof(buf)));
|
||||
@@ -475,14 +475,14 @@ read_response: if (fgets(buf, sizeof(buf), sfp) == NULL)
|
||||
fgets(buf, sizeof(buf), dfp);
|
||||
filesize = strtol(buf, (char **) NULL, 16);
|
||||
}
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
if (quiet_flag==FALSE)
|
||||
progressmeter(-1);
|
||||
#endif
|
||||
do {
|
||||
while ((filesize > 0 || !got_clen) && (n = safe_fread(buf, 1, chunked ? (filesize > sizeof(buf) ? sizeof(buf) : filesize) : sizeof(buf), dfp)) > 0) {
|
||||
safe_fwrite(buf, 1, n, output);
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
statbytes+=n;
|
||||
#endif
|
||||
if (got_clen)
|
||||
@@ -499,7 +499,7 @@ read_response: if (fgets(buf, sizeof(buf), sfp) == NULL)
|
||||
if (n == 0 && ferror(dfp))
|
||||
perror_msg_and_die("network read error");
|
||||
} while (chunked);
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
if (quiet_flag==FALSE)
|
||||
progressmeter(1);
|
||||
#endif
|
||||
@@ -645,7 +645,7 @@ static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf)
|
||||
return atoi(buf);
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
|
||||
/* Stuff below is from BSD rcp util.c, as added to openshh.
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*
|
||||
@@ -782,7 +782,7 @@ progressmeter(int flag)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Original copyright notice which applies to the BB_FEATURE_WGET_STATUSBAR stuff,
|
||||
/* Original copyright notice which applies to the CONFIG_FEATURE_WGET_STATUSBAR stuff,
|
||||
* much of which was blatently stolen from openssh. */
|
||||
|
||||
/*-
|
||||
@@ -817,7 +817,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.45 2001/07/19 22:28:01 andersen Exp $
|
||||
* $Id: wget.c,v 1.46 2001/10/24 04:59:56 andersen Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user