yD - yEnc decoder 0.1 (c)paul
-----------------------------

This is a decoder for yEncoded files. See http://www.yenc.org for info.

It was made completely from scratch in Virtual Pascal for OS/2. Thanks to
cross-platform ability of VP I have included the Win32, Linux and DOS
versions also. Please note that I didn't test these, but they should work.
For a free copy of Virtual Pascal for OS/2 and Windows visit vpascal.com

Usage is simple: yd newsfile.txt

You can use wildcards, and you can put multiple filenames/wildcards on the
commandline. It is capable of decoding multiple yEnc pieces within a single
file, so if your news-grabber puts everything in one huge file, this is fine.
If each message is in a seperate file, this is fine too.

The main characteristics of this program are: Multi-part postings are NOT
auto-joined. Files are saved with part-number appended. For example the
file MOVIE.AVI posted in 3 parts will be saved by yD as such:

MOVIE.AVI.001
MOVIE.AVI.002
MOVIE.AVI.003

This is similar to the very common "split" files so you can use tools for
that, or just a simple 'for' series of copy /b's also does the trick. It
doesn't do any fancy multi-pass analysis like uudeview does. It simply
decodes and dumps it to disk. It's up to you to figure if it's complete and
whatever.

If a filename already exists on the harddrive it's appended by a number
started with .1 and if file.gif.1 exists then it's saved as file.gif.2
and so on. Again this is to allow you to just decode EVERYTHING and you
can determine what's duplicate or whatever at a later date. This is really
ideal if you just d/l everything all at once.

File size and CRC32 are checked (if given in the original posting) and if
they don't match, the file is written to disk with .badsize and/or .badcrc
appended to it's name. Note that a bad size will usually lead to a bad crc
so it can be a bit redundant in those cases... :) There are some buggy
yEnc implementations out there, so if the file has .badcrc but the size is
OK you might check the file, it could be OK. There's a certain wind0ze
posting program who marks the CRC32's as 00000001 for some reason. If you
see someone posting with one of these, please let them know to update to
a working version of their software...

PLEASE NOTE: The software you use to save the messages must save the text
in it's original format. Due to the "raw" nature of yEnc, if any translation
of characters or stripping out of TAB's etc it could corrupt all of the files
you download. This isn't a fault in the newsgrabber program, as USENET is not
meant to deliver 8bit 'binary' content anyway... The headers are irrelevant
to this program. If your newsgrabber only saves the body of messages and not
the headers, this is perfectly acceptable!

Aside from parsing the =ybegin and =yend stuff, the basic math to decoding
the yEnc format in Pascal is simply:

if b<$2A then inc(b,$D6) else dec(b,$2A);


I made this for my own use, and it works like I want it to. But if you have
any suggestions or problems feel free to email me at biz@arabia.com and if
I like your idea, I might reply :)

