facility for sending/reading encrypted mail

Ed Carp erc at Apple.COM
Sat Jun 8 08:43:39 AEST 1991


Since there's been a lot of discussion on the net about the
privacy of mail, I decided to post a little hack I did about 3
years ago for sending encrypted mail using des(1).  I've updated
it a little - it not does compression/decompression on your
message, so the mailer doesn't have to work quite so hard...:)

This thing uses uudecode/uuencode, compress/zcat, and des (if you
don't have a version of des for your system, there's one floating
around on uunet in comp.sources.unix, I think.  I'm using Phil
Karn's excellent implementation posted to the net several years back.)

Sophisticated users/programmers will wonder why I didn't do
this in a shell script.  I wonder that, myself...:)  Mainly
so that casual users (whatever that means) won't poke around in
the guts and possibly work around it.  It could easily have
been done in a shell script.

Besides, I hate shell scripts! :)

Have fun with it -- I've gotten a lot of mileage out of it.  It's
particularly useful for talking about your boss/sysadmin behind
his/her/its back. :)

The code is pretty self-explanatory -- one thing you might want
to change is MAILCMD in sendmail.c - it's set for "mailx" at
the moment.

If there are potential employers/job shops/contractors/whatever
out there, don't look at this as an example of programming
style.  Just look at as just another one of those pesky tools
written by Mr. ToolCrafter himself.  :)
--------------------------  cut here  ---------------------------
#! /bin/sh
#
# Created by edshar, version 0.4 - 06/01/90
#
# This is a shell archive, meaning:
# 1. Remove everything about the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh to create:
#
#        length  name
#        ------  -------------------------------------
#           791  Makefile
#          1186  readsecret.1
#          1395  readsecret.c
#          1567  secretmail.1
#          4995  secretmail.c
#          3580  uudecode.c
#          1993  uuencode.c
#

#
# Archive number 1
# This archive created Fri Jun  7 16:34:43 1991
#

echo "shar: extracting Makefile - (791 characters)"
if test -f 'Makefile'
then
   echo shar: will not over-write existing file Makefile
else
sed 's/^X//' << \SHAR_EOF > 'Makefile'
XCFLAGS = -s -O
XSOURCES = readsecret.c secretmail.c uudecode.c uuencode.c 
XOBJECTS = readsecret.o secretmail.o uudecode.o uuencode.o 
XPROGRAMS = readsecret secretmail uudecode uuencode 
X
Xall: $(OBJECTS) $(PROGRAMS) 
X
Xreadsecret: readsecret.o
X	$(CC) $(CFLAGS) -o readsecret readsecret.o $(LDFLAGS) -O
X	chmod 755 readsecret
X
Xreadsecret.o: readsecret.c
X
Xsecretmail: secretmail.o
X	$(CC) $(CFLAGS) -o secretmail secretmail.o $(LDFLAGS) -O
X	chmod 755 secretmail
X
Xsecretmail.o: secretmail.c
X
Xuudecode: uudecode.o
X	$(CC) $(CFLAGS) -o uudecode uudecode.o $(LDFLAGS) -O
X	chmod 755 uudecode
X
Xuudecode.o: uudecode.c
X
Xuuencode: uuencode.o
X	$(CC) $(CFLAGS) -o uuencode uuencode.o $(LDFLAGS) -O
X	chmod 755 uuencode
X
Xuuencode.o: uuencode.c
X
Xclean:
X	rm -f $(OBJECTS)
X
Xclobber:
X	rm -f $(PROGRAMS) $(OBJECTS) 
X
SHAR_EOF
if test 791 -ne "`wc -c < 'Makefile'`"
then
   echo "shar: ***** error transmitting file Makefile (should have been 791 characters, but was "`wc -c < 'Makefile'`" characters) *****"
fi
fi

touch 0607160891 Makefile
chmod 0644 Makefile

