aboutsummaryrefslogtreecommitdiff
path: root/networking/tftp.c
diff options
context:
space:
mode:
authorTim Riker <tim@rikers.org>2006-01-25 00:08:53 +0000
committerTim Riker <tim@rikers.org>2006-01-25 00:08:53 +0000
commitc1ef7bdd8d002ae0889efcf883d0e1b7faa938d4 (patch)
tree5f329b7d0c7f20ecced0dc7581a9ba6dc720d965 /networking/tftp.c
parentf64ff682a3d58dbb627e760e6fe1ec21d9ccdf61 (diff)
downloadbusybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.gz
busybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.tar.bz2
busybox-w32-c1ef7bdd8d002ae0889efcf883d0e1b7faa938d4.zip
just whitespace
Diffstat (limited to 'networking/tftp.c')
-rw-r--r--networking/tftp.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index cad0dcc45..402d5d03c 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -1,34 +1,34 @@
1/* ------------------------------------------------------------------------- */ 1/* ------------------------------------------------------------------------- */
2/* tftp.c */ 2/* tftp.c */
3/* */ 3/* */
4/* A simple tftp client for busybox. */ 4/* A simple tftp client for busybox. */
5/* Tries to follow RFC1350. */ 5/* Tries to follow RFC1350. */
6/* Only "octet" mode supported. */ 6/* Only "octet" mode supported. */
7/* Optional blocksize negotiation (RFC2347 + RFC2348) */ 7/* Optional blocksize negotiation (RFC2347 + RFC2348) */
8/* */ 8/* */
9/* Copyright (C) 2001 Magnus Damm <damm@opensource.se> */ 9/* Copyright (C) 2001 Magnus Damm <damm@opensource.se> */
10/* */ 10/* */
11/* Parts of the code based on: */ 11/* Parts of the code based on: */
12/* */ 12/* */
13/* atftp: Copyright (C) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca> */ 13/* atftp: Copyright (C) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca> */
14/* and Remi Lefebvre <remi@debian.org> */ 14/* and Remi Lefebvre <remi@debian.org> */
15/* */ 15/* */
16/* utftp: Copyright (C) 1999 Uwe Ohse <uwe@ohse.de> */ 16/* utftp: Copyright (C) 1999 Uwe Ohse <uwe@ohse.de> */
17/* */ 17/* */
18/* This program is free software; you can redistribute it and/or modify */ 18/* This program is free software; you can redistribute it and/or modify */
19/* it under the terms of the GNU General Public License as published by */ 19/* it under the terms of the GNU General Public License as published by */
20/* the Free Software Foundation; either version 2 of the License, or */ 20/* the Free Software Foundation; either version 2 of the License, or */
21/* (at your option) any later version. */ 21/* (at your option) any later version. */
22/* */ 22/* */
23/* This program is distributed in the hope that it will be useful, */ 23/* This program is distributed in the hope that it will be useful, */
24/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 24/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
25/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ 25/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
26/* General Public License for more details. */ 26/* General Public License for more details. */
27/* */ 27/* */
28/* You should have received a copy of the GNU General Public License */ 28/* You should have received a copy of the GNU General Public License */
29/* along with this program; if not, write to the Free Software */ 29/* along with this program; if not, write to the Free Software */
30/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 30/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
31/* */ 31/* */
32/* ------------------------------------------------------------------------- */ 32/* ------------------------------------------------------------------------- */
33 33
34#include <stdio.h> 34#include <stdio.h>
@@ -87,13 +87,13 @@ static const char * const tftp_bb_error_msg[] = {
87 87
88static int tftp_blocksize_check(int blocksize, int bufsize) 88static int tftp_blocksize_check(int blocksize, int bufsize)
89{ 89{
90 /* Check if the blocksize is valid: 90 /* Check if the blocksize is valid:
91 * RFC2348 says between 8 and 65464, 91 * RFC2348 says between 8 and 65464,
92 * but our implementation makes it impossible 92 * but our implementation makes it impossible
93 * to use blocksizes smaller than 22 octets. 93 * to use blocksizes smaller than 22 octets.
94 */ 94 */
95 95
96 if ((bufsize && (blocksize > bufsize)) || 96 if ((bufsize && (blocksize > bufsize)) ||
97 (blocksize < 8) || (blocksize > 65464)) { 97 (blocksize < 8) || (blocksize > 65464)) {
98 bb_error_msg("bad blocksize"); 98 bb_error_msg("bad blocksize");
99 return 0; 99 return 0;
@@ -104,7 +104,7 @@ static int tftp_blocksize_check(int blocksize, int bufsize)
104 104
105static char *tftp_option_get(char *buf, int len, char *option) 105static char *tftp_option_get(char *buf, int len, char *option)
106{ 106{
107 int opt_val = 0; 107 int opt_val = 0;
108 int opt_found = 0; 108 int opt_found = 0;
109 int k; 109 int k;
110 110
@@ -216,7 +216,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
216 216
217 if ((cmd_get && (opcode == TFTP_RRQ)) || 217 if ((cmd_get && (opcode == TFTP_RRQ)) ||
218 (cmd_put && (opcode == TFTP_WRQ))) { 218 (cmd_put && (opcode == TFTP_WRQ))) {
219 int too_long = 0; 219 int too_long = 0;
220 220
221 /* see if the filename fits into buf */ 221 /* see if the filename fits into buf */
222 /* and fill in packet */ 222 /* and fill in packet */
@@ -418,7 +418,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
418 418
419 if (res) { 419 if (res) {
420 int blksize = atoi(res); 420 int blksize = atoi(res);
421 421
422 if (tftp_blocksize_check(blksize, 422 if (tftp_blocksize_check(blksize,
423 tftp_bufsize - 4)) { 423 tftp_bufsize - 4)) {
424 424
@@ -452,7 +452,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
452 if (cmd_get && (opcode == TFTP_DATA)) { 452 if (cmd_get && (opcode == TFTP_DATA)) {
453 453
454 if (tmp == block_nr) { 454 if (tmp == block_nr) {
455 455
456 len = bb_full_write(localfd, &buf[4], len - 4); 456 len = bb_full_write(localfd, &buf[4], len - 4);
457 457
458 if (len < 0) { 458 if (len < 0) {
@@ -496,7 +496,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
496#ifdef CONFIG_FEATURE_CLEAN_UP 496#ifdef CONFIG_FEATURE_CLEAN_UP
497 close(socketfd); 497 close(socketfd);
498 498
499 free(buf); 499 free(buf);
500#endif 500#endif
501 501
502 return finished ? EXIT_SUCCESS : EXIT_FAILURE; 502 return finished ? EXIT_SUCCESS : EXIT_FAILURE;
@@ -549,8 +549,8 @@ int tftp_main(int argc, char **argv)
549 /* XXX: may be should #error ? */ 549 /* XXX: may be should #error ? */
550#endif 550#endif
551 551
552 552
553 cmd = bb_getopt_ulflags(argc, argv, GET PUT "l:r:" BS, 553 cmd = bb_getopt_ulflags(argc, argv, GET PUT "l:r:" BS,
554 &localfile, &remotefile BS_ARG); 554 &localfile, &remotefile BS_ARG);
555#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE 555#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
556 if(sblocksize) { 556 if(sblocksize) {