Thread View: news.software.readers
3 messages
3 total messages
Started by Michael Praschl
Mon, 17 Jan 2000 00:00
looking for uudecode source.
Author: Michael Praschl
Date: Mon, 17 Jan 2000 00:00
Date: Mon, 17 Jan 2000 00:00
16 lines
1352 bytes
1352 bytes
i've been lately trying to find a source for uudecode, as i would like to include it in my newsreader directly. but the only useable thing the searchengines popped up was a pascal source, and after porting the decoding part to C, every second in 3 bytes is decoded wrong, and i cant figure out, where the problem is. can somebody post a C or C++ source to this, please? it just needs to be the actual decoding. messing with files, memory or whatever im not interested in, just the plain decoding, this would help me a lot. many thanks Michael Praschl
Re: looking for uudecode source.
Author: Russ Allbery
Date: Sun, 16 Jan 2000 00:00
Date: Sun, 16 Jan 2000 00:00
55 lines
2272 bytes
2272 bytes
Michael Praschl <praschl@bigfoot.com> writes:
> i've been lately trying to find a source for uudecode, as i would like
> to include it in my newsreader directly.
> but the only useable thing the searchengines popped up was a pascal
> source, and after porting the decoding part to C, every second in 3
> bytes is decoded wrong, and i cant figure out, where the problem is.
> can somebody post a C or C++ source to this, please?
/* Decoding a single character of uuencoded text. */
#define DEC(c) (((c) - ' ') & 077)
/* Decode a uuencoded string into another buffer, returning the total
number of characters. This is based on 4.4 BSD source. */
int
decode(char *encoded, char *decoded)
{
int count, length;
char *in, *out;
in = encoded;
out = decoded;
while (1) {
length = DEC(*in);
if (length <= 0) break;
for (++in; length > 0; in += 4, length -= 3) {
if (length >= 1) {
*out = DEC(in[0]) << 2 | DEC(in[1]) >> 4;
out++;
}
if (length >= 2) {
*out = DEC(in[1]) << 4 | DEC(in[2]) >> 2;
out++;
}
if (length >= 3) {
*out = DEC(in[2]) << 6 | DEC(in[3]);
out++;
}
}
if (in[1] != '\0')
++in;
else
break;
}
return (out - decoded);
}
This isn't particularly forgiving, but I know it works.
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: looking for uudecode source.
Author: Michael Praschl
Date: Mon, 17 Jan 2000 00:00
Date: Mon, 17 Jan 2000 00:00
9 lines
1066 bytes
1066 bytes
>> i've been lately trying to find a source for uudecode, as i would like >> to include it in my newsreader directly. >/* Decoding a single character of uuencoded text. */ thanks
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads