[comp.sys.hp] UUencode/decode

saaf@joker.optics.rochester.edu (Lenny Saaf) (07/31/89)

	Is there an HP-UX analogue to uuencode and uudecode?  I have
seen these commands on Berkeley systems and assume there must be a way
to "ascii-ize" binary files with HP-UX.  Perhaps I assume too much? My
system particulars are: HP-UX 3.1 on a 9000/835.

	Thanks in advance.
--
<<<  Len Saaf   saaf@joker.optics.rochester.edu  >>>

wunder@hp-ses.SDE.HP.COM (Walter Underwood) (08/01/89)

   Is there an HP-UX analogue to uuencode and uudecode?

Just use uuencode and uudecode.  Those have always been PD.  I'm
mailing the source to you.

wunder

ronw@hpuflfa.HP.COM (Ron Williams) (08/01/89)

> 	Is there an HP-UX analogue to uuencode and uudecode?  I have
> seen these commands on Berkeley systems and assume there must be a way
> to "ascii-ize" binary files with HP-UX.  Perhaps I assume too much? My
> system particulars are: HP-UX 3.1 on a 9000/835.
> 
>	 Thanks in advance.
>--
><<<  Len Saaf   saaf@joker.optics.rochester.edu  >>>
>----------

For the most part HP'ers *SANITIZE* their file that might have non-printing
characters (or binary data or 8-bit info) for subsequent e-mail by using
the utility 'shar'. I do happen to have a copy of uudecode (sorry, no uuencode)
that seems to work (its extremely short).
------------------------------------------------------------------------------
#include <stdio.h>
#define DEC(c)	(((c) - ' ') & 077)
main()
{
	int n;
	char dest[128], a,b,c,d;

	scanf("begin %o ", &n);
	gets(dest);

	if (freopen(dest, "w", stdout) == NULL) {
		perror(dest);
		exit(1);
	}

	while ((n=getchar()) != EOF && (n=DEC(n))!=0)  {
		while (n>0) {
			a = DEC(getchar());
			b = DEC(getchar());
			c = DEC(getchar());
			d = DEC(getchar());
			if (n-- > 0) putchar(a << 2 | b >> 4);
			if (n-- > 0) putchar(b << 4 | c >> 2);
			if (n-- > 0) putchar(c << 6 | d);
		}
		n=getchar();
	}
	exit(0);
}
------------------------------------------------------------------------------


Ron Williams       HP Ft. Lauderdale       ronw@hpfcse
------------       TEL: T-938-2278         {hpfcse}!hpuflfa!ronw
                   FAX: T-938-2293         COMSYS: 3179
                   AREA CODE: 305          HPDESK: Ron Williams / HP3179/07

rer@hpfcdc.HP.COM (Rob Robason) (08/02/89)

> 	Is there an HP-UX analogue to uuencode and uudecode?  I have
> seen these commands on Berkeley systems and assume there must be a way
> to "ascii-ize" binary files with HP-UX.  Perhaps I assume too much? My
> system particulars are: HP-UX 3.1 on a 9000/835.

You may want to use the shar(1) command.  This is supported by HP and
allows archiving several binary files in a single file and unpacking
that file with /bin/sh.

Rob Robason

paul@hpldola.HP.COM (Paul Bame) (08/02/89)

If you can find source (it's been posted), uu*code should compile up and run
just fine - it does on my 9000/3xx anyway.