echo "shar: extracting readsecret.1 - (1186 characters)"
if test -f 'readsecret.1'
then
   echo shar: will not over-write existing file readsecret.1
else
sed 's/^X//' << \SHAR_EOF > 'readsecret.1'
X.TH READSECRET 1L "June 7, 1991"
X.SH NAME
Xreadsecret \- read a secret mail message
X.SH SYNOPSIS
Xreadsecret
X.I file
X.SH DESCRIPTION
X.I readsecret
Xreads a secret mail message sent by
X.I secretmail(l).
X.PP
XTo read a secret mail message, the message itself must be saved in a
Xunique file.  Then
X.I readsecret
Xis called to uudecode, uncompress and decrypt the secret mail message.
XFinally, the
Xfile may be deleted.  For example, if a secret mail message has been saved
Xin a file called
X.I oneshot,
Xthe command
X.PP
Xreadsecret oneshot
X.PP
Xwould display the secret message (after asking for a password).  After
Xthe message has been read, the file
X.I oneshot
Xmay be deleted.
X.SH FILES
Xsecret.let	work file
X.SH CREDITS
XThis utility was written by Edwin R. Carp.
X.SH BUGS
XThe non-EDITOR interface to mail is not the best in the world.
X.PP
XThere is no way to indicate to the user that an incorrect password
Xhas been entered.
X.PP
XThe file is read in as "./secret.let".  This can be disruptive to other
Xfiles in the current directory called "secret.let".
X.PP
XThe current version of
X.I readsecret(1)
Xand
X.I secretmail(1)
Xis not compatible with previous versions.
X.SH SEE ALSO
X.I
Xdes(1), secretmail(1)
SHAR_EOF
if test 1186 -ne "`wc -c < 'readsecret.1'`"
then
   echo "shar: ***** error transmitting file readsecret.1 (should have been 1186 characters, but was "`wc -c < 'readsecret.1'`" characters) *****"
fi
fi

touch 0607162591 readsecret.1
chmod 0644 readsecret.1

echo "shar: extracting readsecret.c - (1395 characters)"
if test -f 'readsecret.c'
then
   echo shar: will not over-write existing file readsecret.c
else
sed 's/^X//' << \SHAR_EOF > 'readsecret.c'
X/*
X*
X* readsecret - read secret messages sent by secretmail
X*
X* usage:  readsecret file
X*
X* assumes that you've used mail(1) to save away the encrypted mail in a file
X*
X* REQUIRES:  decrypt uudecode  in /usr/local/bin
X*
X*
X* Written 01/24/88 by Edwin R. Carp
X*
X* Version     Date     Comments
X*
X*   0.2     01/25/88   Do an fflush(stdin) before getting password
X*                      Do not allow blank passwords
X*
X*   0.3     03/16/88   Added DES encryption for BSD systems
X*
X*   0.4     03/30/88   Changed to allow DES encryption for ALL systems
X*
X*   0.5     06/07/91   Added decompression
X*
X*/
Xstatic char *reds_vers = "readsecret version 0.5  06/07/91";
Xstatic char *reds_cpyw = "Copyright 1988, by Edwin R. Carp";
X
X#include <stdio.h>
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X   char password[128], *getpass();
X   char work[128];
X
X   if(argc != 2)
X   {
X      printf("usage:  readsecret file\n");
X      exit(1);
X   }
X   sprintf(work, "uudecode %s", argv[1]);
X   system(work);
X   password[0] = NULL;
X   if(access("secret.let", 4) != NULL)
X   {
X      perror("secret.let");
X      exit(1);
X   }
X   /* while(0 == strlen(password)) */
X      /* strcpy(password, getpass("Password: ")); */
X   /* sprintf(work, */
X       /* "/usr/local/bin/decrypt %s <secret.let | more -c", password); */
X   sprintf(work, "des -d secret.let | zcat | more -c;stty echo");
X   system(work);
X   unlink("secret.let");
X}
SHAR_EOF
if test 1395 -ne "`wc -c < 'readsecret.c'`"
then
   echo "shar: ***** error transmitting file readsecret.c (should have been 1395 characters, but was "`wc -c < 'readsecret.c'`" characters) *****"
