[alt.sources] kit 2.0, Part 01/02

craig@weedeater.math.yale.edu (Craig Kolb) (03/02/91)

I'm posting the 'kit' distribution on behalf of Raphael, who is in
the process of moving to California.  Raphael has submitted this
distribution to comp.sources.unix.

Direct questions/comments/etc. to Raphael.  While the address listed
in the README should work, Raphael says:

> Past February 27th and until March 9th, you may contact me at the
> following address:
>
>        ram@eiffel.fr (This is in FRANCE)
>
> Then, directly to:
>
>        ram@eiffel.com (This is in the STATES)

Craig

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 2)."
# Contents:  MANIFEST Makefile.SH PACKLIST README btoa/Makefile.SH
#   btoa/atob.c btoa/btoa.c btoa/hexdecode.c btoa/hexencode.c
#   config.h.SH install.SH kit/Makefile.SH kit/kit.SH kit/mailkit.SH
#   kit/unkit.SH man/Makefile.SH man/atob.SH man/btoa.SH man/kit.SH
#   man/mailkit.SH man/unkit.SH patchlevel.h
# Wrapped by craig@weedeater on Fri Mar  1 13:38:53 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(1085 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
XREADME                     Read it
XMANIFEST                   This shipping list
XConfigure                  Portability tool
XMakefile.SH                Main makefile
Xbtoa/Makefile.SH           Makefile for btoa and al.
Xbtoa/atob.c                For ascii to binary decoding
Xbtoa/btoa.c                For binary to ascii encoding
Xbtoa/hexdecode.c           Hex-decoding
Xbtoa/hexencode.c           Hex-encoding
Xconfig.h.SH                Currently unused
Xinstall.SH                 BSD-like installation script
Xkit/Makefile.SH            Makefile for scripts
Xkit/kit.SH                 The main script-shell
Xkit/mailkit.SH             Mails parts generated by "kit"
Xkit/unkit.SH               Reversal of "kit"
Xman/Makefile.SH            Makefile for manual pages
Xman/atob.SH                Manual page for "atob"
Xman/btoa.SH                Manual page for atob/btoa
Xman/kit.SH                 The manual page for "kit"
Xman/mailkit.SH             The manual page for "mailkit"
Xman/unkit.SH               The manual page for "unkit"
Xpatchlevel.h               Current patch level value
END_OF_FILE
if test 1085 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile.SH'\"
else
echo shar: Extracting \"'Makefile.SH'\" \(1067 characters\)
sed "s/^X//" >'Makefile.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X	if test ! -f config.sh; then
X		ln ../config.sh . || \
X		ln ../../config.sh . || \
X		ln ../../../config.sh . || \
X		(echo "Can't find config.sh."; exit 1)
X	fi
X	. config.sh
X	;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting Makefile (with variable substitutions)"
X$spitshell >Makefile <<!GROK!THIS!
X#
X#	Makefile for mailagent
X#
X
X# $Id: Makefile.SH,v 2.0 91/02/19 15:48:41 ram Exp $
X#
X# $Log:	Makefile.SH,v $
X# Revision 2.0  91/02/19  15:48:41  ram
X# Baseline for first official release.
X# 
X
XSHELL = /bin/sh
X
XTARGETS = all install clean realclean
XSUBDIRS = btoa kit man
XRM = $rm
X!GROK!THIS!
X$spitshell >>Makefile <<'!NO!SUBS!'
X
X#
X#	Building rules
X#
X
X$(TARGETS): makefiles
X	$(MAKE) $(SUBDIRS) TARGET=$@
X
X.force:
X
X$(SUBDIRS): .force
X	cd $@; $(MAKE) $(TARGET)
X
Xmakefiles:
X	-@for dir in $(SUBDIRS); do \
X		(cd $$dir && if test ! -f Makefile; then \
X			sh Makefile.SH; fi) \
X	done
X
Xclobber: makefiles
X	$(MAKE) $(SUBDIRS) TARGET=$@
X	$(RM) -f config.h config.sh Makefile install
X!NO!SUBS!
Xchmod 755 Makefile
X$eunicefix Makefile
END_OF_FILE
if test 1067 -ne `wc -c <'Makefile.SH'`; then
    echo shar: \"'Makefile.SH'\" unpacked with wrong size!
fi
# end of 'Makefile.SH'
fi
if test -f 'PACKLIST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'PACKLIST'\"
else
echo shar: Extracting \"'PACKLIST'\" \(1310 characters\)
sed "s/^X//" >'PACKLIST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X Configure                  2	Portability tool
X MANIFEST                   1	This shipping list
X Makefile.SH                1	Main makefile
X PACKLIST                   1	Which files came with which kits
X README                     1	Read it
X btoa/Makefile.SH           1	Makefile for btoa and al.
X btoa/atob.c                1	For ascii to binary decoding
X btoa/btoa.c                1	For binary to ascii encoding
X btoa/hexdecode.c           1	Hex-decoding
X btoa/hexencode.c           1	Hex-encoding
X config.h.SH                1	Currently unused
X install.SH                 1	BSD-like installation script
X kit/Makefile.SH            1	Makefile for scripts
X kit/kit.SH                 1	The main script-shell
X kit/mailkit.SH             1	Mails parts generated by "kit"
X kit/unkit.SH               1	Reversal of "kit"
X man/Makefile.SH            1	Makefile for manual pages
X man/atob.SH                1	Manual page for "atob"
X man/btoa.SH                1	Manual page for atob/btoa
X man/kit.SH                 1	The manual page for "kit"
X man/mailkit.SH             1	The manual page for "mailkit"
X man/unkit.SH               1	The manual page for "unkit"
X patchlevel.h               1	Current patch level value
END_OF_FILE
if test 1310 -ne `wc -c <'PACKLIST'`; then
    echo shar: \"'PACKLIST'\" unpacked with wrong size!
fi
# end of 'PACKLIST'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(2283 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X                             kit 2.0
X
X             Copyright (c) 1990 1991, Raphael Manfredi
X
XYou may copy this kit in whole or in part as long as you don't try to
Xmake money off it, or pretend you wrote it.
X------------------------------------------------------------------------
XThe ultimate mailing kit -- Assumes you own cshar (written by Rich Salz)
X
XPlease read all the directions below before you proceed any further, and
Xthen follow them carefully.
X
XAfter you have unpacked your kit, you should have all the files listed
Xin MANIFEST.
X
XIn order to use kit, you need to install CSHAR in your PATH (programs
Xneeded are shar, makekit and unshar). Compress must be available. If you
Xmiss one of those, send me a mail: ram@educ.emse.fr (Raphael Manfredi).
X
XMoreover, hexdecode, hexencode, atob and btoa must be installed.
X
XINSTALLATION
X
X1) Run Configure. This will figure out various things about your
Xsystem. After it has been completed, it will produce config.h and
Xconfig.sh.
X
XYou might have to trim # comments from the front of Configure if your
Xshell doesn't handle them, but any other comments will be taken care of.
X
X2) Run make.
X
X3) If make succeeded, you may wish to do make install. Be sure your
Xrights are correct (if you install manual pages, you may need
Xsuper-user privileges).
X
X4) Read the manual entries before running.
X
X5) IMPORTANT! Communicate any problem and suggested patches to
Xme, ram@educ.emse.fr (Raphael Manfredi), so we can keep this
Xdistribution in sync. If you have a problem, there will be someone
Xwho might have had it or will have it too.
X
XIf possible, send me patches such that the patch programm will
Xapply them. Context diffs are the best, then normal diffs. Do not
Xsend ed scripts: I have probably changed my copy since the version
Xyou got.
X
X6) After everything is installed, you can do "make clobber". This will
Xclean up everything and let you re-distribute this kit, without
Xcarrying useless files. You should keep this distribution intact, so
Xthat future patches will be applyable.
X
X7) I have an automatic patch sender. Send me a mail of the following
Xform:
X
X	Subject: Command
X	@SH mailhelp PATH
X
Xand you will get instructions about how to use it. PATH stands for
XYOUR e-mail address, either in INTERNET form or in bang notation.
X
X	-- Raphael
END_OF_FILE
if test 2283 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'btoa/Makefile.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'btoa/Makefile.SH'\"
else
echo shar: Extracting \"'btoa/Makefile.SH'\" \(966 characters\)
sed "s/^X//" >'btoa/Makefile.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting btoa/Makefile (with variable substitutions)"
X$spitshell >Makefile <<!GROK!THIS!
X#
X# Makefile for kit (sub-directory btoa)
X#
X
X# $Id: Makefile.SH,v 2.0 91/02/19 15:49:16 ram Exp $
X#
X# $Log:	Makefile.SH,v $
X# Revision 2.0  91/02/19  15:49:16  ram
X# Baseline for first official release.
X# 
X
XSHELL = /bin/sh
X
XCC = $cc
XCFLAGS = $ccflags $optimize
XRM = $rm
Xbin = $bin
X
X!GROK!THIS!
X$spitshell >>Makefile <<'!NO!SUBS!'
XBIN = btoa atob hexencode hexdecode
X
Xall: $(BIN)
X
Xinstall: $(BIN)
X	-for file in $(BIN); do \
X		../install -s -m 755 $$file $(bin); \
X	done
X
Xclean:
X	$(RM) -f *.o $(BIN)
X
Xrealclean clobber: clean
X	$(RM) -f core Makefile config.sh
X!NO!SUBS!
Xchmod 644 Makefile
X$eunicefix Makefile
END_OF_FILE
if test 966 -ne `wc -c <'btoa/Makefile.SH'`; then
    echo shar: \"'btoa/Makefile.SH'\" unpacked with wrong size!
