home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk1.iso
/
altsrc
/
articles
/
10757
< prev
next >
Wrap
Text File
|
1994-06-24
|
2KB
|
69 lines
Path: wupost!gumby!newsxfer.itd.umich.edu!europa.eng.gtefsd.com!sundog.tiac.net!news.sprintlink.net!demon!an-teallach.com!gtoal
Newsgroups: alt.sources
From: gtoal@an-teallach.com (Graham Toal)
Subject: A quick hack for that nasty 'quoted-printable' mime mail...
X-Phone: +44 31 662 0366
X-Fax: +44 31 662 4678
X-Organisation: An Teallach Limited
Date: Fri, 24 Jun 1994 13:18:55 +0000
Message-ID: <199406241314.OAA21644@an-teallach.com>
Sender: usenet@demon.co.uk
Lines: 56
This is a quick hack for people (like me) who don't have mime mailers
and don't particularly want mime mailers, but who often receive mail
from people with Macs and Eudora which contain those stupid '=46' etc
codes and has lines broken in the wrong places everywhere with equals
signs.
This is no substitute for the real thing, but I hacked it up quickly
for myself because the mail I was getting was driving me nuts.
First, you need procmail. Put this in your .procmailrc before anything
else:
:3Hf:/home/gtoal/.mime
^Mime-Version: 1\.0
^Content-Type: text/plain; charset="iso-8859-1"
^Content-Transfer-Encoding: quoted-printable
|/my/bin/directory/filter
Then take filter.c below and compile it and put it whereever you put
'/my/bin/directory' above...
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
/* =<nl> -> join */
/* =nn -> 0xnn */
int c1 = 0, c2 = 0, c3 = 0;
int started = (0!=0);
for (;;) {
c2 = getchar();
if (c2 == EOF) {
if (c1 != 0) putchar(c1);
break;
}
if (c1 == '\n' && c2 == '\n') started = (0==0); /* past headers */
if (started && (c1 == '=')) {
if (c2 == '\n') {
c1 = c2 = 0;
} else if (('0' <= c2 && c2 <= '9') || ('A' <= c2 && c2 <= 'F')) {
c3 = getchar();
putchar(((isdigit(c2) ? c2 - '0' : c2 - 'A' + 10) << 4)
| (isdigit(c3) ? c3 - '0' : c3 - 'A' + 10));
c1 = c2 = c3 = 0;
} else {
/* illegal */
putchar(c1); putchar(c2); c1 = c2 = 0;
}
} else {
putchar(c1);
c1 = c2; c2 = 0;
}
}
exit(0);
return(1);
}