New Code!
A little over a decade ago, I wrote up some programs to assemble and pick apart mime-ified mail messages, because the standard mpack and munpack programs were dumping core on some spam messages I was trying to disassemble so I could feed them into my spamcatcher. The spec looked easy, so I thought it would be a trivial job to duplicate.
Well, it wasn't easy, but I eventually managed to bash the code into some sort of shape where it would split apart marginally formatted spam. And it worked on pell and compiled on some of my freebsd boxes, so I thought it was workable code.
And there it sat for many years, until this week; I was trying to disassemble some mimed mail at work (the copy of mutt I'm using there picks apart mimed mail UNLESS you forward the message, and then it presents you with unformatted mime poop to edit by hand. Ugh) and realized that none of the machines I had access to there (from rhel5 boxes to Alpha machines running OSF-whatever) had anything I could recognise as a demimer. I certainly wasn't going to worry about looking too far, because I knew that mimecode was parked on my website waiting for just this sort of situation. I ftped the code over to the work machine, compiled it, and it, um, did nothing worthwhile. (It found all the mime file fragments, created the filenames, and filled them with ^@ and linefeeds. Not a particularly useful situation, and I wondered what was wrong.) So I looked briefly at the code and realized, to my horror, that it suffered badly from the "Everything's a VAX" disease [with, in my case, "a VAX" being defined as Pell and Gehenna.] I set the code aside and picked the offending mail message apart by hand, then set aside most of my evening to go in and fix this horrible little wagon.
And it's (mainly) fixed, at least in the way that I can now properly pick apart mimed (and uuencoded) files on Pell, Gehenna, and my Macbook. And if I'm very lucky it will also pick apart files on the rhel5 box that was unhappy at work.
The new version of ravel and unravel have replace the -w option with -a (always write mime fragments to disk), the uudecode link now understands the -o FILE option (write output to the named file), and you can set the prefix for unnamed files (-a option) by the -p PFX option.
It's still a bit of a bodge, but it's a bodge that runs on threefive systems now. So it's good enough to be New Code! at least until I do the next revision.
Update: and, hey, it built and ran on a rhel3 and a centos5 box without fuss muss or bother. This is good, because the macos/rhel3/centos5 trifecta covers much of the world of hideous mutations that makes up the modern UNIX™ world.