aboutsummaryrefslogtreecommitdiff
path: root/coreutils/uudecode.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-01-20 21:29:32 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-01-20 21:29:32 +0000
commitca5b35299e2513e704a6a6cc2f1ac4e650c3b2de (patch)
treecaccda19ce4af610e88a4f28a3d0362286252ad6 /coreutils/uudecode.c
parentd58c19479d4459923a36c94e5d0c94e8f40b7fd6 (diff)
downloadbusybox-w32-ca5b35299e2513e704a6a6cc2f1ac4e650c3b2de.tar.gz
busybox-w32-ca5b35299e2513e704a6a6cc2f1ac4e650c3b2de.tar.bz2
busybox-w32-ca5b35299e2513e704a6a6cc2f1ac4e650c3b2de.zip
- make read_stduu() and read_base64() void, small size tweaks
Diffstat (limited to 'coreutils/uudecode.c')
-rw-r--r--coreutils/uudecode.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index dc7d2aef8..92272a967 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -14,7 +14,7 @@
14 14
15#include "busybox.h" 15#include "busybox.h"
16 16
17static int read_stduu(FILE *src_stream, FILE *dst_stream) 17static void read_stduu(FILE *src_stream, FILE *dst_stream)
18{ 18{
19 char *line; 19 char *line;
20 20
@@ -23,7 +23,7 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
23 char *line_ptr = line; 23 char *line_ptr = line;
24 24
25 if (strcmp(line, "end") == 0) { 25 if (strcmp(line, "end") == 0) {
26 return EXIT_SUCCESS; 26 return;
27 } 27 }
28 length = ((*line_ptr - 0x20) & 0x3f)* 4 / 3; 28 length = ((*line_ptr - 0x20) & 0x3f)* 4 / 3;
29 29
@@ -66,11 +66,11 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream)
66 bb_error_msg_and_die("short file"); 66 bb_error_msg_and_die("short file");
67} 67}
68 68
69static int read_base64(FILE *src_stream, FILE *dst_stream) 69static void read_base64(FILE *src_stream, FILE *dst_stream)
70{ 70{
71 static const char base64_table[] = 71 static const char base64_table[] =
72 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n"; 72 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n";
73 char term_count = 0; 73 int term_count = 0;
74 74
75 while (1) { 75 while (1) {
76 char translated[4]; 76 char translated[4];
@@ -101,7 +101,7 @@ static int read_base64(FILE *src_stream, FILE *dst_stream)
101 else if (*table_ptr == '\n') { 101 else if (*table_ptr == '\n') {
102 /* Check for terminating line */ 102 /* Check for terminating line */
103 if (term_count == 5) { 103 if (term_count == 5) {
104 return EXIT_SUCCESS; 104 return;
105 } 105 }
106 term_count = 1; 106 term_count = 1;
107 continue; 107 continue;
@@ -141,11 +141,10 @@ int uudecode_main(int argc, char **argv)
141 141
142 /* Search for the start of the encoding */ 142 /* Search for the start of the encoding */
143 while ((line = xmalloc_getline(src_stream)) != NULL) { 143 while ((line = xmalloc_getline(src_stream)) != NULL) {
144 int (*decode_fn_ptr)(FILE * src, FILE * dst); 144 void (*decode_fn_ptr)(FILE * src, FILE * dst);
145 char *line_ptr; 145 char *line_ptr;
146 FILE *dst_stream; 146 FILE *dst_stream;
147 int mode; 147 int mode;
148 int ret;
149 148
150 if (strncmp(line, "begin-base64 ", 13) == 0) { 149 if (strncmp(line, "begin-base64 ", 13) == 0) {
151 line_ptr = line + 13; 150 line_ptr = line + 13;
@@ -173,9 +172,9 @@ int uudecode_main(int argc, char **argv)
173 chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)); 172 chmod(outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO));
174 } 173 }
175 free(line); 174 free(line);
176 ret = decode_fn_ptr(src_stream, dst_stream); 175 decode_fn_ptr(src_stream, dst_stream);
177 fclose_if_not_stdin(src_stream); 176 fclose_if_not_stdin(src_stream);
178 return ret; 177 return EXIT_SUCCESS;
179 } 178 }
180 bb_error_msg_and_die("no 'begin' line"); 179 bb_error_msg_and_die("no 'begin' line");
181} 180}