aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-03 15:49:40 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-09-03 15:49:40 +0000
commitf9b31bf3bcd38c95a6575265e2597fbf1da04b16 (patch)
tree5cf8056965bf44d78ef9937fe1f529fa2915e772 /networking
parent5f698a69678ee6ac7e499f6482d3fbc745ac4ef4 (diff)
downloadbusybox-w32-f9b31bf3bcd38c95a6575265e2597fbf1da04b16.tar.gz
busybox-w32-f9b31bf3bcd38c95a6575265e2597fbf1da04b16.tar.bz2
busybox-w32-f9b31bf3bcd38c95a6575265e2597fbf1da04b16.zip
uuencode: common implementation for wget and uuencode (closing bug 694)
git-svn-id: svn://busybox.net/trunk/busybox@16043 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking')
-rw-r--r--networking/wget.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 755515262..c3b9fc039 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -98,29 +98,11 @@ static char *safe_fgets(char *s, int size, FILE *stream)
98 98
99#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION 99#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
100/* 100/*
101 * Base64-encode character string 101 * Base64-encode character string and return the string.
102 * oops... isn't something similar in uuencode.c?
103 * XXX: It would be better to use already existing code
104 */ 102 */
105static char *base64enc(unsigned char *p, char *buf, int len) { 103static char *base64enc(unsigned char *p, char *buf, int len) {
106 104
107 char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 105 bb_uuencode(p, buf, len, bb_uuenc_tbl_base64);
108 "0123456789+/";
109 char *s = buf;
110
111 while(*p) {
112 if (s >= buf+len-4)
113 bb_error_msg_and_die("buffer overflow");
114 *(s++) = al[(*p >> 2) & 0x3F];
115 *(s++) = al[((*p << 4) & 0x30) | ((*(p+1) >> 4) & 0x0F)];
116 *s = *(s+1) = '=';
117 *(s+2) = 0;
118 if (! *(++p)) break;
119 *(s++) = al[((*p << 2) & 0x3C) | ((*(p+1) >> 6) & 0x03)];
120 if (! *(++p)) break;
121 *(s++) = al[*(p++) & 0x3F];
122 }
123
124 return buf; 106 return buf;
125} 107}
126#endif 108#endif