[comp.binaries.ibm.pc.d] UUENCODE

snsrjth@nmtsun.nmt.edu (<<Jeff>>) (09/20/88)

I am looking for a uuencoder for ibm. Does one exists? If someone
actually has one, could they please post it to comp.binaries.ibm.pc if
it is possible or email me a copy. Thanks in advance. :-)


					<<Jeff>>


-- 
+--------------------------------------------------------------------------+
| <<Jeff>>                          |     snsrjth@nmtsun.nmt.edu           |
|                                   |     {...unmvax!nmtsun!snsrjth}       |
+--------------------------------------------------------------------------+

readdm@walt.cc.utexas.edu (David M. Read) (06/09/90)

I have uuDEcode running on my PC clone just fine.  I'd like the source code to
uuENcode if anybody's got it.  Incidentally, the source code I have for 
uudecode has been fixed up to remove compiler warnings and errors, if anyone
wants it...ANSI standard and all.

Also, can anybody tell me what the scheme is for GIF files, or where to find 
the description of the scheme?

Thanks,
________________________________________________________________________________
  Dave Read:                      |  "[He's] stupid and he's ignorant but   
     read@mpx0.lampf.lanl.gov     |   he's got guts and guts is enough!"  
     read@physics.ph.utexas.edu   |                    -Full Metal Jacket 
     readdm@ccwf.cc.utexas.edu    |   Someone cares about MY opinions? HA!   
-------------------------------------------------------------------------------

azarian@hpcc01.HP.COM (Randy Azarian) (06/12/90)

> I have uuDEcode running on my PC clone just fine.  I'd like the source code to
> uuENcode if anybody's got it.  

/*
 * Copyright (c) 1983 Regents of the University of California.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * by the University of California, Berkeley.  The name of the
 * University may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/*
 * Modified 12 April 1990 by Mark Adler for use on MSDOS systems with
 * Microsoft C and Turbo C.
 */

#ifndef lint
static char sccsid[] = "@(#)uuencode.c	5.6 (Berkeley) 7/6/88";
#endif /* not lint */

#ifdef __MSDOS__        /* For Turbo C */
#define MSDOS 1
#endif

/*
 * uuencode [input] output
 *
 * Encode a file so it can be mailed to a remote system.
 */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

/* ENC is the basic 1 character encoding function to make a char printing */
#define ENC(c) ((c) ? ((c) & 077) + ' ': '`')

main(argc, argv)
char **argv;
{
	FILE *in;
	struct stat sbuf;
	int mode;

	/* optional 1st argument */
	if (argc > 2) {
#ifdef MSDOS
		if ((in = fopen(argv[1], "rb")) == NULL) {    /* Binary file */
#else
		if ((in = fopen(argv[1], "r")) == NULL) {
#endif
			perror(argv[1]);
			exit(1);
		}
		argv++; argc--;
	} else
		in = stdin;

	if (argc != 2) {
		fprintf(stderr,"Usage: uuencode [infile] remotefile\n");
		exit(2);
	}

	/* figure out the input file mode */
	if (fstat(fileno(in), &sbuf) < 0 || !isatty(fileno(in)))
		mode = 0666 & ~umask(0666);
	else
		mode = sbuf.st_mode & 0777;
	printf("begin %o %s\n", mode, argv[1]);

	encode(in, stdout);

	printf("end\n");
	exit(0);
}

/*
 * copy from in to out, encoding as you go along.
 */
encode(in, out)
register FILE *in;
register FILE *out;
{
	char buf[80];
	register int i, n;

	for (;;) {
		/* 1 (up to) 45 character line */
		n = fread(buf, 1, 45, in);
		putc(ENC(n), out);

		for (i=0; i<n; i += 3)
			outdec(&buf[i], out);

		putc('\n', out);
		if (n <= 0)
			break;
	}
}

/*
 * output one group of 3 bytes, pointed at by p, on file f.
 */
outdec(p, f)
register char *p;
register FILE *f;
{
	register int c1, c2, c3, c4;

	c1 = *p >> 2;
	c2 = (*p << 4) & 060 | (p[1] >> 4) & 017;
	c3 = (p[1] << 2) & 074 | (p[2] >> 6) & 03;
	c4 = p[2] & 077;
	putc(ENC(c1), f);
	putc(ENC(c2), f);
	putc(ENC(c3), f);
	putc(ENC(c4), f);
}

steve@uu.psi.com (Stephen A. Schoffstall) (11/15/90)

I seemed to have destroyed my UUENCODE software for the PC.  Could
someone UUENCODE it and mail it my way?  I still have a working UUDECODE.

Thanks

Steve