fi
# end of 'btoa/Makefile.SH'
fi
if test -f 'btoa/atob.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'btoa/atob.c'\"
else
echo shar: Extracting \"'btoa/atob.c'\" \(3277 characters\)
sed "s/^X//" >'btoa/atob.c' <<'END_OF_FILE'
X/*
X
X   ##     #####   ####   #####            ####
X  #  #      #    #    #  #    #          #    #
X #    #     #    #    #  #####           #
X ######     #    #    #  #    #   ###    #
X #    #     #    #    #  #    #   ###    #    #
X #    #     #     ####   #####    ###     ####
X
X	stream filter to change printable ascii from "btoa" back into
X	8 bit bytes if bad chars, or Csums do not match: exit(1)
X	[and NO output]
X
X	Paul Rutter Joe Orost
X
X	Raphael Manfredi (ram) modified this file, in order to produce
X	meaningfull error messages (otherwise, fatal() was called, even
X	when a temporary file could not be created...); added error()
X*/
X
X/*
X * $Id: atob.c,v 2.0 91/02/19 15:49:21 ram Exp $
X *
X * $Log:	atob.c,v $
X * Revision 2.0  91/02/19  15:49:21  ram
X * Baseline for first official release.
X * 
X */
X
X#include <stdio.h>
X
X#define reg register
X
X#define streq(s0, s1)  strcmp(s0, s1) == 0
X
X#define times85(x)	((((((x<<2)+x)<<2)+x)<<2)+x)
X
Xlong int Ceor = 0;
Xlong int Csum = 0;
Xlong int Crot = 0;
Xlong int word = 0;
Xlong int bcount = 0;
X
Xfatal() {
X  fprintf(stderr, "bad format or Csum to atob\n");
X  exit(1);
X}
X
Xerror(s)
Xchar *s;	/* the error message */
X{
X  fprintf(stderr, "%s\n", s);
X  exit(1);
X}
X
X#define DE(c) ((c) - '!')
X
Xdecode(c) reg c;
X{
X  if (c == 'z') {
X    if (bcount != 0) {
X      fatal();
X    } 
X    else {
X      byteout(0);
X      byteout(0);
X      byteout(0);
X      byteout(0);
X    }
X  } 
X  else if ((c >= '!') && (c < ('!' + 85))) {
X    if (bcount == 0) {
X      word = DE(c);
X      ++bcount;
X    } 
X    else if (bcount < 4) {
X      word = times85(word);
X      word += DE(c);
X      ++bcount;
X    } 
X    else {
X      word = times85(word) + DE(c);
X      byteout((int)((word >> 24) & 255));
X      byteout((int)((word >> 16) & 255));
X      byteout((int)((word >> 8) & 255));
X      byteout((int)(word & 255));
X      word = 0;
X      bcount = 0;
X    }
X  } 
X  else {
X    fatal();
X  }
X}
X
XFILE *tmp_file;
X
Xbyteout(c) reg c;
X{
X  Ceor ^= c;
X  Csum += c;
X  Csum += 1;
X  if ((Crot & 0x80000000)) {
X    Crot <<= 1;
X    Crot += 1;
X  } 
X  else {
X    Crot <<= 1;
X  }
X  Crot += c;
X  putc(c, tmp_file);
X}
X
Xmain(argc, argv) char **argv;
X{
X  reg c;
X  reg long int i;
X  char tmp_name[100];
X  char buf[100];
X  long int n1, n2, oeor, osum, orot;
X
X  if (argc != 1) {
X    fprintf(stderr,"bad args to %s\n", argv[0]);
X    exit(2);
X  }
X  sprintf(tmp_name, "/usr/tmp/atob.%x", getpid());
X  tmp_file = fopen(tmp_name, "w+");
X  if (tmp_file == NULL) {
X    error("can't create temporary file");
X  }
X  unlink(tmp_name); /* Make file disappear */
X  /*search for header line*/
X  for (;;) {
X    if (fgets(buf, sizeof buf, stdin) == NULL) {
X      error("could not read header line");
X    }
X    if (streq(buf, "xbtoa Begin\n")) {
X      break;
X    }
X  }
X
X  while ((c = getchar()) != EOF) {
X    if (c == '\n') {
X      continue;
X    } 
X    else if (c == 'x') {
X      break;
X    } 
X    else {
X      decode(c);
X    }
X  }
X  if (scanf("btoa End N %ld %lx E %lx S %lx R %lx\n", &n1, &n2, &oeor, &osum, &orot) != 5) {
X    error("could not read check sum");
X  }
X  if ((n1 != n2) || (oeor != Ceor) || (osum != Csum) || (orot != Crot)) {
X    fatal();
X  } 
X  else {
X    /*copy OK tmp file to stdout*/;
X    fseek(tmp_file, 0L, 0);
X    for (i = n1; --i >= 0;) {
X      putchar(getc(tmp_file));
X    }
X  }
X  exit(0);
X}
END_OF_FILE
if test 3277 -ne `wc -c <'btoa/atob.c'`; then
    echo shar: \"'btoa/atob.c'\" unpacked with wrong size!
