diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-03-15 08:29:22 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-03-15 08:29:22 +0000 |
commit | c7bda1ce659294d6e22c06e087f6f265983c7578 (patch) | |
tree | 4c6d2217f4d8306c59cf1096f8664e1cfd167213 /networking/tftp.c | |
parent | 8854004b41065b3d081af7f3df13a100b0c8bfbe (diff) | |
download | busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.gz busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.bz2 busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.zip |
Remove trailing whitespace. Update copyright to include 2004.
Diffstat (limited to 'networking/tftp.c')
-rw-r--r-- | networking/tftp.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/networking/tftp.c b/networking/tftp.c index 10aa63bb9..bd973d79a 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -76,15 +76,15 @@ const int tftp_cmd_put = 2; | |||
76 | 76 | ||
77 | #ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE | 77 | #ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE |
78 | 78 | ||
79 | static int tftp_blocksize_check(int blocksize, int bufsize) | 79 | static int tftp_blocksize_check(int blocksize, int bufsize) |
80 | { | 80 | { |
81 | /* Check if the blocksize is valid: | 81 | /* Check if the blocksize is valid: |
82 | * RFC2348 says between 8 and 65464, | 82 | * RFC2348 says between 8 and 65464, |
83 | * but our implementation makes it impossible | 83 | * but our implementation makes it impossible |
84 | * to use blocksizes smaller than 22 octets. | 84 | * to use blocksizes smaller than 22 octets. |
85 | */ | 85 | */ |
86 | 86 | ||
87 | if ((bufsize && (blocksize > bufsize)) || | 87 | if ((bufsize && (blocksize > bufsize)) || |
88 | (blocksize < 8) || (blocksize > 65464)) { | 88 | (blocksize < 8) || (blocksize > 65464)) { |
89 | bb_error_msg("bad blocksize"); | 89 | bb_error_msg("bad blocksize"); |
90 | return 0; | 90 | return 0; |
@@ -93,12 +93,12 @@ static int tftp_blocksize_check(int blocksize, int bufsize) | |||
93 | return blocksize; | 93 | return blocksize; |
94 | } | 94 | } |
95 | 95 | ||
96 | static char *tftp_option_get(char *buf, int len, char *option) | 96 | static char *tftp_option_get(char *buf, int len, char *option) |
97 | { | 97 | { |
98 | int opt_val = 0; | 98 | int opt_val = 0; |
99 | int opt_found = 0; | 99 | int opt_found = 0; |
100 | int k; | 100 | int k; |
101 | 101 | ||
102 | while (len > 0) { | 102 | while (len > 0) { |
103 | 103 | ||
104 | /* Make sure the options are terminated correctly */ | 104 | /* Make sure the options are terminated correctly */ |
@@ -117,21 +117,21 @@ static char *tftp_option_get(char *buf, int len, char *option) | |||
117 | if (strcasecmp(buf, option) == 0) { | 117 | if (strcasecmp(buf, option) == 0) { |
118 | opt_found = 1; | 118 | opt_found = 1; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | else { | 121 | else { |
122 | if (opt_found) { | 122 | if (opt_found) { |
123 | return buf; | 123 | return buf; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | k++; | 127 | k++; |
128 | 128 | ||
129 | buf += k; | 129 | buf += k; |
130 | len -= k; | 130 | len -= k; |
131 | 131 | ||
132 | opt_val ^= 1; | 132 | opt_val ^= 1; |
133 | } | 133 | } |
134 | 134 | ||
135 | return NULL; | 135 | return NULL; |
136 | } | 136 | } |
137 | 137 | ||
@@ -207,7 +207,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
207 | 207 | ||
208 | if ((cmd_get && (opcode == TFTP_RRQ)) || | 208 | if ((cmd_get && (opcode == TFTP_RRQ)) || |
209 | (cmd_put && (opcode == TFTP_WRQ))) { | 209 | (cmd_put && (opcode == TFTP_WRQ))) { |
210 | int too_long = 0; | 210 | int too_long = 0; |
211 | 211 | ||
212 | /* see if the filename fits into buf */ | 212 | /* see if the filename fits into buf */ |
213 | /* and fill in packet */ | 213 | /* and fill in packet */ |
@@ -380,7 +380,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
380 | if (buf[4] != '\0') { | 380 | if (buf[4] != '\0') { |
381 | msg = &buf[4]; | 381 | msg = &buf[4]; |
382 | buf[tftp_bufsize - 1] = '\0'; | 382 | buf[tftp_bufsize - 1] = '\0'; |
383 | } else if (tmp < (sizeof(tftp_bb_error_msg) | 383 | } else if (tmp < (sizeof(tftp_bb_error_msg) |
384 | / sizeof(char *))) { | 384 | / sizeof(char *))) { |
385 | 385 | ||
386 | msg = (char *) tftp_bb_error_msg[tmp]; | 386 | msg = (char *) tftp_bb_error_msg[tmp]; |
@@ -404,12 +404,12 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
404 | 404 | ||
405 | char *res; | 405 | char *res; |
406 | 406 | ||
407 | res = tftp_option_get(&buf[2], len-2, | 407 | res = tftp_option_get(&buf[2], len-2, |
408 | "blksize"); | 408 | "blksize"); |
409 | 409 | ||
410 | if (res) { | 410 | if (res) { |
411 | int blksize = atoi(res); | 411 | int blksize = atoi(res); |
412 | 412 | ||
413 | if (tftp_blocksize_check(blksize, | 413 | if (tftp_blocksize_check(blksize, |
414 | tftp_bufsize - 4)) { | 414 | tftp_bufsize - 4)) { |
415 | 415 | ||
@@ -443,7 +443,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
443 | if (cmd_get && (opcode == TFTP_DATA)) { | 443 | if (cmd_get && (opcode == TFTP_DATA)) { |
444 | 444 | ||
445 | if (tmp == block_nr) { | 445 | if (tmp == block_nr) { |
446 | 446 | ||
447 | len = write(localfd, &buf[4], len - 4); | 447 | len = write(localfd, &buf[4], len - 4); |
448 | 448 | ||
449 | if (len < 0) { | 449 | if (len < 0) { |
@@ -506,13 +506,13 @@ int tftp_main(int argc, char **argv) | |||
506 | #ifdef CONFIG_FEATURE_TFTP_GET | 506 | #ifdef CONFIG_FEATURE_TFTP_GET |
507 | #define GET "g" | 507 | #define GET "g" |
508 | #else | 508 | #else |
509 | #define GET | 509 | #define GET |
510 | #endif | 510 | #endif |
511 | 511 | ||
512 | #ifdef CONFIG_FEATURE_TFTP_PUT | 512 | #ifdef CONFIG_FEATURE_TFTP_PUT |
513 | #define PUT "p" | 513 | #define PUT "p" |
514 | #else | 514 | #else |
515 | #define PUT | 515 | #define PUT |
516 | #endif | 516 | #endif |
517 | 517 | ||
518 | while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) { | 518 | while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) { |
@@ -537,7 +537,7 @@ int tftp_main(int argc, char **argv) | |||
537 | flags = O_RDONLY; | 537 | flags = O_RDONLY; |
538 | break; | 538 | break; |
539 | #endif | 539 | #endif |
540 | case 'l': | 540 | case 'l': |
541 | localfile = bb_xstrdup(optarg); | 541 | localfile = bb_xstrdup(optarg); |
542 | break; | 542 | break; |
543 | case 'r': | 543 | case 'r': |