fi
fi

touch 0607161591 readsecret.c
chmod 0644 readsecret.c

echo "shar: extracting secretmail.1 - (1567 characters)"
if test -f 'secretmail.1'
then
   echo shar: will not over-write existing file secretmail.1
else
sed 's/^X//' << \SHAR_EOF > 'secretmail.1'
X.TH SECRETMAIL 1 "June 7, 1991"
X.SH NAME
Xsecretmail \- send mail via secure communications channel
X.SH SYNOPSIS
Xsecretmail [
X.I -puyr
X] [
X.I -s subject
X]
X.I user(s)
X.SH DESCRIPTION
X.I secretmail
Ximplements a secure communications conduit for
X.I mail(1)
Xusing the standard DES algorithm.  It is primarily useful
Xfor sending confidential information that need not be readable by
Xa priviliged user.  Only the user for which the mail is intended
X(has the password) may read the mail.
X.PP
X.I secretmail
Xprompts for the subject of the message, then runs
Xwhatever editor is set up in the environment variable EDITOR.
XIf EDITOR is not set, then
X.I secretmail
Xuses a mail-like interface.
XAfter ending input with a control-D, the screen is scrolled up 25 lines
Xand the user is prompted for a password (or key).  The mail is then
Xcompressed, encrypted, uuencoded, and sent.
X.SH OPTIONS
X.IP r
XThis option is used to send routine mail, and is the default.
X.IP u
XThis option is used to send urgent mail to be read as soon as possible.
X.IP p
XThis options is used to send mail of the highest priority (to be read
Ximmediately).
X.IP y
XThis options is used to send mail that is intended to be read by the
Xrecepient only.
X.SH BUGS
XThe file is sent out as a uuencoded file and decrypted as "./secret.let".
XThis can be disruptive to any files called "secret.let" in the current
Xdirectory.
X.PP
XThe current version of
X.I readsecret(1)
Xand
X.I secretmail(1)
Xis not compatible with previous versions.
X.SH CREDITS
XThis utility was written by Edwin R. Carp.
X.SH SEE ALSO
X.I
Xdes(1), readsecret(1)
SHAR_EOF
if test 1567 -ne "`wc -c < 'secretmail.1'`"
then
   echo "shar: ***** error transmitting file secretmail.1 (should have been 1567 characters, but was "`wc -c < 'secretmail.1'`" characters) *****"
fi
fi

touch 0607162691 secretmail.1
chmod 0644 secretmail.1

echo "shar: extracting secretmail.c - (4995 characters)"
if test -f 'secretmail.c'
then
   echo shar: will not over-write existing file secretmail.c
