aboutsummaryrefslogtreecommitdiff
path: root/networking/tftp.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-21 10:15:25 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-21 10:15:25 +0000
commit04291bc5aee1e020997894cfd497d14392ad2ced (patch)
treef9f70d597f2476efe5819b15e8d749725653773f /networking/tftp.c
parent3eb91c2e3594f379f357bfcc85105b6b76a11781 (diff)
downloadbusybox-w32-04291bc5aee1e020997894cfd497d14392ad2ced.tar.gz
busybox-w32-04291bc5aee1e020997894cfd497d14392ad2ced.tar.bz2
busybox-w32-04291bc5aee1e020997894cfd497d14392ad2ced.zip
httpd: slight reduction of #ifdef forest
few other applets: #ifdef CONFIG_ -> #if ENABLE_ traceroute: fix exposed bugs defconfig: update
Diffstat (limited to 'networking/tftp.c')
-rw-r--r--networking/tftp.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index 6213d6622..64d376fa7 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -60,7 +60,7 @@ static const char *const tftp_bb_error_msg[] = {
60#endif 60#endif
61 61
62 62
63#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE 63#if ENABLE_FEATURE_TFTP_BLOCKSIZE
64 64
65static int tftp_blocksize_check(int blocksize, int bufsize) 65static int tftp_blocksize_check(int blocksize, int bufsize)
66{ 66{
@@ -204,7 +204,7 @@ static int tftp(const int cmd, const struct hostent *host,
204 memcpy(cp, MODE_OCTET, MODE_OCTET_LEN); 204 memcpy(cp, MODE_OCTET, MODE_OCTET_LEN);
205 cp += MODE_OCTET_LEN; 205 cp += MODE_OCTET_LEN;
206 206
207#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE 207#if ENABLE_FEATURE_TFTP_BLOCKSIZE
208 208
209 len = tftp_bufsize - 4; /* data block size */ 209 len = tftp_bufsize - 4; /* data block size */
210 210
@@ -261,7 +261,7 @@ static int tftp(const int cmd, const struct hostent *host,
261 261
262 len = cp - buf; 262 len = cp - buf;
263 263
264#ifdef CONFIG_DEBUG_TFTP 264#if ENABLE_DEBUG_TFTP
265 fprintf(stderr, "sending %u bytes\n", len); 265 fprintf(stderr, "sending %u bytes\n", len);
266 for (cp = buf; cp < &buf[len]; cp++) 266 for (cp = buf; cp < &buf[len]; cp++)
267 fprintf(stderr, "%02x ", (unsigned char) *cp); 267 fprintf(stderr, "%02x ", (unsigned char) *cp);
@@ -337,7 +337,7 @@ static int tftp(const int cmd, const struct hostent *host,
337 opcode = ntohs(*((unsigned short *) buf)); 337 opcode = ntohs(*((unsigned short *) buf));
338 tmp = ntohs(*((unsigned short *) &buf[2])); 338 tmp = ntohs(*((unsigned short *) &buf[2]));
339 339
340#ifdef CONFIG_DEBUG_TFTP 340#if ENABLE_DEBUG_TFTP
341 fprintf(stderr, "received %d bytes: %04x %04x\n", len, opcode, tmp); 341 fprintf(stderr, "received %d bytes: %04x %04x\n", len, opcode, tmp);
342#endif 342#endif
343 343
@@ -359,7 +359,7 @@ static int tftp(const int cmd, const struct hostent *host,
359 359
360 break; 360 break;
361 } 361 }
362#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE 362#if ENABLE_FEATURE_TFTP_BLOCKSIZE
363 if (want_option_ack) { 363 if (want_option_ack) {
364 364
365 want_option_ack = 0; 365 want_option_ack = 0;
@@ -382,7 +382,7 @@ static int tftp(const int cmd, const struct hostent *host,
382 } else { 382 } else {
383 opcode = TFTP_ACK; 383 opcode = TFTP_ACK;
384 } 384 }
385#ifdef CONFIG_DEBUG_TFTP 385#if ENABLE_DEBUG_TFTP
386 fprintf(stderr, "using %s %u\n", OPTION_BLOCKSIZE, 386 fprintf(stderr, "using %s %u\n", OPTION_BLOCKSIZE,
387 blksize); 387 blksize);
388#endif 388#endif
@@ -448,7 +448,7 @@ static int tftp(const int cmd, const struct hostent *host,
448 } 448 }
449 } 449 }
450 450
451#ifdef CONFIG_FEATURE_CLEAN_UP 451#if ENABLE_FEATURE_CLEAN_UP
452 close(socketfd); 452 close(socketfd);
453 free(buf); 453 free(buf);
454#endif 454#endif
@@ -470,7 +470,7 @@ int tftp_main(int argc, char **argv)
470 470
471 /* figure out what to pass to getopt */ 471 /* figure out what to pass to getopt */
472 472
473#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE 473#if ENABLE_FEATURE_TFTP_BLOCKSIZE
474 char *sblocksize = NULL; 474 char *sblocksize = NULL;
475 475
476#define BS "b:" 476#define BS "b:"
@@ -480,7 +480,7 @@ int tftp_main(int argc, char **argv)
480#define BS_ARG 480#define BS_ARG
481#endif 481#endif
482 482
483#ifdef CONFIG_FEATURE_TFTP_GET 483#if ENABLE_FEATURE_TFTP_GET
484#define GET "g" 484#define GET "g"
485#define GET_COMPL ":g" 485#define GET_COMPL ":g"
486#else 486#else
@@ -488,7 +488,7 @@ int tftp_main(int argc, char **argv)
488#define GET_COMPL 488#define GET_COMPL
489#endif 489#endif
490 490
491#ifdef CONFIG_FEATURE_TFTP_PUT 491#if ENABLE_FEATURE_TFTP_PUT
492#define PUT "p" 492#define PUT "p"
493#define PUT_COMPL ":p" 493#define PUT_COMPL ":p"
494#else 494#else
@@ -505,16 +505,16 @@ int tftp_main(int argc, char **argv)
505 cmd = getopt32(argc, argv, GET PUT "l:r:" BS, &localfile, &remotefile BS_ARG); 505 cmd = getopt32(argc, argv, GET PUT "l:r:" BS, &localfile, &remotefile BS_ARG);
506 506
507 cmd &= (tftp_cmd_get | tftp_cmd_put); 507 cmd &= (tftp_cmd_get | tftp_cmd_put);
508#ifdef CONFIG_FEATURE_TFTP_GET 508#if ENABLE_FEATURE_TFTP_GET
509 if (cmd == tftp_cmd_get) 509 if (cmd == tftp_cmd_get)
510 flags = O_WRONLY | O_CREAT | O_TRUNC; 510 flags = O_WRONLY | O_CREAT | O_TRUNC;
511#endif 511#endif
512#ifdef CONFIG_FEATURE_TFTP_PUT 512#if ENABLE_FEATURE_TFTP_PUT
513 if (cmd == tftp_cmd_put) 513 if (cmd == tftp_cmd_put)
514 flags = O_RDONLY; 514 flags = O_RDONLY;
515#endif 515#endif
516 516
517#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE 517#if ENABLE_FEATURE_TFTP_BLOCKSIZE
518 if (sblocksize) { 518 if (sblocksize) {
519 blocksize = xatoi_u(sblocksize); 519 blocksize = xatoi_u(sblocksize);
520 if (!tftp_blocksize_check(blocksize, 0)) { 520 if (!tftp_blocksize_check(blocksize, 0)) {
@@ -542,7 +542,7 @@ int tftp_main(int argc, char **argv)
542 host = xgethostbyname(argv[optind]); 542 host = xgethostbyname(argv[optind]);
543 port = bb_lookup_port(argv[optind + 1], "udp", 69); 543 port = bb_lookup_port(argv[optind + 1], "udp", 69);
544 544
545#ifdef CONFIG_DEBUG_TFTP 545#if ENABLE_DEBUG_TFTP
546 fprintf(stderr, "using server \"%s\", remotefile \"%s\", " 546 fprintf(stderr, "using server \"%s\", remotefile \"%s\", "
547 "localfile \"%s\".\n", 547 "localfile \"%s\".\n",
548 inet_ntoa(*((struct in_addr *) host->h_addr)), 548 inet_ntoa(*((struct in_addr *) host->h_addr)),