aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-03 15:49:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-03 15:49:40 +0000
commit21afc7dc291f1cb11feec7a9766bf3542545f581 (patch)
tree5cf8056965bf44d78ef9937fe1f529fa2915e772 /networking
parent22dca23d52c836e40c79cb4042b867fdc06f6ca3 (diff)
downloadbusybox-21afc7dc291f1cb11feec7a9766bf3542545f581.tar.gz
uuencode: common implementation for wget and uuencode (closing bug 694)
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)
#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
/*
- * Base64-encode character string
- * oops... isn't something similar in uuencode.c?
- * XXX: It would be better to use already existing code
+ * Base64-encode character string and return the string.
*/
static char *base64enc(unsigned char *p, char *buf, int len) {
- char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- "0123456789+/";
- char *s = buf;
-
- while(*p) {
- if (s >= buf+len-4)
- bb_error_msg_and_die("buffer overflow");
- *(s++) = al[(*p >> 2) & 0x3F];
- *(s++) = al[((*p << 4) & 0x30) | ((*(p+1) >> 4) & 0x0F)];
- *s = *(s+1) = '=';
- *(s+2) = 0;
- if (! *(++p)) break;
- *(s++) = al[((*p << 2) & 0x3C) | ((*(p+1) >> 6) & 0x03)];
- if (! *(++p)) break;
- *(s++) = al[*(p++) & 0x3F];
- }
-
+ bb_uuencode(p, buf, len, bb_uuenc_tbl_base64);
return buf;
}
#endif