fi
# end of 'btoa/atob.c'
fi
if test -f 'btoa/btoa.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'btoa/btoa.c'\"
else
echo shar: Extracting \"'btoa/btoa.c'\" \(2696 characters\)
sed "s/^X//" >'btoa/btoa.c' <<'END_OF_FILE'
X/*
X
X #####    #####   ####     ##             ####
X #    #     #    #    #   #  #           #    #
X #####      #    #    #  #    #          #
X #    #     #    #    #  ######   ###    #
X #    #     #    #    #  #    #   ###    #    #
X #####      #     ####   #    #   ###     ####
X
X	btoa: version 4.0
X	stream filter to change 8 bit bytes into printable ascii
X	computes the number of bytes, and three kinds of simple checksums
X	incoming bytes are collected into 32-bit words, then printed in
X	base 85 exp(85,5) > exp(2,32)
X	the ASCII characters used are between '!' and 'u'
X	'z' encodes 32-bit zero; 'x' is used to mark the end of encoded data.
X
X	Paul Rutter Joe Orost
X*/
X
X/*
X * $Id: btoa.c,v 2.0 91/02/19 15:49:25 ram Exp $
X *
X * $Log:	btoa.c,v $
X * Revision 2.0  91/02/19  15:49:25  ram
X * Baseline for first official release.
X * 
X */
X
X#include <stdio.h>
X
X#define reg register
X
X#define MAXPERLINE 78
X
Xlong int Ceor = 0;
Xlong int Csum = 0;
Xlong int Crot = 0;
X
Xlong int ccount = 0;
Xlong int bcount = 0;
Xlong int word;
X
X#define EN(c)	(int) ((c) + '!')
X
Xencode(c) reg c;
X{
X  Ceor ^= c;
X  Csum += c;
X  Csum += 1;
X  if ((Crot & 0x80000000)) {
X    Crot <<= 1;
X    Crot += 1;
X  } 
X  else {
X    Crot <<= 1;
X  }
X  Crot += c;
X
X  word <<= 8;
X  word |= c;
X  if (bcount == 3) {
X    wordout(word);
X    bcount = 0;
X  } 
X  else {
X    bcount += 1;
X  }
X}
X
Xwordout(word) reg long int word;
X{
X  if (word == 0) {
X    charout('z');
X  } 
X  else {
X    reg int tmp = 0;
X
X    if (word < 0)
X    { /* Because some don't support unsigned long */
X      tmp = 32;
X      word = word - (long)(85 * 85 * 85 * 85 * 32);
X    }
X    if (word < 0) {
X      tmp = 64;
X      word = word - (long)(85 * 85 * 85 * 85 * 32);
X    }
X    charout(EN((word / (long)(85 * 85 * 85 * 85)) + tmp));
X    word %= (long)(85 * 85 * 85 * 85);
X    charout(EN(word / (85 * 85 * 85)));
X    word %= (85 * 85 * 85);
X    charout(EN(word / (85 * 85)));
X    word %= (85 * 85);
X    charout(EN(word / 85));
X    word %= 85;
X    charout(EN(word));
X  }
X}
X
Xcharout(c) {
X  putchar(c);
X  ccount += 1;
X  if (ccount == MAXPERLINE) {
X    putchar('\n');
X    ccount = 0;
X  }
X}
X
Xmain(argc,argv)
Xchar **argv;
X{
X  reg c;
X  reg long int n;
X
X  if (argc != 1) {
X    fprintf(stderr,"bad args to %s\n", argv[0]);
X    exit(2);
X  }
X  printf("xbtoa Begin\n");
X  n = 0;
X  while ((c = getchar()) != EOF) {
X    encode(c);
X    n += 1;
X  }
X  while (bcount != 0) {
X    encode(0);
X  }
X  /* n is written twice as crude cross check*/
X  if (ccount == 0) /* ccount == 0 means '\n' just written in charout() */
X    ; /* this avoids bug in BITNET, which changes blank line to spaces */
X  else
X    putchar('\n');
X  printf("xbtoa End N %ld %lx E %lx S %lx R %lx\n", n, n, Ceor, Csum, Crot);
X  exit(0);
X}
END_OF_FILE
if test 2696 -ne `wc -c <'btoa/btoa.c'`; then
    echo shar: \"'btoa/btoa.c'\" unpacked with wrong size!
fi
# end of 'btoa/btoa.c'
fi
if test -f 'btoa/hexdecode.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'btoa/hexdecode.c'\"
else
echo shar: Extracting \"'btoa/hexdecode.c'\" \(1276 characters\)
sed "s/^X//" >'btoa/hexdecode.c' <<'END_OF_FILE'
X
X/*
X
X #    #  ######  #    #  #####   ######   ####    ####   #####   ######
X #    #  #        #  #   #    #  #       #    #  #    #  #    #  #
X ######  #####     ##    #    #  #####   #       #    #  #    #  #####
X #    #  #         ##    #    #  #       #       #    #  #    #  #        ###
X #    #  #        #  #   #    #  #       #    #  #    #  #    #  #        ###
X #    #  ######  #    #  #####   ######   ####    ####   #####   ######   ###
X
X	Converts hex from stdin to stdout.
X
X	R. Manfredi and E. Mogenet, June 1990.
X*/
X
X/*
X * $Id: hexdecode.c,v 2.0 91/02/19 15:49:29 ram Exp $
X *
X * $Log:	hexdecode.c,v $
X * Revision 2.0  91/02/19  15:49:29  ram
X * Baseline for first official release.
X * 
X */
X
X#include <stdio.h>
X
Xstatic char	rcs_id[] = "@(#)hexdecode, convert hex from stdin to stdout";
X
X#define ishexa(x) (((x)>='0' && (x)<='9') || ((x)>='A' && (x)<='F'))
X#define tohexa(x) ( (x)>='A' ? (x)-'A'+0xA : (x)-'0' )
X
Xmain(argc, argv)
Xint	argc;
Xchar	**argv;
X{
X	int	c1, c2;
X
X	while (EOF != (c1 = getchar())) {
X		if (ishexa(c1)) {
X			c2 = getchar();
X			if (ishexa(c2))
X				putchar((tohexa(c1) << 4) | (tohexa(c2)));
X			else
X				goto corrupted;
X		} else if ( c1 != '\n' ) {
Xcorrupted:
X			fprintf(stderr, "%s: file corrupted\n", argv[0]);
X			exit(1);
X		}
X	}
X	exit(0);
X}
X
X
END_OF_FILE
if test 1276 -ne `wc -c <'btoa/hexdecode.c'`; then
    echo shar: \"'btoa/hexdecode.c'\" unpacked with wrong size!
fi
# end of 'btoa/hexdecode.c'
fi
if test -f 'btoa/hexencode.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'btoa/hexencode.c'\"
else
echo shar: Extracting \"'btoa/hexencode.c'\" \(1066 characters\)
sed "s/^X//" >'btoa/hexencode.c' <<'END_OF_FILE'
X/*
X
X #    #  ######  #    #  ######  #    #   ####    ####   #####   ######
X #    #  #        #  #   #       ##   #  #    #  #    #  #    #  #
X ######  #####     ##    #####   # #  #  #       #    #  #    #  #####
X #    #  #         ##    #       #  # #  #       #    #  #    #  #        ###
X #    #  #        #  #   #       #   ##  #    #  #    #  #    #  #        ###
X #    #  ######  #    #  ######  #    #   ####    ####   #####   ######   ###
X
X	stdout = hexa(stdin)
X
X	R. Manfredi and E. Mogenet
X*/
X
X/*
X * $Id: hexencode.c,v 2.0 91/02/19 15:49:33 ram Exp $
X *
X * $Log:	hexencode.c,v $
X * Revision 2.0  91/02/19  15:49:33  ram
X * Baseline for first official release.
X * 
X */
X
X#include <stdio.h>
X
Xstatic char	rcs_id[] = "@(#)hexencode, stdout = hexa(stdin)";
X
X#define QUARTET 0xF
Xstatic char	hexa[] = "0123456789ABCDEF";
X
Xmain()
X{
X	int	c;
X	int	jump;
X
X
X	jump = 0;
X	while (EOF != (c = getchar())) {
X		putchar(hexa[(c>>4) & QUARTET]);
X		putchar(hexa[c & QUARTET]);
X		jump += 2;
X		if ( jump > 75 ) {
X			putchar('\n');
X			jump = 0;
X		}
X	}
X	putchar('\n');
X	exit(0);
X}
X
X
END_OF_FILE
if test 1066 -ne `wc -c <'btoa/hexencode.c'`; then
    echo shar: \"'btoa/hexencode.c'\" unpacked with wrong size!
