httpd: slight reduction of #ifdef forest
few other applets: #ifdef CONFIG_ -> #if ENABLE_ traceroute: fix exposed bugs defconfig: update
This commit is contained in:
@ -60,7 +60,7 @@ static const char *const tftp_bb_error_msg[] = {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
#if ENABLE_FEATURE_TFTP_BLOCKSIZE
|
||||
|
||||
static int tftp_blocksize_check(int blocksize, int bufsize)
|
||||
{
|
||||
@ -204,7 +204,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
||||
memcpy(cp, MODE_OCTET, MODE_OCTET_LEN);
|
||||
cp += MODE_OCTET_LEN;
|
||||
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
#if ENABLE_FEATURE_TFTP_BLOCKSIZE
|
||||
|
||||
len = tftp_bufsize - 4; /* data block size */
|
||||
|
||||
@ -261,7 +261,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
||||
|
||||
len = cp - buf;
|
||||
|
||||
#ifdef CONFIG_DEBUG_TFTP
|
||||
#if ENABLE_DEBUG_TFTP
|
||||
fprintf(stderr, "sending %u bytes\n", len);
|
||||
for (cp = buf; cp < &buf[len]; cp++)
|
||||
fprintf(stderr, "%02x ", (unsigned char) *cp);
|
||||
@ -337,7 +337,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
||||
opcode = ntohs(*((unsigned short *) buf));
|
||||
tmp = ntohs(*((unsigned short *) &buf[2]));
|
||||
|
||||
#ifdef CONFIG_DEBUG_TFTP
|
||||
#if ENABLE_DEBUG_TFTP
|
||||
fprintf(stderr, "received %d bytes: %04x %04x\n", len, opcode, tmp);
|
||||
#endif
|
||||
|
||||
@ -359,7 +359,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
||||
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
#if ENABLE_FEATURE_TFTP_BLOCKSIZE
|
||||
if (want_option_ack) {
|
||||
|
||||
want_option_ack = 0;
|
||||
@ -382,7 +382,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
||||
} else {
|
||||
opcode = TFTP_ACK;
|
||||
}
|
||||
#ifdef CONFIG_DEBUG_TFTP
|
||||
#if ENABLE_DEBUG_TFTP
|
||||
fprintf(stderr, "using %s %u\n", OPTION_BLOCKSIZE,
|
||||
blksize);
|
||||
#endif
|
||||
@ -448,7 +448,7 @@ static int tftp(const int cmd, const struct hostent *host,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||
#if ENABLE_FEATURE_CLEAN_UP
|
||||
close(socketfd);
|
||||
free(buf);
|
||||
#endif
|
||||
@ -470,7 +470,7 @@ int tftp_main(int argc, char **argv)
|
||||
|
||||
/* figure out what to pass to getopt */
|
||||
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
#if ENABLE_FEATURE_TFTP_BLOCKSIZE
|
||||
char *sblocksize = NULL;
|
||||
|
||||
#define BS "b:"
|
||||
@ -480,7 +480,7 @@ int tftp_main(int argc, char **argv)
|
||||
#define BS_ARG
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_TFTP_GET
|
||||
#if ENABLE_FEATURE_TFTP_GET
|
||||
#define GET "g"
|
||||
#define GET_COMPL ":g"
|
||||
#else
|
||||
@ -488,7 +488,7 @@ int tftp_main(int argc, char **argv)
|
||||
#define GET_COMPL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_TFTP_PUT
|
||||
#if ENABLE_FEATURE_TFTP_PUT
|
||||
#define PUT "p"
|
||||
#define PUT_COMPL ":p"
|
||||
#else
|
||||
@ -505,16 +505,16 @@ int tftp_main(int argc, char **argv)
|
||||
cmd = getopt32(argc, argv, GET PUT "l:r:" BS, &localfile, &remotefile BS_ARG);
|
||||
|
||||
cmd &= (tftp_cmd_get | tftp_cmd_put);
|
||||
#ifdef CONFIG_FEATURE_TFTP_GET
|
||||
#if ENABLE_FEATURE_TFTP_GET
|
||||
if (cmd == tftp_cmd_get)
|
||||
flags = O_WRONLY | O_CREAT | O_TRUNC;
|
||||
#endif
|
||||
#ifdef CONFIG_FEATURE_TFTP_PUT
|
||||
#if ENABLE_FEATURE_TFTP_PUT
|
||||
if (cmd == tftp_cmd_put)
|
||||
flags = O_RDONLY;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
|
||||
#if ENABLE_FEATURE_TFTP_BLOCKSIZE
|
||||
if (sblocksize) {
|
||||
blocksize = xatoi_u(sblocksize);
|
||||
if (!tftp_blocksize_check(blocksize, 0)) {
|
||||
@ -542,7 +542,7 @@ int tftp_main(int argc, char **argv)
|
||||
host = xgethostbyname(argv[optind]);
|
||||
port = bb_lookup_port(argv[optind + 1], "udp", 69);
|
||||
|
||||
#ifdef CONFIG_DEBUG_TFTP
|
||||
#if ENABLE_DEBUG_TFTP
|
||||
fprintf(stderr, "using server \"%s\", remotefile \"%s\", "
|
||||
"localfile \"%s\".\n",
|
||||
inet_ntoa(*((struct in_addr *) host->h_addr)),
|
||||
|
Reference in New Issue
Block a user