else
sed 's/^X//' << \SHAR_EOF > 'secretmail.c'
X/*
X*
X* secretmail - implement a secure communications channel
X*
X* usage:  secretmail  [-puyr] [-s subject] user(s)...
X*
X*         -p - priority one message
X*         -u - urgent message
X*         -y - eyes-only (sensitive contents)
X*         -r - routine message (default)
X*
X* uses env variable EDITOR to edit file
X* if EDITOR not present in env, uses gets() calls to get message
X*
X* REQUIRES:  encrypt uuencode  in /usr/local/bin
X*
X* assumes your mail supports the "-s" option
X*
X*
X* Written 01/24/88 by Edwin R. Carp
X*
X* Version     Date     Comments
X*
X*   0.2     01/25/88   Did an fflush(stdin) before asking for password
X*                      Don't allow blank passwords
X*
X*   0.3     03/01/88   Fixed bugs.
X*
X*   0.4     03/03/88   scrolled screen to blank it before entering password
X*
X*   0.5     03/04/88   Added a >From line
X*
X*   0.6     03/16/88   Added DES encryption for BSD systems
X*
X*   0.7     03/30/88   Added DES encryption for ALL systems
X*
X*   0.8     05/14/88   Added P, U, Y, S options
X*
X*   0.9     06/07/91   Added compression
X*
X*/
Xstatic char *secm_vers = "secretmail version 0.9  06/07/91";
Xstatic char *secm_cpyw = "Copyright 1988, by Edwin R. Carp";
X
X#include <stdio.h>
X#ifdef BSD
X#define MAILCMD "/usr/ucb/mail"
X#else
X#define MAILCMD "/usr/bin/mailx"
X#endif
X
Xextern char *optarg;
Xextern int optind;
X
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X   char user[128], password[128], *ctime(), *getenv(), *getpass();
X   char line[130], *editor, work[128], tolist[512], *getlogin();
X   char subject[128], filename[15], filename2[15], precedence[70];
X   FILE *tempfile;
X   int i;
X   int rflag=1, pflag=0, uflag=0, sflag=0, yflag=0;
X   long secs;
X
X   if(argc < 2)
X   {
X      printf("usage:  secretmail [-puyr] [-s subject] user(s)...\n");
X      exit(1);
X   }
X   while((i=getopt(argc, argv, "puyrs:")) != EOF)
X   {
X      switch(i)
X      {
X      case 'p':
X         uflag = rflag = 0;
X         pflag = 1;
X         break;
X
X      case 'u':
X         pflag = rflag = 0;
X         uflag = 1;
X         break;
X
X      case 'y':
X         yflag = 1;
X         break;
X
X      case 'r':
X         rflag = 1;
X         uflag = pflag = 0;
X         break;
X
X      case 's':
X         sflag = 1;
X         strcpy(subject, optarg);
X         break;
X      }
X   }
X
X      if(pflag == 1)
X         strcpy(precedence, "PRIORITY ONE MESSAGE - READ IMMEDIATELY");
X      if(uflag == 1)
X         strcpy(precedence, "Urgent Message - Read ASAP");
X      if(rflag == 1)
X         strcpy(precedence, "Routine Message");
X      if(yflag == 1)
X         strcat(precedence, " - For Your Eyes Only");
X   sprintf(filename,  "%s%d.tmp", "secm", getpid());
X   sprintf(filename2, "%s%d.tmp", "sect", getpid());
X   if((tempfile=fopen(filename, "w")) == (FILE *)NULL)
X   {
X      perror(filename);
X      exit(1);
X   }
X   tolist[0] = NULL;
X   for(i=optind; i<argc; i++)
X   {
X      strcat(tolist, argv[i]);
X      strcat(tolist, " ");
X   }
X   editor = getenv("EDITOR");
X   /* get message, either from keyboard or from editing tempfile */
X   if(editor == (char *)NULL)
X   /* editor = "vi"; */
X   {
X      printf("From:     ");
X      printf(getlogin());
X      printf("\nTo:       ");
X      printf(tolist);
X      printf("\nDate:     ");
X      time(&secs);
X      printf(ctime(&secs));
X      fprintf(tempfile, "From:     ");
X      fprintf(tempfile, getlogin());
X      fprintf(tempfile, "\nTo:       ");
X      fprintf(tempfile, tolist);
X      fprintf(tempfile, "\nDate:     ");
X      fprintf(tempfile, ctime(&secs));
X      fprintf(tempfile, "\nSubject:  ");
X      printf("\nSubject:  ");
X      if(sflag == 0) gets(subject);
X      else puts(subject);
X      fprintf(tempfile, " (%s)\n\n", subject);
X      while(fgets(line, 128, stdin) != (char *)NULL)
X         fprintf(tempfile, line);
X      fclose(tempfile);
X   }
X   else
X   {
X      fprintf(tempfile, "From:     ");
X      fprintf(tempfile, getlogin());
X      fprintf(tempfile, "\nTo:       ");
X      fprintf(tempfile, tolist);
X      fprintf(tempfile, "\nDate:     ");
X      time(&secs);
X      fprintf(tempfile, ctime(&secs));
X      fprintf(tempfile, "\nSubject:  ");
X      printf("\nSubject:  ");
X      if(sflag == 0) gets(subject);
X      else puts(subject);
X      fprintf(tempfile, "%s (%s)\n\n", precedence, subject);
X      fclose(tempfile);
X      sprintf(work, "%s %s", editor, filename);
X      printf("Calling editor - please wait\n");
X      system(work);
X   }
X   for(i=0; i<30; i++) puts("\n");
X   /* message is now in the tempfile.  now pipe it to des */
X   sprintf(work, "compress -f %s;mv %s.Z %s;des -e %s %s;stty echo",
X      filename, filename, filename, filename, filename2);
X   printf("Encrypting file...\n");
X   system(work);
X   unlink(filename); /* delete the original file */
X#ifndef MSDOS
X   chmod(filename2, 0666);
X#endif
X   /* uuencode it and pipe it to mail */
X   sprintf(work,
X       "uuencode %s secret.let | %s -s \"%s (%s)\" %s",
X       filename2, MAILCMD, precedence, subject, tolist);
X   printf("Mailing encrypted file...\n");
X   system(work);
X   unlink(filename2);
X}
SHAR_EOF
if test 4995 -ne "`wc -c < 'secretmail.c'`"
then
   echo "shar: ***** error transmitting file secretmail.c (should have been 4995 characters, but was "`wc -c < 'secretmail.c'`" characters) *****"