fi
# end of 'btoa/hexencode.c'
fi
if test -f 'config.h.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.h.SH'\"
else
echo shar: Extracting \"'config.h.SH'\" \(1669 characters\)
sed "s/^X//" >'config.h.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X	echo "Using config.sh from above..."
X    fi
X    . ./config.sh
X    ;;
Xesac
Xecho "Extracting config.h (with variable substitutions)"
Xsed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!'
X/* config.h
X * This file was produced by running the config.h.SH script, which
X * gets its values from config.sh, which is generally produced by
X * running Configure.
X *
X * Feel free to modify any of this as the need arises.  Note, however,
X * that running config.h.SH again will wipe out any changes you've made.
X * For a more permanent change edit config.sh and rerun config.h.SH.
X */
X
X
X/* EUNICE:
X *	This symbol, if defined, indicates that the program is being compiled
X *	under the EUNICE package under VMS.  The program will need to handle
X *	things like files that don't go away the first time you unlink them,
X *	due to version numbering.  It will also need to compensate for lack
X *	of a respectable link() command.
X */
X/* VMS:
X *	This symbol, if defined, indicates that the program is running under
X *	VMS.  It is currently only set in conjunction with the EUNICE symbol.
X */
X/* XENIX:
X *	This symbol, if defined, indicates thet the program is running under
X *	Xenix (at least 3.0 ?).
X */
X/* BSD:
X *	This symbol, if defined, indicates that the program is running under
X *	a BSD system.
X */
X#$d_eunice EUNICE		/**/
X#$d_eunice VMS		/**/
X#$d_xenix XENIX		/**/
X#$d_bsd BSD		/**/
X
X/* DEFEDITOR:
X *	This symbol contains the name of the default editor.
X */
X#define DEFEDITOR "$defeditor"		/**/
X
X!GROK!THIS!
END_OF_FILE
if test 1669 -ne `wc -c <'config.h.SH'`; then
    echo shar: \"'config.h.SH'\" unpacked with wrong size!
