Thanks,
PK
>Can anyone direct me to a Base64 decoder for Unix please?
have a look for mimencode
Well, uudeview can handle MIME messages, uuencode, xxencode, base64,
and probably more.
Search the web for it, or check your favourite local FTP site for it.
--
Andrew E. Mileski mailto:a...@netcom.ca
Linux Plug-and-Play Kernel Project http://www.redhat.com/linux-info/pnp/
XFree86 Matrox Team http://www.bf.rmit.edu.au/~ajv/xf86-matrox.html
>Can anyone direct me to a Base64 decoder for Unix please?
There is the "metamail" (or mm2.7) toolset on many ftp-servers.
One part is the wanted decoder.
Uwe
--
Uwe Hahn
System Microelectronic Innovation GmbH (SMI); Frankfurt(Oder), Germany
eMail : ha...@smi.ff.eunet.de
Fax : +49 335 546 3535/3001 Phone : +49 335 546 2679
--------------------------Start-----------------------
/* base64 decoder */
/* J C Sager, May 1995 */
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
char chartab[] = {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,
52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,
-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1};
main()
{
int i, cc, t, padcount;
int state;
union {
int i;
char c[4];
} out;
out.i = 0;
state = 0;
padcount = 0;
while ((cc=getchar()) != EOF)
if (!isspace(cc)) {
if ((t=chartab[cc&0x7f]) == -1) {
printf("Unrecognised input char 0x%02x\n", cc);
exit(1);
}
if (t==-2) /* end padding */
padcount++;
else {
out.i = out.i<<6 | t;
if (++state == 4) {
state = 0;
for (i=1; i<4; i++)
putchar(out.c[i]);
}
}
}
/* finished - sort out the final chars */
if (padcount == 1)
putchar(out.c[2]);
if (padcount > 0)
putchar(out.c[3]);
}
--------------------End----------------------
Then call it like base64 <infile >outfile
---
Steve Hindmarch
tel: +44 1473 605241, fax: +44 1473 621917
email:hind...@boat.bt.com, http://www.cmiu.bt.co.uk/people/HINDMASJ/
The views expressed herein are mine and mine alone - nothing to do with
BT plc
mpack/munpack
|>
|>Thanks,
|>
|>PK
|>
|>
--
-------
John Peach, Shell IS Ltd., 1 Altens Farm Road, Aberdeen, AB12 3FY, Scotland.
j.p...@openmail2.isse532.sukepabe.simis.com
jo...@covebay.demon.co.uk