fi
fi

touch 0607161891 secretmail.c
chmod 0644 secretmail.c

echo "shar: extracting uudecode.c - (3580 characters)"
if test -f 'uudecode.c'
then
   echo shar: will not over-write existing file uudecode.c
else
sed 's/^X//' << \SHAR_EOF > 'uudecode.c'
X#ifndef lint
Xstatic char sccsid[] = "@(#)uudecode.c   5.1 (Berkeley) 7/2/83";
X#endif
X
X/*
X * uudecode [input]
X *
X * create the specified file, decoding as you go.
X * used with uuencode.
X */
X#include <stdio.h>
X#ifndef MSDOS
X#include <pwd.h>
X#endif
X#include <sys/types.h>
X#include <sys/stat.h>
X#ifdef MSDOS
X#include <fcntl.h>
X#endif
X
X/* single character decode */
X#define DEC(c)   (((c) - ' ') & 077)
X
Xmain(argc, argv)
Xchar **argv;
X{
X   FILE *in, *out;
X   struct stat sbuf;
X   int mode;
X   char dest[128];
X   char buf[80];
X
X   /* optional input arg */
X   if (argc > 1) {
X      if ((in = fopen(argv[1], "r")) == NULL) {
X         perror(argv[1]);
X         exit(1);
X      }
X      argv++; 
X      argc--;
X   } else
X      in = stdin;
X
X   if (argc != 1) {
X      printf("Usage: uudecode [infile]\n");
X      exit(2);
X   }
X
X   /* search for header line */
X   for (;;) {
X      if (fgets(buf, sizeof buf, in) == NULL) {
X         fprintf(stderr, "No begin line\n");
X         exit(3);
X      }
X      if (strncmp(buf, "begin ", 6) == 0)
X         break;
X   }
X   sscanf(buf, "begin %o %s", &mode, dest);
X   fprintf(stderr, "begin %o %s\n", mode, dest);
X
X#ifndef MSDOS
X   /* handle ~user/file format */
X   if (dest[0] == '~') {
X      char *sl;
X      struct passwd *getpwnam();
X      char *index();
X      struct passwd *user;
X      char dnbuf[100];
X
X      sl = index(dest, '/');
X      if (sl == NULL) {
X         fprintf(stderr, "Illegal ~user\n");
X         exit(3);
X      }
X      *sl++ = 0;
X      user = getpwnam(dest+1);
X      if (user == NULL) {
X         fprintf(stderr, "No such user as %s\n", dest);
X         exit(4);
X      }
X      strcpy(dnbuf, user->pw_dir);
X      strcat(dnbuf, "/");
X      strcat(dnbuf, sl);
X      strcpy(dest, dnbuf);
X   }
X#endif
X
X   /* create output file */
X   out = fopen(dest, "w");
X   if (out == NULL) {
X      perror(dest);
X      exit(4);
X   }
X#ifdef MSDOS
Xif(EOF == setmode(fileno(out), O_BINARY)) perror("output file");
X#endif
X   chmod(dest, mode);
X
X   decode(in, out);
X
X   if (fgets(buf, sizeof buf, in) == NULL || strcmp(buf, "end\n")) {
X      fprintf(stderr, "No end line\n");
X      exit(5);
X   }
X   exit(0);
X}
X
X/*
X * copy from in to out, decoding as you go along.
X */
Xdecode(in, out)
XFILE *in;
XFILE *out;
X{
X   char buf[80];
X   char *bp;
X   int n;
X
X   for (;;) {
X      /* for each input line */
X      if (fgets(buf, sizeof buf, in) == NULL) {
X         printf("Short file\n");
X         exit(10);
X      }
X      n = DEC(buf[0]);
X      if (n <= 0)
X         break;
X
X      bp = &buf[1];
X      while (n > 0) {
X         outdec(bp, out, n);
X         bp += 4;
X         n -= 3;
X      }
X   }
X}
X
X/*
X * output a group of 3 bytes (4 input characters).
X * the input chars are pointed to by p, they are to
X * be output to file f.  n is used to tell us not to
X * output all of them at the end of the file.
X */
Xoutdec(p, f, n)
Xchar *p;
XFILE *f;
X{
X   int c1, c2, c3;
X
X   c1 = DEC(*p) << 2 | DEC(p[1]) >> 4;
X   c2 = DEC(p[1]) << 4 | DEC(p[2]) >> 2;
X   c3 = DEC(p[2]) << 6 | DEC(p[3]);
X   if (n >= 1)
X      putc(c1, f);
X   if (n >= 2)
X      putc(c2, f);
X   if (n >= 3)
X      putc(c3, f);
X}
X
X
X/* fr: like read but stdio */
Xint
Xfr(fd, buf, cnt)
XFILE *fd;
Xchar *buf;
Xint cnt;
X{
X   int c, i;
X
X   for (i=0; i<cnt; i++) {
X      c = getc(fd);
X      if (c == EOF)
X         return(i);
X      buf[i] = c;
X   }
X   return (cnt);
X}
X
X/*
X * Return the ptr in sp at which the character c appears;
X * NULL if not found
X */
X
X#ifdef NULL
X#undef NULL
X#endif
X
X#define   NULL   0
X
Xchar *
Xindex(sp, c)
Xregister char *sp, c;
X{
X   do {
X      if (*sp == c)
X         return(sp);
X   } while (*sp++);
X   return(NULL);
X}
X
SHAR_EOF
if test 3580 -ne "`wc -c < 'uudecode.c'`"
then
   echo "shar: ***** error transmitting file uudecode.c (should have been 3580 characters, but was "`wc -c < 'uudecode.c'`" characters) *****"