fi
# end of 'config.h.SH'
fi
if test -f 'install.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'install.SH'\"
else
echo shar: Extracting \"'install.SH'\" \(3145 characters\)
sed "s/^X//" >'install.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting install (with variable substitutions)"
X$spitshell >install <<!GROK!THIS!
X$startsh
X# @(#) Installing script accepting bsd-style arguments
X# Derived from a script found in the X11R4 distribution.
X
X# $Id: install.SH,v 2.0 91/02/19 15:49:42 ram Exp $
X#
X# $Log:	install.SH,v $
X# Revision 2.0  91/02/19  15:49:42  ram
X# Baseline for first official release.
X# 
X
Xchown='$chown'
Xchmod='$chmod'
Xchgrp='$chgrp'
X!GROK!THIS!
X$spitshell >>install <<'!NO!SUBS!'
X
Xmode=""
Xdst=""
Xsrc=""
Xdostrip=""
Xnewdir=""
Xuid=""
Xgid=""
X
Xmkdir_p()
X{
X	# recursively called to build a path (simulates the BSD `mkdir -p')
X	# Bourne shell cannot handle recursive functions -- use subshells
X
X	(
X		name=$1
X		if test ! -d $name
X		then
X			mkdir_p `dirname $name`
X			mkdir $name
X			echo "install: created directory $name" >&2
X		fi
X	)
X}
X
Xwhile test x$1 != x
Xdo
X	case $1 in 
X	-c) shift
X		continue
X		;;
X	-m) mode="$2 "
X		shift
X		shift
X		continue
X		;;
X	-o) uid="$2 "
X		shift
X		shift
X		continue
X		;;
X	-g) gid="$2 "
X		shift
X		shift
X		continue
X		;;
X	-s) dostrip="strip"
X		shift
X		continue
X		;;
X	-d) newdir="$newdir$2 "
X		shift
X		shift
X		continue
X		;;
X	*) if test x$src = x
X		then
X			src=$1
X		else
X			dst=$1
X		fi
X		shift
X		continue
X		;;
X	esac
Xdone
X
X# if -d option is used, we have to create the path given
X# mkdir -p may not exist, so do it by hand
Xif test ! x$newdir = x
Xthen
X	for i in $newdir
X	do
X		mkdir_p $i
X	done
X	exit 0		# -d is the only action
Xfi
X
Xif test x$src = x
Xthen
X	echo "install:  no input file specified" >&2
X	exit 1
Xfi
X
Xif test x$dst = x
Xthen
X	echo "install:  no destination specified" >&2
X	exit 1
Xfi
X
X# Set up some variable to be used later
Xrmcmd=""
Xsrcdir="."
X
X# In case we are interrupted
Xtrap "$rmcmd ; exit 1" 1 2 3 15
X
X# If the destination isn't a directory we'll need to copy it first
Xif test ! -d $dst
Xthen
X	dstbase=`basename $dst`
X	cp $src /tmp/$dstbase
X	rmcmd="rm -f /tmp/$dstbase"
X	src=$dstbase
X	srcdir=/tmp
X	dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`"
X	if test x$dst = x
X	then
X		dst="."
X	fi
Xfi
X
X# If the src file has a directory, copy it to /tmp to make install happy
Xsrcbase=`basename $src`
X
Xif test "$src" != "$srcbase" -a "$src" != "./$srcbase"
Xthen
X	cp $src /tmp/$srcbase
X	src=$srcbase
X	srcdir=/tmp
X	rmcmd="rm -f /tmp/$srcbase"
Xfi
X
X# Now start the install procedure
X(
X	cd $srcdir
X
X	# first, copy the src to dst, renaming old version
X	if test -f $dst/$src
X	then
X		mv $dst/$src $dst/OLD$src &&
X		echo "install: $dst/$src renamed as OLD$src"
X	fi
X	cp $src $dst/$src &&
X	echo "install: $src installed as $dst/$src"
X
X	# Alter mode
X	if test ! x$uid = x
X	then
X		$chown $uid $dst/$src
X	fi
X	if test ! x$gid = x
X	then
X		$chgrp $gid $dst/$src
X	fi
X	if test ! x$mode = x
X	then
X		$chmod $mode $dst/$src
X	fi
X
X	# strip dest if necessary
X	if test ! x$dostrip = x
X	then
X		echo "install: stripping $dst/$src"
X		strip $dst/$src
X	fi
X)
X
X# And clean up
X$rmcmd
X!NO!SUBS!
Xchmod 755 install
X$eunicefix install
END_OF_FILE
if test 3145 -ne `wc -c <'install.SH'`; then
    echo shar: \"'install.SH'\" unpacked with wrong size!
fi
# end of 'install.SH'
fi
if test -f 'kit/Makefile.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kit/Makefile.SH'\"
else
echo shar: Extracting \"'kit/Makefile.SH'\" \(1015 characters\)
sed "s/^X//" >'kit/Makefile.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X	if test ! -f config.sh; then
X		ln ../config.sh . || \
X		ln ../../config.sh . || \
X		ln ../../../config.sh . || \
X		(echo "Can't find config.sh."; exit 1)
X	fi
X	. config.sh
X	;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting kit/Makefile (with variable substitutions)"
X$spitshell >Makefile <<!GROK!THIS!
X#
X# Makefile for mailagent (sub-directory kit)
X#
X
X# $Id: Makefile.SH,v 2.0 91/02/19 15:49:49 ram Exp $
X#
X# $Log:	Makefile.SH,v $
X# Revision 2.0  91/02/19  15:49:49  ram
X# Baseline for first official release.
X# 
X
XSHELL = /bin/sh
X
XRM = $rm
Xbinsh = $scriptdir
X
X!GROK!THIS!
X$spitshell >>Makefile <<'!NO!SUBS!'
Xscripts = kit mailkit unkit
Xscriptsh = kit.SH mailkit.SH unkit.SH
Xadded = Makefile config.sh
X
X.SUFFIXES: .SH
X
X.SH:
X	sh $<
X
Xall: $(scripts)
X
Xinstall: $(scripts)
X	-for file in $(scripts); do \
X		../install -m 755 $$file $(binsh); \
X	done
X
Xclean:
X	$(RM) -f $(scripts)
X
Xrealclean clobber: clean
X	$(RM) -f $(added)
X!NO!SUBS!
Xchmod 755 Makefile
X$eunicefix Makefile
END_OF_FILE
if test 1015 -ne `wc -c <'kit/Makefile.SH'`; then
    echo shar: \"'kit/Makefile.SH'\" unpacked with wrong size!
fi
# end of 'kit/Makefile.SH'
fi
if test -f 'kit/kit.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kit/kit.SH'\"
else
echo shar: Extracting \"'kit/kit.SH'\" \(3592 characters\)
sed "s/^X//" >'kit/kit.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting kit/kit (with variable substitutions)"
X$spitshell >kit <<!GROK!THIS!
X$startsh
X# @(#) converts to ascii && packages a whole directory
X# @(#) Syntax: kit [-BFEHVefhp] [-m address] [-s name] directories | files
X# @(#) (c) E. Mogenet April, 1990
X# @(#) (c) R. Manfredi, 1990 1991
X
X# Which patch-level is it ?
X!GROK!THIS!
X
X: Put patchlevel value in kit
Xecho pl=`$sed -n -e 's/^#define PATCHLEVEL //p' ../patchlevel.h` >>kit
X
X$spitshell >>kit <<'!NO!SUBS!'
X
X# Options:
X#   -E: passed to mailkit (edit instructions)
X#   -F: passed to mailkit (feed instructions)
X#   -H: for hex-encoding
X#   -B: for Ascii-encoding (the default)
X#   -V: prints version and patch-level
X#   -e: passed to mailkit (edit instructions -- put in every mail)
X#   -f: passed to mailkit (feed instructions -- put in every mail)
X#   -h: help message
X#   -m address: invoke mailkit to mail to the given address
X#   -s subject: kit name (given to mailkit).
X
X# We have two encoding methods for binary datas:
X# - hexencode: brute force (mogenix)
X# - btoa: binary to ascii (ram)
X#
X# As we want to make kit-unkit encoding-independant, the following
X# naming convention occurs for files split:
X# - zag* for hex-encoded files (for backward compatibility)
X# - zag.ba.* for ascii-encoded files
X
X# $Id: kit.SH,v 2.0 91/02/19 15:49:53 ram Exp $
X#
X# $Log:	kit.SH,v $
X# Revision 2.0  91/02/19  15:49:53  ram
X# Baseline for first official release.
X# 
X
X# Program used for coding
XCODING=btoa
X# Name of file generated by split
XSPLIT_FILE="zag.ba."
X# Mailing program to use with kit
XMAILKIT=mailkit
X# Do we have to invoke mailkit ?
XINVOKE=no
X# Mailkit options
Xmailopt=""
Xsubject=""
X
XUsage()
X{
X	echo "Usage: kit [-BEFHVefhp] [-m address] [-s name] directories | files"
X	echo "  -B : use btoa encoding (default)."
X	echo "  -E : edit instructions for part #0 (passed to mailkit)."
X	echo "  -F : feed instructions from stdin to part #0 (passed to mailkit)."
X	echo "  -H : use hex-encoding."
X	echo "  -V : print version and patch-level."
X	echo "  -e : edit instructions to add in each part (passed to mailkit)."
X	echo "  -f : feed instructions from stdin in each part (passed to mailkit)."
X	echo "  -h : to print this help message."
X	echo "  -m : invoke mailkit to mail the parts."
X	echo "       There may be as much -m as necessary."
X	echo "  -p : preserve files sent (given to mailkit)."
X	echo "  -s : set kit name (given to mailkit)."
X	exit 1
X}
X
Xfor i in $*
Xdo
X	case $i in 
X	-H) shift
X		CODING=hexencode
X		SPLIT_FILE="zag.hex."
X		shift
X		continue
X		;;
X	-B) shift
X		CODING=btoa
X		SPLIT_FILE="zag.ba."
X		shift
X		continue
X		;;
X	-E|-e|-F|-f|-p) mailopt="$mailopt $1"
X		shift
X		continue
X		;;
X	-m) ADDRESS="$ADDRESS $2"
X		INVOKE=yes
X		shift 2
X		continue
X		;;
X	-s) subject="$2"
X		shift 2
X		continue
X		;;
X	-V) echo "kit version 2.0 PL$pl"
X		exit 0
X		;;
X	-h) Usage
X		;;
X	-*) echo "unkown option $1"
X		Usage
X	esac
Xdone
X
X# At this stage, $1 should hold the name of a file or a directory
Xif test x$1 = x
Xthen
X	Usage
Xfi
X
X# Make sure no parts already exist
Xrm -f Part??
X
Xtar cvf - $@		|
Xcompress -v			|
X$CODING				|
Xsplit -600 - $SPLIT_FILE &&
Xmakekit -k100 ${SPLIT_FILE}* &&
Xrm ${SPLIT_FILE}*
X
X# If -m option used, invoke mailkit
Xif test $INVOKE = yes
Xthen
X	case $subject in
X	'') subject="$1";;
X	esac
X	$MAILKIT $mailopt "$subject" $ADDRESS
Xfi
X!NO!SUBS!
Xchmod 755 kit
X$eunicefix kit
END_OF_FILE
if test 3592 -ne `wc -c <'kit/kit.SH'`; then
    echo shar: \"'kit/kit.SH'\" unpacked with wrong size!
fi
# end of 'kit/kit.SH'
fi
if test -f 'kit/mailkit.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kit/mailkit.SH'\"
else
echo shar: Extracting \"'kit/mailkit.SH'\" \(5239 characters\)
sed "s/^X//" >'kit/mailkit.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting kit/mailkit (with variable substitutions)"
X$spitshell >mailkit <<!GROK!THIS!
X# @(#) Mailer for kit files
X# @(#) Syntax: mailkit [-EVFefhp] prog_name address_list
X# @(#) (c) R. Manfredi, 1990 1991
X
X# $Id: mailkit.SH,v 2.0 91/02/19 15:49:57 ram Exp $
X#
X# $Log:	mailkit.SH,v $
X# Revision 2.0  91/02/19  15:49:57  ram
X# Baseline for first official release.
X# 
X
X# Define the mailer program
XMAILER="$mailer"
X
X# Define the default editor
Xeditor=$defeditor
X
X# Which patch-level is it ?
X!GROK!THIS!
X
X: Put patchlevel value in mailkit
Xecho pl=`$sed -n -e 's/^#define PATCHLEVEL //p' ../patchlevel.h` >>mailkit
X
X$spitshell >>mailkit <<'!NO!SUBS!'
X
X# Flag used for -e/f and -E/F options
Xedit=no
Xadded=no
Xfeed=no
Xpreserve=no
X
XUsage()
X{
X	echo "Usage: mailkit [-EFVefhp] prog_name address_list"
X	echo "  -E : edit a message that will be sent as part #0"
X	echo "  -F : feed message from stdin and sent it as part #0"
X	echo "  -V : print version and patch-level"
X	echo "  -e : edit a message that will be added to every part"
X	echo "  -e : fedd message from stdin to every part"
X	echo "  -h : to print this help message."
X	echo "  -p : preserve files sent."
X	exit 1;
X}
X
X# Argument parsing
Xfor i in $*
Xdo
X	case $i in
X	-V) echo "mailkit version 2.0 PL$pl"
X		exit 0
X		;;
X	-E) edit=yes
X		added=no
X		shift
X		continue
X		;;
X	-e) edit=yes
X		added=yes
X		shift
X		continue
X		;;
X	-h) Usage
X		;;
X	-p) preserve=yes
X		shift
X		continue
X		;;
X	-f)	feed=yes
X		added=yes
X		shift
X		continue
X		;;
X	-F)	feed=yes
X		added=no
X		shift
X		continue
X		;;
X	-*) echo "unknown option $1"
X		Usage
X	esac
Xdone
X
Xif test $# -le 1
Xthen
X	Usage
Xfi
X
X# In case of editing, compute a temporary file name
Xmessage=/tmp/MKt$$
X# Temporary files used for building top message
Xtmpmsg=/tmp/Nkt$$
Xtopmsg=/tmp/Tkt$$
X
X# Set a trap in case we die abruptly
Xtrap 'rm -f $message $tmpmsg $topmsg
Xtest $preserve = no && rm -f Part??
Xexit 1' 1 2 3 15
X
X# Save arguments before using set --
XTHIS_PROG=$0
XPROG_NAME=$1
Xshift
XADDRESS=$@
X
X# Count how many files there are
Xset -- Part*
XNFILES=$#
X
Xif test $edit = yes
Xthen
X	# If editing was asked for, prepare the help message
X	cat >$message <<EOM
XPlease, enter your message here for the "$PROG_NAME" kit.
XDo not worry about this text, the 4 lines at the top will be removed.
XEOM
X	if test $added = yes
X	then
X		cat >>$message <<'EOM'
XThe message will be added at the top of each part.
XEOM
X	else
X		cat >>$message <<'EOM'
XThe message will be sent as part #0 and other parts will mention that.
XEOM
X	fi
X	cat >>$message <<'EOM'
X------------------------------------------------------------------------
XEOM
X	# Call the editor
X	$editor $message
X
X	# Now remove the 4 lines at the top
X	# Do not use tail +5, as this may not exist on every system
X	cp $message $tmpmsg
X	awk '{ nl += 1 }; nl > 4 { print }' <$tmpmsg >$message
X	rm -f $tmpmsg
X
X	# If message is empty, discard it.
X	if test ! -s $message
X	then
X		rm -f $message
X		edit=no
X	fi
Xelif test $feed = yes; then
X	edit=yes			# No differences from now on
X	cat > $message		# Feed from stdin
Xfi
X
Xfor i in Part*
Xdo
X	# Extracts the part number (will it work on all systems ?)
X	# Note that this does not rely on the leader part of the name.
X	part=`expr $i : '[^0-9]*\(.*\)'`
X
X	# Remove leading zero(s).
X	# Is there a simpler way to do this ?
X	part_num=`expr $part + 0`
X
X	# Protect against unexisting/unreadable files matching "Part*"
X	if  test -f $i -a -r $i
X	then
X		echo mailing $i \($PROG_NAME\) to $ADDRESS
X		cat > $topmsg <<EOH
XTo: $ADDRESS
XSubject: $PROG_NAME - kit #$part_num / $NFILES
X
XEOH
X		# Has edit been requested ?
X		if test $edit = yes
X		then
X			if test $added = yes
X			then
X				# Add message to each part
X				cat $message >> $topmsg
X				# add a blank line
X				echo " " >> $topmsg
X			else
X				# Signals that there is a part #0
X				cat >> $topmsg <<EOM
X[ There is an instruction mail which is labeled: $PROG_NAME - kit #0 / $NFILES ]
X
XEOM
X			fi
X		fi
X		if test $NFILES -gt 1
X		then
X			cat >> $topmsg <<EOH
X>> This is a kit file (part #$part_num out of $NFILES). To unkit, save this message
X>> into a file, e.g. foo$part, and wait until you have the $NFILES files.
X>> Then, do "unkit foo*". To see what will be extracted, you may wish to
X>> do "unkit -l foo*" before.
X
XEOH
X		else
X			cat >> $topmsg <<EOH
X>> This is a kit file. To unkit, save this message into a file, e.g. foo.
X>> Then, do "unkit foo". To see what will be extracted, yo may wish to
X>> do "unkit -l foo" before.
X
XEOH
X		fi
X		cat $i >> $topmsg
X		$MAILER $ADDRESS < $topmsg
X		rm -f $topmsg
X	else
X		echo $THIS_PROG: could not open $i >&2
X	fi
Xdone
X
X# Is there a part #0 to send ?
Xif test $edit = yes -a $added = no
Xthen
X	cat > $topmsg <<EOM
XTo: $ADDRESS
XSubject: $PROG_NAME - kit #0 / $NFILES
X
X[ This is an instruction message for the $PROG_NAME kit ]
X
XEOM
X	cat >>$topmsg <$message
X	echo mailing instructions \($PROG_NAME\) to $ADDRESS
X	$MAILER $ADDRESS < $topmsg
X	rm -f $topmsg
Xfi
X
X# Clean up
Xrm -f $message
Xtest $preserve = no && rm -f Part??
X!NO!SUBS!
Xchmod 755 mailkit
X$eunicefix mailkit
END_OF_FILE
if test 5239 -ne `wc -c <'kit/mailkit.SH'`; then
    echo shar: \"'kit/mailkit.SH'\" unpacked with wrong size!
fi
# end of 'kit/mailkit.SH'
fi
if test -f 'kit/unkit.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kit/unkit.SH'\"
else
echo shar: Extracting \"'kit/unkit.SH'\" \(2365 characters\)
sed "s/^X//" >'kit/unkit.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting kit/unkit (with variable substitutions)"
X$spitshell >unkit <<!GROK!THIS!
X$startsh
X# @(#) unkit, reversal of kit
X# @(#) (c) E.Mogenet April 1990
X# @(#) (c) R. Manfredi, 1990 1991
X# Syntax: unkit [-hlprV] [filenames]
X
X# $Id: unkit.SH,v 2.0 91/02/19 15:50:03 ram Exp $
X#
X# $Log:	unkit.SH,v $
X# Revision 2.0  91/02/19  15:50:03  ram
X# Baseline for first official release.
X# 
X# patch3: Added option -h to print help.
X# patch3: Updated "what" comments to reflect changes.
X# 
X# Revision 1.0.1.2  90/08/22  14:41:13  ram
X# patch2: Now has its patch level in it.
X# 
X# Revision 1.0.1.1  90/08/21  23:22:36  ram
X# Created for portability (uses metaconfig now).
X# 
X
X# Which patch-level is it ?
X!GROK!THIS!
X
X: Put patchlevel value in unkit
Xecho pl=`$sed -n -e 's/^#define PATCHLEVEL //p' ../patchlevel.h` >>unkit
X
X$spitshell >>unkit <<'!NO!SUBS!'
X
X# Default decoding program for backward compatibility
XDECODING=hexdecode
X
X# Preserve input files by default
XPRESERVE=yes
X
X# No list by default
Xtar_opt=xvof
X
XUsage()
X{
X	echo "Usage: unkit [-hlprV] [file1 ... filen]"
X	echo "   -h: give this help message."
X	echo "   -l: lists the contents of a the kit files."
X	echo "   -p: preserve input files (default)."
X	echo "   -r: remove input files if unshar succeeds."
X	echo "   -V: print current version and patch-level."
X	exit 1
X}
X
X# Option parsing
Xfor i in $*
Xdo
X	case $i in
X	-p) PRESERVE=yes
X		shift
X		continue;;
X	-r) if test $tar_opt = xvof
X		then
X			PRESERVE=no
X		fi
X		shift
X		continue;;
X	-V) echo "unkit version 2.0 PL$pl"
X		exit 0;;
X	-h) Usage;;
X	-l) tar_opt=tvf
X		PRESERVE=yes
X		shift
X		continue;;
X	-*) echo "Unknown option $i"
X		Usage;;
X	esac
Xdone
X
X# If no file name is given, process the standard input
Xif test $# -eq 0
Xthen
X	unshar -n
Xelse
X	for i
X	do
X		unshar -n $i		&&
X		(test $PRESERVE = no && rm $i)
X	done
Xfi
X
X# Now check for file names to find how to decode
Xif test -f zag.ba.aa
Xthen
X	DECODING=atob
Xelif test -f zag.uu.aa
Xthen
X	DECODING=uudecode
Xfi
X
Xecho "Decoding with $DECODING"
X
Xcat `ls zag*`		|
X$DECODING		|
Xzcat -v				|
Xtar $tar_opt -
X
Xrm -f zag*
X!NO!SUBS!
Xchmod 755 unkit
X$eunicefix unkit
END_OF_FILE
if test 2365 -ne `wc -c <'kit/unkit.SH'`; then
    echo shar: \"'kit/unkit.SH'\" unpacked with wrong size!
fi
# end of 'kit/unkit.SH'
fi
if test -f 'man/Makefile.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/Makefile.SH'\"
else
echo shar: Extracting \"'man/Makefile.SH'\" \(1034 characters\)
sed "s/^X//" >'man/Makefile.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X	if test ! -f config.sh; then
X		ln ../config.sh . || \
X		ln ../../config.sh . || \
X		ln ../../../config.sh . || \
X		(echo "Can't find config.sh."; exit 1)
X	fi
X	. config.sh
X	;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting man/Makefile (with variable substitutions)"
X$spitshell >Makefile <<!GROK!THIS!
X#
X# Makefile for kit (sub-directory man)
X#
X
X# $Id: Makefile.SH,v 2.0 91/02/19 15:50:12 ram Exp $
X#
X# $Log:	Makefile.SH,v $
X# Revision 2.0  91/02/19  15:50:12  ram
X# Baseline for first official release.
X# 
X
XSHELL = /bin/sh
X
XRM = $rm
Xman = $mansrc
X
X.SUFFIXES: .$manext .SH
X
X.SH.$manext:
X	sh $<
X
XL = $manext
X!GROK!THIS!
X$spitshell >>Makefile <<'!NO!SUBS!'
Xmanpage = atob.$(L) btoa.$(L) kit.$(L) mailkit.$(L) unkit.$(L)
Xadded = Makefile config.sh
X
X.SH:
X	sh $<
X
Xall: $(manpage)
X
Xinstall: all
X	-for file in $(manpage); do \
X		../install -m 444 $$file $(man); \
X	done
X
Xclean:
X	$(RM) -f $(manpage)
X
Xrealclean clobber: clean
X	$(RM) -f $(added)
X!NO!SUBS!
Xchmod 755 Makefile
X$eunicefix Makefile
END_OF_FILE
if test 1034 -ne `wc -c <'man/Makefile.SH'`; then
    echo shar: \"'man/Makefile.SH'\" unpacked with wrong size!
fi
# end of 'man/Makefile.SH'
fi
if test -f 'man/atob.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/atob.SH'\"
else
echo shar: Extracting \"'man/atob.SH'\" \(438 characters\)
sed "s/^X//" >'man/atob.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X	if test ! -f config.sh; then
X		ln ../config.sh . || \
X		ln ../../config.sh . || \
X		ln ../../../config.sh . || \
X		(echo "Can't find config.sh."; exit 1)
X	fi
X	. config.sh
X	;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting man/atob.$manext (with variable substitutions)"
X$rm -f atob.$manext
X$spitshell >atob.$manext <<!GROK!THIS!
X.so $mansrc/btoa.$manext
X!GROK!THIS!
Xchmod 444 atob.$manext
END_OF_FILE
if test 438 -ne `wc -c <'man/atob.SH'`; then
    echo shar: \"'man/atob.SH'\" unpacked with wrong size!
fi
# end of 'man/atob.SH'
fi
if test -f 'man/btoa.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/btoa.SH'\"
else
echo shar: Extracting \"'man/btoa.SH'\" \(1655 characters\)
sed "s/^X//" >'man/btoa.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting man/btoa.$manext (with variable substitutions)"
X$rm -f btoa.$manext
X$spitshell >btoa.$manext <<!GROK!THIS!
X.TH BTOA $manext local
X''' @(#) Manual page for atob/btoa -- (c) ram August 1990
X'''
X''' $Id: btoa.SH,v 2.0 91/02/19 15:50:22 ram Exp $
X'''
X''' $Log:	btoa.SH,v $
X''' Revision 2.0  91/02/19  15:50:22  ram
X''' Baseline for first official release.
X''' 
X'''
X.SH NAME
Xbtoa, atob \- encode/decode binary to printable ASCII
X.SH SYNOPSIS
X.B btoa
X.br
X.B atob
X.SH DESCRIPTION
X.I Btoa
Xis a filter that reads anything from the standard input, and encodes it into
Xprintable ASCII on the standard output.  It also attaches a header and checksum
Xinformation used by the reverse filter 
X.I atob 
Xto find the start of the data and to check integrity.
X.PP
X.I Atob
Xreads an encoded file, strips off any leading and
Xtrailing lines added by mailers, and recreates a copy of the original file
Xon the standard output.
X.I Atob 
Xgives NO output (and exits with an error message) if its input is garbage or 
Xthe checksums do not check.
X.PP
X.SH FEATURES
X.I Btoa
Xuses a compact base-85 encoding so that
X4 bytes are encoded into 5 characters (file is expanded by 25%).
XAs a special case, 32-bit zero is encoded as one character.  This encoding
Xproduces less output than
X.IR uuencode "(1)."
X.SH AUTHOR
XPaul Rutter
X.SH "SEE ALSO"
Xkit($manext), mail(1), uuencode(1)
X!GROK!THIS!
Xchmod 444 btoa.$manext
END_OF_FILE
if test 1655 -ne `wc -c <'man/btoa.SH'`; then
    echo shar: \"'man/btoa.SH'\" unpacked with wrong size!
fi
# end of 'man/btoa.SH'
fi
if test -f 'man/kit.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/kit.SH'\"
else
echo shar: Extracting \"'man/kit.SH'\" \(5500 characters\)
sed "s/^X//" >'man/kit.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X    if test ! -f config.sh; then
X	ln ../config.sh . || \
X	ln ../../config.sh . || \
X	ln ../../../config.sh . || \
X	(echo "Can't find config.sh."; exit 1)
X    fi
X    . config.sh
X    ;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting man/kit.$manext (with variable substitutions)"
X$rm -f kit.$manext
X$spitshell >kit.$manext <<!GROK!THIS!
X.TH KIT $manext ram
X''' @(#) Manual page for mailing kit -- (c) ram July 1990
X'''
X''' $Id: kit.SH,v 2.0 91/02/19 15:50:28 ram Exp $
X'''
X''' $Log:	kit.SH,v $
X''' Revision 2.0  91/02/19  15:50:28  ram
X''' Baseline for first official release.
X''' 
X'''
X.SH NAME
Xkit, mailkit, unkit \- the ultimate mailing tools
X.SH SYNOPSIS
X\fBkit\fR [ \fB\-EFHBVefhp\fR ] [ \fB\-m\fI address\fR ]
X[ \fB\-s\fI name\fR ] \fIdirectories\fR | \fIfiles\fR
X.br
X\fBmailkit\fR [ \fB\-EFVefhp\fR ] \fItitle\fR \fIaddress(es)\fR
X.br
X\fBunkit\fR [ \fB\-hlprV\fR ] [ \fIfiles\fR ]
X.SH DESCRIPTION
X\fIKit\fR is the ultimate mailing tool. It enables you to mail
Xdatas without any consideration of possible escape sequences or
Xcontrol characters.
XGiven a file name or a directory, it builds a single file using
X\fItar\fR(1) and \fIcompress\fR(1). Then it is hex-encoded
X(option \fB\-H\fR) or ASCII-encoded with \fIbtoa\fR(1)
X(option \fB\-B\fR, which is used by default) before being shell-archived
Xby \fImakekit\fR(1).
X\fIKit\fR produces files that match "Part*" regular expression.
XOn invocation, it removes all previously existing "Part*" file.
XWith \fB\-m\fR option, it is possible to give one mail address, and
X\fIkit\fR will invoke \fImailkit\fR to send the archive. There may be
Xas many \fB\-m\fR options as needed (to send the same archive to more
Xthan a single person).
X.PP
XThe \fB\-E\fR, \fB\-F\fR, \fB\-e\fR, \fB\-f\fR and \fB\-p\fR options are
Xpassed on to \fImailkit\fR, so
Xif no \fB\-m\fR option is used, they will be ignored. When sending
Xfiles with \fB\-m\fR, the subject of the message holds the name of
Xthe first file given in the command line (supposed to be the name
Xof the kit). It is possible to overwrite this default by using the
X\fB\-s\fR option.
X.PP
X\fIMailkit\fR takes "Part*" files and sends them to a list of addresses.
XEach message sent corresponds to one part and has its \`Subject:'
Xfield set to the number of this part with the \fItitle\fR given, and you
Xalso have the total number of parts, so that missing parts can easily
Xbe located.
X.PP
XThe options \fB\-E\fR and \fB\-e\fR from \fImailkit\fR allow you to give
Xthe recipient some instructions. They both call an editor. At the
Xtop of the file edited, there is a little message, which
Xwill (of course) be stripped from the text you enter, so do not
Xremove it or your own message will be cut as a result. With \fB\-E\fR,
Xthe message will be sent in an extra part (#0), while with \fB\-e\fR
Xit will be included in each part. Empty messages will be ignored.
X.PP
XOptions \fB\-F\fR and \fB\-f\fR are very similar, but take their
Xinput from stdin (standard input) instead of calling an editor.
XOption \fB\-p\fR asks \fImailkit\fR for preserving mailed files. They
Xare removed by default.
X.PP
X\fIUnkit\fR is used to restore the original files. The argument is
Xa list of archive files (or mail files, as \fIunshar\fR(1), which
Xis called by \fIunkit\fR, can deal with mail headers).
XInput files are not removed unless option \fB\-r\fR is given. By default,
Xoption \fB\-p\fR is used to preserve the input file(s).
XIf no file name is given to \fIunkit\fR, the standard input is processed.
XThis is useful to process messages directly from a mail user agent.
X.PP
XIf you want to know what \fIunkit\fR will create without actually
Xdoing it, use the \fB\-l\fR option. With this option, \fB\-r\fR is
Xignored.
X.PP
XFor all of these commands, option \fB\-V\fR prints the version
Xnumber with the current patch level and exits, while \fB\-h\fR gives
Xa little help message with the syntax and the meaning of the options.
X.SH FILES
X.PD 0
X.TP 20
XPart*
Xfiles generated by \fIkit\fR
X.TP
Xzag.hex.*
Xtemporary files used by \fIkit\fR and \fIunkit\fR for datas which
Xare hex-encoded.
X.TP
Xzag.ba.*
Xtemporary files used by \fIkit\fR and \fIunkit\fR for datas which
Xare ASCII-encoded.
X.PD
X.SH NOTE
X.PP
XIn order to use kit, you need to install cshar in your
XPATH (programs needed are \fIcshar\fR, \fImakekit\fR and \fIunshar\fR).
XMoreover, \fIhexdecode\fR, \fIhexencode\fR, \fIatob\fR and \fIbtoa\fR
Xmust be installed and \fIcompress\fR must be available.
XIf either of these is missing, this mailing kit is useless
X.SH EXAMPLES
X.PP
XTo mail \fIram@educ.emse.fr\fR a directory called XLOCK and all what it may
Xhold, do:
X.sp
X.in +5
X.B kit XLOCK
X.br
X.B mailkit XLOCK ram@educ.emse.fr
X.in -5
X.sp
X\fIKit\fR will produce files Part* and mailkit will send them.
XOr, to do it all in once:
X.sp
X.in +5
X.B kit \-m ram@educ.emse.fr XLOCK
X.in -5
X.sp
XTo unkit, save the mail messages in files called, e.g. xlock.01 (for
Xpart 01), xlock.02 (for part 02) and so on.
XThen do:
X.sp
X.in +5
X.B unkit xlock*
X.in -5
X.sp
XEven if it succeeds, files xlock* will not be removed.
X.SH BUGS
XTry "kit .": it is harmless (well, I hope !), and you will quickly
Xunderstand the problem.
X.PP
XIf you use the
X.B \-r
Xoption in
X.I unkit
Xand one or more kit parts are missing, all the files will be lost.
XSo use it with care...
X.SH "SEE ALSO"
Xatob($manext), btoa($manext), cshar(1), makekit(1).
X.SH AUTHOR
XRaphael Manfredi, August 1990.
X
X\fIKit\fR was developped at the Ecole des Mines, Saint-Etienne,
XFrance.
X!GROK!THIS!
Xchmod 444 kit.$manext
END_OF_FILE
if test 5500 -ne `wc -c <'man/kit.SH'`; then
    echo shar: \"'man/kit.SH'\" unpacked with wrong size!
fi
# end of 'man/kit.SH'
fi
if test -f 'man/mailkit.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/mailkit.SH'\"
else
echo shar: Extracting \"'man/mailkit.SH'\" \(449 characters\)
sed "s/^X//" >'man/mailkit.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X	if test ! -f config.sh; then
X		ln ../config.sh . || \
X		ln ../../config.sh . || \
X		ln ../../../config.sh . || \
X		(echo "Can't find config.sh."; exit 1)
X	fi
X	. config.sh
X	;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting man/mailkit.$manext (with variable substitutions)"
X$rm -f mailkit.$manext
X$spitshell >mailkit.$manext <<!GROK!THIS!
X.so $mansrc/kit.$manext
X!GROK!THIS!
Xchmod 444 mailkit.$manext
END_OF_FILE
if test 449 -ne `wc -c <'man/mailkit.SH'`; then
    echo shar: \"'man/mailkit.SH'\" unpacked with wrong size!
fi
# end of 'man/mailkit.SH'
fi
if test -f 'man/unkit.SH' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'man/unkit.SH'\"
else
echo shar: Extracting \"'man/unkit.SH'\" \(441 characters\)
sed "s/^X//" >'man/unkit.SH' <<'END_OF_FILE'
Xcase $CONFIG in
X'')
X	if test ! -f config.sh; then
X		ln ../config.sh . || \
X		ln ../../config.sh . || \
X		ln ../../../config.sh . || \
X		(echo "Can't find config.sh."; exit 1)
X	fi
X	. config.sh
X	;;
Xesac
Xcase "$0" in
X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
Xesac
Xecho "Extracting man/unkit.$manext (with variable substitutions)"
X$rm -f unkit.$manext
X$spitshell >unkit.$manext <<!GROK!THIS!
X.so $mansrc/kit.$manext
X!GROK!THIS!
Xchmod 444 unkit.$manext
END_OF_FILE
if test 441 -ne `wc -c <'man/unkit.SH'`; then
    echo shar: \"'man/unkit.SH'\" unpacked with wrong size!
fi
# end of 'man/unkit.SH'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(41 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X#define VERSION 2.0
X#define PATCHLEVEL 0
END_OF_FILE
if test 41 -ne `wc -c <'patchlevel.h'`; then
    echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0