dougm 98/08/06 12:13:55
Modified: src CHANGES
src/include httpd.h
src/main util.c
Log:
API: new ap_uuencode() function
Reviewed by: Ralf, Dean
Revision Changes Path
1.1007 +2 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1006
retrieving revision 1.1007
diff -u -r1.1006 -r1.1007
--- CHANGES 1998/08/06 18:58:16 1.1006
+++ CHANGES 1998/08/06 19:13:50 1.1007
@@ -1,5 +1,7 @@
Changes with Apache 1.3.2
+ *) API: new ap_uuencode() function [Doug MacEachern]
+
*) API: scan_script_header_err_core() now "public" and renamed
ap_scan_script_header_err_core() [Doug MacEachern]
1.230 +1 -0 apache-1.3/src/include/httpd.h
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -r1.229 -r1.230
--- httpd.h 1998/08/03 09:14:48 1.229
+++ httpd.h 1998/08/06 19:13:52 1.230
@@ -889,6 +889,7 @@
API_EXPORT(int) ap_strcmp_match(const char *str, const char *exp);
API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp);
API_EXPORT(char *) ap_uudecode(pool *, const char *);
+API_EXPORT(char *) ap_uuencode(pool *p, char *string);
#ifdef OS2
void os2pathname(char *path);
#endif
1.130 +22 -0 apache-1.3/src/main/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -r1.129 -r1.130
--- util.c 1998/08/06 01:09:30 1.129
+++ util.c 1998/08/06 19:13:53 1.130
@@ -1726,6 +1726,28 @@
return bufplain;
}
+static const char basis_64[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+API_EXPORT(char *) ap_uuencode(pool *a, char *string)
+{
+ int i, len = strlen(string);
+ char *p;
+ char *encoded = (char *) ap_pcalloc(a, (len+2) / 3 * 4);
+
+ p = encoded;
+ for (i = 0; i < len; i += 3) {
+ *p++ = basis_64[string[i] >> 2];
+ *p++ = basis_64[((string[i] & 0x3) << 4) | ((int) (string[i + 1] &
0xF0) >> 4)];
+ *p++ = basis_64[((string[i + 1] & 0xF) << 2) | ((int) (string[i + 2]
& 0xC0) >> 6)];
+ *p++ = basis_64[string[i + 2] & 0x3F];
+ }
+ *p-- = '\0';
+ *p-- = '=';
+ *p-- = '=';
+ return encoded;
+}
+
#ifdef OS2
void os2pathname(char *path)
{