fi
fi

touch 0301144488 uudecode.c
chmod 0644 uudecode.c

echo "shar: extracting uuencode.c - (1993 characters)"
if test -f 'uuencode.c'
then
   echo shar: will not over-write existing file uuencode.c
else
sed 's/^X//' << \SHAR_EOF > 'uuencode.c'
X#ifndef lint
Xstatic char sccsid[] = "@(#)uuencode.c   5.1 (Berkeley) 7/2/83";
X#endif
X
X/*
X * uuencode [input] output
X *
X * Encode a file so it can be mailed to a remote system.
X */
X#include <stdio.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#ifdef MSDOS
X#include <fcntl.h>
X#endif
X
X/* ENC is the basic 1 character encoding function to make a char printing */
X#define ENC(c) (((c) & 077) + ' ')
X
Xmain(argc, argv)
Xchar **argv;
X{
X   FILE *in;
X   struct stat sbuf;
X   int mode;
X
X   /* optional 1st argument */
X   if (argc > 2) {
X      if ((in = fopen(argv[1], "r")) == NULL) {
X         perror(argv[1]);
X         exit(1);
X      }
X      argv++; 
X      argc--;
X   } else
X      in = stdin;
X
X   if (argc != 2) {
X      printf("Usage: uuencode [infile] remotefile\n");
X      exit(2);
X   }
X
X#ifdef MSDOS
Xif(EOF == setmode(fileno(in), O_BINARY)) perror("input file");
X#endif
X   /* figure out the input file mode */
X   fstat(fileno(in), &sbuf);
X   mode = sbuf.st_mode & 0777;
X   printf("begin %o %s\n", mode, argv[1]);
X
X   encode(in, stdout);
X
X   printf("end\n");
X   exit(0);
X}
X
X/*
X * copy from in to out, encoding as you go along.
X */
Xencode(in, out)
XFILE *in;
XFILE *out;
X{
X   char buf[80];
X   int i, n;
X
X   for (;;) {
X      /* 1 (up to) 45 character line */
X      n = fr(in, buf, 45);
X      putc(ENC(n), out);
X
X      for (i=0; i<n; i += 3)
X         outdec(&buf[i], out);
X
X      putc('\n', out);
X      if (n <= 0)
X         break;
X   }
X}
X
X/*
X * output one group of 3 bytes, pointed at by p, on file f.
X */
Xoutdec(p, f)
Xchar *p;
XFILE *f;
X{
X   int c1, c2, c3, c4;
X
X   c1 = *p >> 2;
X   c2 = (*p << 4) & 060 | (p[1] >> 4) & 017;
X   c3 = (p[1] << 2) & 074 | (p[2] >> 6) & 03;
X   c4 = p[2] & 077;
X   putc(ENC(c1), f);
X   putc(ENC(c2), f);
X   putc(ENC(c3), f);
X   putc(ENC(c4), f);
X}
X
X/* fr: like read but stdio */
Xint
Xfr(fd, buf, cnt)
XFILE *fd;
Xchar *buf;
Xint cnt;
X{
X   int c, i;
X
X   for (i=0; i<cnt; i++) {
X      c = getc(fd);
X      if (c == EOF)
X         return(i);
X      buf[i] = c;
X   }
X   return (cnt);
X}
X
SHAR_EOF
if test 1993 -ne "`wc -c < 'uuencode.c'`"
then
   echo "shar: ***** error transmitting file uuencode.c (should have been 1993 characters, but was "`wc -c < 'uuencode.c'`" characters) *****"
fi
fi

touch 0218202788 uuencode.c
chmod 0644 uuencode.c
echo End of all shell archives
exit 0
--
Ed Carp  N7EKG/6	erc at khijol.UUCP		...uunet!khijol!erc
Packet:  N7EKG @ N6IIU.#NOCAL.CA.US
UUWEST Consulting	Alameda, CA		415/814-0550

Computers HAVE caused a revolution in how much information we
can safely ignore!    --robs at ux1.cso.uiuc.edu (Rob Schaeffer)

-- Absolutely unabashed Gates McFadden groupie! --
-- 
Ed Carp  N7EKG/6	erc at khijol.UUCP		...uunet!khijol!erc
Packet:  N7EKG @ N6IIU.#NOCAL.CA.US
UUWEST Consulting	Alameda, CA		415/814-0550

Computers HAVE caused a revolution in how much information we
can safely ignore!    --robs at ux1.cso.uiuc.edu (Rob Schaeffer)

-- Absolutely unabashed Gates McFadden groupie! --



More information about the Alt.sources mailing list