X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhoutsbr.c;h=97f97f08ffdf3eae1e9444ae2b01327aeb6674c1;hb=356f49083391bd018b6c5dfed21e59247b4cc74a;hp=7e12c46a72fa17a4ad6f9c30f299bea83f49ac57;hpb=5dd6771b28c257af405d7248639ed0e3bcdce38b;p=mmh diff --git a/uip/mhoutsbr.c b/uip/mhoutsbr.c index 7e12c46..97f97f0 100644 --- a/uip/mhoutsbr.c +++ b/uip/mhoutsbr.c @@ -19,10 +19,6 @@ #include #include -#ifdef HAVE_SYS_WAIT_H -# include -#endif - extern int ebcdicsw; @@ -61,15 +57,11 @@ static char ebcdicsafe[0x100] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static char nib2b64[0x40+1] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - /* * prototypes */ int output_message (CT, char *); int output_message_fp (CT, FILE *, char *); -int writeBase64aux (FILE *, FILE *); /* * static prototypes @@ -79,7 +71,7 @@ static void output_headers (CT, FILE *); static int writeExternalBody (CT, FILE *); static int write8Bit (CT, FILE *); static int writeQuoted (CT, FILE *); -static int writeBase64 (CT, FILE *); +static int writeBase64ct (CT, FILE *); /* @@ -203,7 +195,7 @@ output_content (CT ct, FILE *out) case CE_BASE64: putc ('\n', out); - result = writeBase64 (ct, out); + result = writeBase64ct (ct, out); break; case CE_BINARY: @@ -415,7 +407,7 @@ three_print: */ static int -writeBase64 (CT ct, FILE *out) +writeBase64ct (CT ct, FILE *out) { int fd, result; char *file; @@ -429,51 +421,3 @@ writeBase64 (CT ct, FILE *out) (*ct->c_ceclosefnx) (ct); return result; } - - -int -writeBase64aux (FILE *in, FILE *out) -{ - int cc, n; - char inbuf[3]; - - n = BPERLIN; - while ((cc = fread (inbuf, sizeof(*inbuf), sizeof(inbuf), in)) > 0) { - unsigned long bits; - char *bp; - char outbuf[4]; - - if (cc < sizeof(inbuf)) { - inbuf[2] = 0; - if (cc < sizeof(inbuf) - 1) - inbuf[1] = 0; - } - bits = (inbuf[0] & 0xff) << 16; - bits |= (inbuf[1] & 0xff) << 8; - bits |= inbuf[2] & 0xff; - - for (bp = outbuf + sizeof(outbuf); bp > outbuf; bits >>= 6) - *--bp = nib2b64[bits & 0x3f]; - if (cc < sizeof(inbuf)) { - outbuf[3] = '='; - if (cc < sizeof inbuf - 1) - outbuf[2] = '='; - } - - fwrite (outbuf, sizeof(*outbuf), sizeof(outbuf), out); - - if (cc < sizeof(inbuf)) { - putc ('\n', out); - return OK; - } - - if (--n <= 0) { - n = BPERLIN; - putc ('\n', out); - } - } - if (n != BPERLIN) - putc ('\n', out); - - return OK; -}