home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!seismo!sundc!pitstop!sun!amdcad!ames!ucbcad!ucbvax!decvax!ima!necntc!ncoast!allbery
- From: kvancamp@ARDEC.arpa (Kenneth Van Camp -FSAC-)
- Newsgroups: comp.sources.misc
- Subject: ALEX part 1/2 (MS-DOS file exchange program)
- Message-ID: <4767@ncoast.UUCP>
- Date: 29 Sep 87 20:27:32 GMT
- Sender: allbery@ncoast.UUCP
- Lines: 1182
- Approved: allbery@ncoast.UUCP
- X-Archive: comp.sources.misc/8709/alex/1
-
- [I have rewrapped this into two archives, as it arrived as a monolithic 120K
- message. I have also removed compress from the distribution, as it is avail-
- able in its complete form from many UUCP and FTP sites as well as in the
- Usenet news distribution itself. Please note that this is not my normal
- function, and that I may respond to such submissions by asking the poster to
- resubmit his article differently. ++bsa]
-
- #--------------------------------CUT HERE-------------------------------------
- #! /bin/sh
- #
- # This is a shell archive. Save this into a file, edit it
- # and delete all lines above this comment. Then give this
- # file to sh by executing the command "sh file". The files
- # will be extracted into the current directory owned by
- # you with default permissions.
- #
- # The files contained herein are:
- #
- # -rw-rw-rw- 1 allbery System 1738 Sep 29 16:16 READ_ME
- # -rw-r--r-- 1 allbery System 499 Sep 29 16:10 Makefile
- # -rwxr-xr-x 1 allbery System 26067 Sep 29 16:11 alex
- # -rw-r--r-- 1 allbery System 8550 Sep 29 16:11 alex.1
- #
- echo 'x - READ_ME'
- if test -f READ_ME; then echo 'shar: not overwriting READ_ME'; else
- sed 's/^X//' << '________This_Is_The_END________' > READ_ME
- X ALEX (Automatic Library EXchange) is being released to the public
- Xdomain for the first time. It is a Unix utility (mostly shell script) which
- Xwe have found very useful here at ARDEC. It allows for the easy transfer of
- Xfiles or groups of files, either ASCII or binary, between users of personal
- Xcomputers. It assumes that the user has his PC connected to a Unix host
- Xcomputer, using communications software that supports the Kermit file
- Xtransfer protocol. It further assumes that the user has some type of
- Xelectronic mail access on the Unix host. The standard Alex release comes
- Xconfigured for the mmdf (msg) mail system, but is easily adapted for
- Xstandard Unix mail or other mail systems.
- X Alex was designed for the PC user who knows little about Unix, so
- Xthe complete manual, included in the distribution (alex.doc), provides very
- Xbasic instructions. Since Crosstalk and public domain Kermit are the two
- Xmost popular PC communications programs used here at ARDEC, detailed
- Xinstructions are provided for those two types of users.
- X Alex was inspired by the public domain Tarmail program, and uses a
- Xformat similar to Tarmail. However, compatibility with Tarmail was not
- Xmaintained for reasons that are discussed in the manual. Its format is
- Xpurposely simple and has proven very reliable during the year or so that it
- Xhas been in use at ARDEC. It also includes some advanced options that allow
- XAlex to act as a total replacement for Tarmail. I encourage anyone who
- Xadministers a Unix system frequented by PC users to try out Alex.
- X
- X --Ken Van Camp <kvancamp@ARDEC.ARPA>
- X U.S. Army Armament Research Development & Engineering Center
- X SMCAR-FSA-E Building 329
- X Picatinny Arsenal, NJ 07806-5000
- ________This_Is_The_END________
- if test `wc -l < READ_ME` -ne 27; then
- echo 'shar: READ_ME was damaged during transit (should have been 27 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'x - Makefile'
- if test -f Makefile; then echo 'shar: not overwriting Makefile'; else
- sed 's/^X//' << '________This_Is_The_END________' > Makefile
- XINSDIR = /usr/pica/bin
- XMANDIR = /usr/man
- XPROGRAMS= undigest compress atob btoa
- X
- X
- Xall: undigest compress btoa atob
- X
- Xundigest: undigest.o
- X $(CC) $(LDFLAGS) -o undigest undigest.o
- X
- Xcompress: compress.o
- X $(CC) $(LDFLAGS) -o compress compress.o
- X ln compress uncompress
- X
- Xbtoa: btoa.o
- X $(CC) $(LDFLAGS) -o btoa btoa.o
- X
- Xatob: atob.o
- X $(CC) $(LDFLAGS) -o atob atob.o
- X
- Xinstall:
- X $(INSDIR)/$(PROGRAMS)
- X ln $(INSDIR)/compress $(INSDIR)/uncompress
- X rm uncompress
- X
- Xclean:
- X rm -f *.o $(PROGRAMS) uncompress
- ________This_Is_The_END________
- if test `wc -l < Makefile` -ne 27; then
- echo 'shar: Makefile was damaged during transit (should have been 27 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'x - alex'
- if test -f alex; then echo 'shar: not overwriting alex'; else
- sed 's/^X//' << '________This_Is_The_END________' > alex
- X#!/bin/sh
- X#
- X# ALEX version 1.22
- X#
- X# ALEX: Automatic Library EXchange program for sending and receiving groups
- X# of files (either binary or ascii) via electronic mail.
- X#
- Xusage="\
- Xusage: alex [options]\n\
- XAll arguments are optional. Default mode is Download, to download the\n\
- X entire contents of the library (from standard input) to the PC.\n\
- XAlex options include:\n\
- X -tac\t\t (for use over the TAC)\n\
- X -u\t\t (to upload files and send out via e-mail)\n\
- X -u libname\t (to upload files and keep in file libname)\n\
- X -l\t\t (to list all files in the archive on stdin)\n\
- X -q\t\t (to give a quick list of all files in the archive on stdin)\n\
- X -h\t\t (to print this help listing)\n\
- X\t REMAINING COMMANDS ARE FOR ADVANCED USERS ONLY:\n\
- X -a\t\t (specify all files as ASCII)\n\
- X -d\t\t (decode an Alex library without downloading)\n\
- X -e files\t (encode listed files into Alex library on stdout)"
- X#
- X# Alex uses Compress to optimize storage space, Btoa to convert files
- X# to ASCII, then separates them by a line starting with several dashes.
- X# Alex-created files can therefore be decoded easily using the '@'
- X# (undigestify) option of the msg (mmdf) electronic mail system, then
- X# using the 'l' (list) option to: |atob -f and uncompress *.Z.
- X# Alternatively, the single command of 'l' to: |alex will undigestify,
- X# decode, uncompress and start up a kermit file transfer to the user's PC.
- X#
- X# The -u option (alex -u) can be used for the reverse process, to
- X# upload files to the mainframe from the PC via kermit, encode them,
- X# digestify all the files and send it out via electronic mail.
- X# If a file name is supplied after the -u option, then the library
- X# is stored in the named file, rather than sent out automatically
- X# thru e-mail.
- X#
- X# If the -tac option is specified, then all Kermit file transfers
- X# are done in 40-byte packets with even parity, to accomodate the
- X# Picatinny TAC.
- X#
- X# If the -a option is specified, then all files will be uploaded and
- X# stored as ASCII files; all control characters will be stripped.
- X#
- X# The -d and -e options provide lower-level commands to decode and
- X# encode Alex libraries without uploading or downloading files.
- X#
- X# The -l option merely provides a listing of all files and their sizes
- X# in the Alex library on standard input.
- X#
- X# The -q option is the same as -l but is much quicker because the
- X# archive is not actually decoded to determine the file names. It
- X# also does not list file sizes.
- X#
- X# Programmed by Ken Van Camp and Jim Steiner, Picatinny Arsenal, ARDEC.
- X# Version 1.0 June 1986.
- X# Version 1.1 June 1987.
- X# Version 1.2 July 1987.
- X# Version 1.21 July 1987.
- X# Version 1.22 August 1987.
- X#
- X# Insert the name of your system's mailer in the statement below:
- X# If unsure, use: mailer=mail
- Xmailer=/usr/mmdf/v6mail
- X# Insert below your system's echo command with the option so it
- X# does not perform a linefeed at the end of the line (like 'echo -n').
- X# If your system does not support such a feature, then just use:
- X# echocmmd=echo
- Xechocmmd='echo -n'
- X# Insert below your system's head command.
- Xheadcmmd='head'
- X# Insert below your system's command to remove a directory without giving
- X# error messages (like 'rmdir -f'). If your system does not support this
- X# option, then just use: rmdircmmd=rmdir
- Xrmdircmmd=rmdir
- X#
- X# Stop writes and messages
- Xmesg n
- X#
- Xecho "ALEX: Automatic Library EXchange program (version 1.22)"
- X#
- X# Set the default mode to download, no TAC option, file type binary.
- X#
- Xalexmode=download
- Xtac=n
- Xfiletype=binary
- Xabort=n
- Xopterr="ALEX: Cannot specify more than one of -u, -d, -e, -l and -q."
- X#
- X# Parse the command line
- Xfor i in $*
- Xdo
- X case x$i in
- X x-tac)
- X tac=y
- X ;;
- X x-u)
- X if test ! $alexmode = download
- X then
- X echo $opterr
- X echo $usage
- X exit
- X else
- X alexmode=upload
- X fi
- X ;;
- X x-a)
- X filetype=ascii
- X ;;
- X x-h)
- X echo $usage
- X exit
- X ;;
- X x-d)
- X if test ! $alexmode = download
- X then
- X echo $opterr
- X echo $usage
- X exit
- X else
- X alexmode=decode
- X fi
- X ;;
- X x-e)
- X if test ! $alexmode = download
- X then
- X echo $opterr
- X echo $usage
- X exit
- X else
- X alexmode=encode
- X files=""
- X fi
- X ;;
- X x-l)
- X if test ! $alexmode = download
- X then
- X echo $opterr
- X echo $usage
- X exit
- X else
- X alexmode=list
- X fi
- X ;;
- X x-q)
- X if test ! $alexmode = download
- X then
- X echo $opterr
- X echo $usage
- X exit
- X else
- X alexmode=quick
- X fi
- X ;;
- X *)
- X # Unknown argument assumed to be a filename if upload or encode mode.
- X case $alexmode in
- X upload)
- X libname=$i
- X ;;
- X encode)
- X files="$files $i"
- X ;;
- X *)
- X echo "Alex: Illegal option $i"
- X echo $usage
- X exit
- X esac
- X ;;
- X esac
- Xdone
- Xcase $alexmode in
- Xupload)
- X#****************************************************************************
- X#* Upload Option *
- X#****************************************************************************
- X#
- X # Trap interrupts: Remove the temporary files and allow messages.
- X trap 'trap : 1 2 3 ;
- X rm -f /tmp/inst$$ /tmp/$USER$$/* /tmp/$USER$$/.[0-z]* /tmp/alex$$.ba ;
- X $rmdircmmd /tmp/$USER$$ ; mesg y ; exit' 1 2 3
- X #
- X pwd=`pwd`
- X if test $libname
- X then
- X if test $filetype = binary
- X then
- X echo "ALEX: Uploading binary to file $libname"
- X else
- X echo "ALEX: Uploading ASCII to file $libname"
- X echo " WARNING: ASCII transfers must ONLY be done with pure text!"
- X fi
- X else
- X if test $filetype = binary
- X then
- X echo "ALEX: Uploading binary files for e-mail transfer"
- X else
- X echo "ALEX: Uploading ASCII files for e-mail transfer"
- X echo " WARNING: ASCII transfers must ONLY be done with pure text!"
- X fi
- X echo You have selected the Alex Upload option.
- X echo "The following information is needed for electronic mail purposes:"
- X $echocmmd "To: "
- X read to
- X $echocmmd "cc: "
- X read cc
- X $echocmmd "Subject: "
- X read subj
- X echo "
- X A library of files is being sent to you using the Alex
- X exchange program. The instructions below will tell you how
- X to transfer the files from the mainframe to your personal
- X computer. They assume you are using either the Msg or Mailx
- X electronic mail programs, and that you are currently logged
- X in from a personal computer, using some communications
- X software that supports the Kermit file transfer protocol
- X (this is the case with the latest version of the popular
- X Crosstalk XVI program).
- X The library is being sent in a separate message from
- X this one. Before you can download the library to your PC,
- X you must find the message number containing the library. It
- X is probably in the following message. If you are using the
- X Msg electronic mail program, you may now type the letter 'h'
- X (minus the quote marks, of course), followed by the letter
- X 'a' (headers all, in msg parlance). If you are using Mailx,
- X just type 'h'. The library message should have the same
- X subject header as this one.
- X When you have located the message, you must then 'pipe'
- X the message to Alex. To do this in Msg, type the letter 'l'
- X (lower-case L), followed by the message number you just
- X found. You should get the response:
- X To file/pipe:
- X At this time you should type in:
- X |alex
- X Note that the vertical bar (|) is a 'pipe' symbol; not the
- X letter 'I'.
- X If you are using Mailx, then just type '|<message #> alex'
- X (without the quotes). For instance: |2 alex
- X would pipe message number 2 to Alex.
- X You will receive a message that Alex has started. When
- X you are told to start up the Receive Kermit, you should do
- X the following, depending upon whether you are using the
- X Kermit program or Crosstalk. (If you have problems, send
- X electronic mail to msdos-request.)
- X CROSSTALK USERS:
- X Type your Attention key (PgUp, or Escape, or whatever
- X else you have defined it to be), then the letters RK and
- X <Enter> (short for 'Receive Kermit').
- X KERMIT USERS:
- X Hit the <ctrl>] (control right-bracket) then the letter
- X 'c'. Then type in the word 'receive' and <Enter>. When the
- X transfer has completed, type the letter 'c' and <Enter>." >/tmp/inst$$
- X #
- X #
- X echo
- X echo "A cover letter may be sent separate from your Alex library."
- X echo "Your options are:"
- X echo " (1) Send no cover letter."
- X echo " (2) Send standard Alex instruction file"
- X echo " (3) Send your own cover letter that you have already saved in a file"
- X echo " (4) Edit the standard cover letter"
- X select=bad
- X while test $select = bad
- X do
- X $echocmmd "Type 1, 2, 3 or 4: "
- X read select
- X case x$select in
- X x1) ;;
- X x2) ;;
- X x3) flnm=err$$
- X while test ! -f $flnm
- X do
- X flnm=""
- X while test x$flnm = x
- X do
- X $echocmmd "Enter the filename of your cover letter: "
- X read flnm
- X done
- X if test ! -f $flnm
- X then
- X echo "File $flnm does not exist."
- X fi
- X done
- X cp $flnm /tmp/inst$$
- X ;;
- X x4) if test $EDITOR
- X then
- X $EDITOR /tmp/inst$$
- X else
- X editor=""
- X while test x$editor = x
- X do
- X echo "Please enter the name of your favorite editor."
- X $echocmmd "(For instance, if you use vi, just type 'vi'): "
- X read editor
- X done
- X echo "Editing file /tmp/inst$$ ..."
- X $editor /tmp/inst$$
- X fi
- X ;;
- X *) echo "Illegal option $select"
- X select=bad
- X ;;
- X esac
- X done # while test $select = bad
- X fi # if test $libname
- X mkdir /tmp/$USER$$
- X cd /tmp/$USER$$
- X #
- X # Special for TAC users: Make a .kermrc file that sets the parity to even
- X # (7 bits) and packet sizes to 40.
- X #
- X if test $tac = y
- X then
- X echo "set receive packet 40" > .kermrc
- X echo "set send packet 40" >>.kermrc
- X echo "set parity even" >>.kermrc
- X fi
- X i=Y
- X first=y
- X # Here is the general loop to upload as many files as the user wants.
- X while test $i = y -o $i = Y
- X do
- X echo
- X echo "Please start up the Send Kermit on your PC (XK in Crosstalk)."
- X if test $first = y
- X then
- X # Pause the first time to allow a CTRL-C before the Kermit starts up.
- X sleep 5
- X fi
- X first=n
- X echo
- X if test $filetype = "binary"
- X then
- X kermit -ir
- X else
- X kermit -r
- X fi
- X # Give Kermit users a chance to reconnect
- X sleep 5
- X i=""
- X while test x$i = x
- X do
- X $echocmmd "Do you want to send more files (y/n)? "
- X read i
- X done
- X done
- X rm -f .kermrc
- X #
- X # Rename any files that start with a dot, to avoid Alex conflicts.
- X #
- X if test -f .[0-z]*
- X then
- X echo "WARNING: The following files are being renamed:"
- X for i in .[0-z]*
- X do
- X echo " File $i being renamed to 0$i"
- X mv $i 0$i
- X done
- X fi
- X # First compress all the files to save room (use 12-bit compression for
- X # compatibility with the machines that don't have enough memory to compile
- X # compress with full memory).
- X if test $filetype = "binary"
- X then
- X # Binary file digest
- X compress -q -b 12 * > /dev/null
- X echo Alex library encoding starting: > /tmp/alex$$.ba
- X for i in *
- X do
- X echo --------------------- CUT HERE ------------------- >>/tmp/alex$$.ba
- X btoa $i < $i >>/tmp/alex$$.ba
- X done
- X else
- X # ASCII file digest
- X for i in *
- X do
- X echo >>/tmp/alex$$.ba
- X echo --------------------- CUT HERE ------------------- >>/tmp/alex$$.ba
- X echo 'ASCII '${i} >> /tmp/alex$$.ba
- X # Take out any CTRL-Z's from the file, and add the file to the digest
- X tr -d \\032 < $i >> /tmp/alex$$.ba
- X done
- X fi
- X rm -f *
- X cd $pwd
- X $rmdircmmd /tmp/$USER$$
- X if test $libname
- X then
- X # User specified a target filename, so he wants results saved in a file
- X # instead of being e-mailed.
- X mv /tmp/alex$$.ba $libname
- X else
- X redo=y
- X # Loop to keep trying to mail Alex library until successful, or until
- X # user gives Quit command.
- X while test $redo = y
- X do
- X # If user wants to send a cover letter...
- X if test ! $select = 1
- X then
- X echo Mailing cover letter to $to with cc: $cc and subject "$subj"
- X if $mailer $to -c $cc -s "$subj" < /tmp/inst$$
- X then
- X # Message posted OK; no errors
- X redo=n
- X else
- X # Error in message posting
- X redo=y
- X fi
- X else
- X redo=n
- X fi
- X # Now send out the regular library...
- X if test $redo = n
- X then
- X echo Sending library to $to with cc: $cc and subject "$subj"
- X if $mailer $to -c $cc -s "$subj" < /tmp/alex$$.ba
- X then
- X # Message posted OK; no errors
- X redo=n
- X else
- X # Error in message posting
- X redo=y
- X fi
- X fi
- X # If there was an error in either message posting, let the user
- X # correct the addresses.
- X if test $redo = y
- X then
- X # Error in one of the message postings
- X echo "Your options are:"
- X echo " (1) Retype electronic mail addresses"
- X echo " (2) Save Alex library in a local file"
- X echo " (3) Abort - no files saved"
- X select2=bad
- X while test $select2 = bad
- X do
- X $echocmmd "Type 1, 2 or 3: "
- X read select2
- X case x$select2 in
- X x1) echo "Just hit <enter> to keep old addresses."
- X echo
- X echo "To: $to"
- X $echocmmd "To: "
- X read totmp
- X if test "$totmp"
- X then
- X to="$totmp"
- X fi
- X echo "cc: $cc"
- X echo -n "cc: "
- X read cctmp
- X if test "$cctmp"
- X then
- X cc="$cctmp"
- X fi
- X ;;
- X x2) redo=n
- X while test ! "$flname"
- X do
- X $echocmmd "Enter local file name: "
- X read flname
- X if test "$flname"
- X then
- X mv /tmp/alex$$.ba $flname
- X fi
- X done
- X ;;
- X x3) redo=n
- X echo ALEX: Aborted
- X abort=y
- X ;;
- X *) echo "Illegal option $select2"
- X select=bad
- X ;;
- X esac
- X done
- X fi
- X done # End while loop: Library sent to valid addresses.
- X rm -f /tmp/inst$$ /tmp/alex$$.ba
- X fi # End if test $libname
- X if test $abort = n
- X then
- X echo Alex upload successfully completed.
- X fi
- X mesg y
- X # end case upload)
- X ;;
- Xdownload)
- X#****************************************************************************
- X#* (Default) Download Option *
- X#****************************************************************************
- X#
- X # Trap interrupts: Remove the temporary files and allow messages.
- X trap 'trap : 1 2 3 ;
- X rm -f /tmp/undig$$/* /tmp/decbin$$/* /tmp/decbin$$/.[0-z]* /tmp/decasc$$/* /tmp/decasc$$/.[0-z]* /tmp/decall$$/* /tmp/decall$$/.[0-z]* ;
- X $rmdircmmd /tmp/undig$$ /tmp/decall$$ /tmp/decbin$$ /tmp/decasc$$ ;
- X mesg y ; exit' 1 2 3
- X #
- X mkdir /tmp/undig$$
- X cd /tmp/undig$$
- X undigest tmp
- X # Get rid of the junk file (header from e-mail)
- X rm -f tmp0
- X # This directory will hold all the binary files
- X mkdir /tmp/decbin$$
- X # This directory will hold all the ASCII files
- X mkdir /tmp/decasc$$
- X # Make the binary directory the current one
- X cd /tmp/decbin$$
- X for i in /tmp/undig$$/tmp*
- X do
- X # See if file is binary or ASCII
- X ftype=`$headcmmd -1 $i | cut -d' ' -f1`
- X # Get file name if ASCII
- X fname=`$headcmmd -1 $i | cut -s -d' ' -f2`
- X if test "${ftype}" != "ASCII" -a "${fname}"
- X then
- X # File is binary; this is the binary directory so leave it here
- X atob -f < $i
- X else
- X # File is ASCII; put it in the ASCII directory
- X tail +2 $i > /tmp/decasc$$/$fname
- X fi
- X done
- X rm -f /tmp/undig$$/tmp*
- X $rmdircmmd /tmp/undig$$
- X #
- X # Rename any files that start with a dot, to avoid Alex conflicts.
- X #
- X if test -f .[0-z]*
- X then
- X echo "WARNING: The following binary files are being renamed:"
- X for i in .[0-z]*
- X do
- X echo " File $i being renamed to 0$i"
- X mv $i 0$i
- X done
- X fi
- X # If any files compressed, uncompress them. Note that this shouldn't
- X # cause any problems with files that happen to end in a .Z extension
- X # unless Kermit is not converting all file names to lower case (as it
- X # is supposed to).
- X if test -f *.Z
- X then
- X uncompress -q *.Z > /dev/null
- X fi
- X cd /tmp/decasc$$
- X if test -f .[0-z]*
- X then
- X echo "WARNING: The following ASCII files are being renamed:"
- X for i in .[0-z]*
- X do
- X echo " File $i being renamed to 0$i"
- X mv $i 0$i
- X done
- X fi
- X cd /tmp/decbin$$
- X echo "The following files are ready for downloading."
- X # Give the user a report on all the files that are ready for downloading
- X # In order to include both binary and text files in one listing, link all
- X # the files into another temporary directory:
- X mkdir /tmp/decall$$
- X if test -f *
- X then
- X for i in *
- X do
- X ln $i /tmp/decall$$/$i
- X done
- X fi
- X cd /tmp/decasc$$
- X if test -f *
- X then
- X for i in *
- X do
- X ln $i /tmp/decall$$/$i
- X done
- X fi
- X # Now change to that directory to give the report
- X cd /tmp/decall$$
- X echo "Times given are estimated transmission times, in minutes, to send files"
- X echo "to your PC. If you are directly connected to the Sytek cable network,"
- X echo "use the T9600 numbers. If you are using a 1200 baud modem, use T1200."
- X echo "If you are using a 4800 baud modem, use T4800, etc."
- X echo
- X echo " Filename Size T1200 T2400 T4800 T9600"
- X echo " ======================================================"
- X # The transmission times below have a fudge factor of 2.5 multiplied in
- X # to account for various communications effects that slow it down.
- X wc -c * | awk '
- X $2=="total"{printf" ------------------------------------------------------\n"}
- X {printf " %-15s %8d %6.1f %6.1f %6.1f %6.1f\n", \
- X $2, $1, $1 / 3600, $1 / 7200, $1 / 14400, $1 / 28800 }'
- X # Here are the "pure" calculated times, without the fudge factor:
- X # $2, $1, $1 / 9000, $1 / 18000, $1 / 36000, $1 / 72000 }'
- X #
- X # Now get rid of the linked files and change back to the binary directory
- X cd /tmp/decbin$$
- X rm -f /tmp/decall$$/*
- X $rmdircmmd /tmp/decall$$
- X #
- X # Special for TAC users: Make a .kermrc file that sets the parity to even
- X # (7 bits) and packet sizes to 40.
- X #
- X if test $tac = y
- X then
- X echo "set receive packet 40" > .kermrc
- X echo "set send packet 40" >>.kermrc
- X echo "set parity even" >>.kermrc
- X ln .kermrc /tmp/decasc$$/.kermrc
- X fi
- X echo
- X echo In a moment, you will see a few meaningless characters at the bottom
- X echo of your screen. When this happens, start the Receive Kermit on your PC.
- X echo
- X # Pause to allow a CTRL-C before the Kermit starts up.
- X sleep 5
- X if test -f *
- X then
- X # Download the binary files
- X kermit -is *
- X cd /tmp/decasc$$
- X if test -f *
- X then
- X # There are ASCII files, as well as binary.
- X # Pause to allow Kermit users to reconnect
- X sleep 5
- X echo
- X echo Binary file transfers complete. There are also ASCII files ready,
- X echo so you must start up the Receive Kermit again to get these files.
- X kermit -s *
- X fi
- X else
- X # Only ASCII files to download
- X cd /tmp/decasc$$
- X if test -f *
- X then
- X kermit -s *
- X else
- X echo "ALEX: Error: No files for downloading!"
- X fi
- X fi
- X rm -f /tmp/decbin$$/* /tmp/decasc$$/* /tmp/decbin$$/.kermrc /tmp/decasc$$/.kermrc
- X cd
- X $rmdircmmd /tmp/decbin$$ /tmp/decasc$$
- X echo
- X echo Alex download successfully completed.
- X echo
- X # end case download)
- X ;;
- Xencode)
- X#****************************************************************************
- X#* Encode Option *
- X#****************************************************************************
- X# Encode Option: Just encode an Alex library onto standard output
- X# from all the files listed on the command line.
- X#
- X # Trap interrupts: Remove the temporary files and allow messages.
- X trap 'trap : 1 2 3 ;
- X rm -f /tmp/$USER$$/* /tmp/$USER$$/.[0-z]* ;
- X $rmdircmmd /tmp/$USER$$ ;
- X mesg y ; exit' 1 2 3
- X #
- X mkdir /tmp/$USER$$
- X for i in $files
- X do
- X cp $i /tmp/$USER$$
- X done
- X cd /tmp/$USER$$
- X #
- X # Rename any files that start with a dot, to avoid Alex conflicts.
- X #
- X if test -f .[0-z]*
- X then
- X echo "WARNING: The following binary files are being renamed:"
- X for i in .[0-z]*
- X do
- X echo " File $i being renamed to 0$i"
- X mv $i 0$i
- X done
- X fi
- X # First compress all the files to save room (use 12-bit compression for
- X # compatibility with the machines that don't have enough memory to compile
- X # compress with default USERMEM -- this works with #define USERMEM 300000).
- X if test $filetype = "binary"
- X then
- X # Binary file digest
- X compress -q -b 12 * >/dev/null
- X echo Alex library encoding starting:
- X for i in *
- X do
- X echo --------------------- CUT HERE -------------------
- X btoa $i < $i
- X done
- X else
- X # ASCII file digest
- X for i in *
- X do
- X echo
- X echo --------------------- CUT HERE -------------------
- X echo 'ASCII '${i}
- X # Take out any CTRL-Z's from the file, and add the file to the digest
- X tr -d \\032 < $i
- X done
- X fi
- X rm -f * .[0-z]*
- X cd
- X $rmdircmmd /tmp/$USER$$
- X # end case encode)
- X ;;
- Xdecode)
- X#****************************************************************************
- X#* Decode Option *
- X#****************************************************************************
- X# Decode Option: Just decode an Alex library from standard input,
- X# and leave the files in the current directory.
- X#
- X # Trap interrupts: Remove the temporary files and allow messages.
- X trap 'trap : 1 2 3 ;
- X rm -f /tmp/undig$$/* /tmp/decod$$/* /tmp/decod$$/.[0-z]* ;
- X $rmdircmmd /tmp/undig$$ /tmp/decod$$ ;
- X mesg y ; exit' 1 2 3
- X #
- X echo "ALEX: Decode option selected"
- X pwd=`pwd`
- X mkdir /tmp/undig$$
- X undigest /tmp/undig$$/tmp
- X # Get rid of the junk file (header from e-mail)
- X rm -f /tmp/undig$$/tmp0
- X # Copy the files to another directory, so they can be decoded if necessary.
- X mkdir /tmp/decod$$
- X cd /tmp/decod$$
- X for i in /tmp/undig$$/tmp*
- X do
- X # See if file is binary or ASCII
- X ftype=`$headcmmd -1 $i | cut -d' ' -f1`
- X # Get file name if ASCII
- X fname=`$headcmmd -1 $i | cut -s -d' ' -f2`
- X if test "${ftype}" != "ASCII" -a "${fname}"
- X then
- X # File is binary
- X atob -f < $i
- X else
- X # File is ASCII: strip off all occurences of CTRL-M (carriage return)
- X # and CTRL-Z (MSDOS EOF) from the file.
- X tail +2 $i |tr -d \\015 |tr -d \\032 > $fname
- X fi
- X done
- X rm -f /tmp/undig$$/*
- X $rmdircmmd /tmp/undig$$
- X # Now uncompress any compressed files
- X if test -f *.Z
- X then
- X uncompress -q *.Z >/dev/null
- X fi
- X # And finally move them all back to the user's original directory
- X cd $pwd
- X mv /tmp/decod$$/* .
- X $rmdircmmd /tmp/decod$$
- X # end case decode)
- X ;;
- Xlist)
- X#****************************************************************************
- X#* List Option *
- X#****************************************************************************
- X# List Option: List all files in an Alex library (from standard input).
- X#
- X # Trap interrupts: Remove the temporary files and allow messages.
- X trap 'trap : 1 2 3 ;
- X rm -f /tmp/undig$$/* /tmp/decod$$/* /tmp/decod$$/.[0-z]* ;
- X $rmdircmmd /tmp/undig$$ /tmp/decod$$ ;
- X mesg y ; exit' 1 2 3
- X #
- X echo "ALEX: List option selected"
- X mkdir /tmp/undig$$
- X undigest /tmp/undig$$/tmp
- X # Get rid of the junk file (header from e-mail)
- X rm -f /tmp/undig$$/tmp0
- X # Copy the files to another directory, so they can be decoded if necessary.
- X mkdir /tmp/decod$$
- X cd /tmp/decod$$
- X for i in /tmp/undig$$/tmp*
- X do
- X # See if file is binary or ASCII
- X ftype=`$headcmmd -1 $i | cut -d' ' -f1`
- X # Get file name if ASCII
- X fname=`$headcmmd -1 $i | cut -s -d' ' -f2`
- X if test "${ftype}" != "ASCII" -a "${fname}"
- X then
- X # File is binary
- X atob -f < $i
- X else
- X # File is ASCII
- X tail +2 $i > $fname
- X fi
- X done
- X rm -f /tmp/undig$$/*
- X $rmdircmmd /tmp/undig$$
- X # Now uncompress any compressed files
- X if test -f *.Z
- X then
- X uncompress -q *.Z >/dev/null
- X fi
- X # And finally give the user a listing.
- X echo "Times given are estimated transmission times, in minutes, to send files"
- X echo "to your PC. If you are directly connected to the Sytek cable network,"
- X echo "use the T9600 numbers. If you are using a 1200 baud modem, use T1200."
- X echo "If you are using a 4800 baud modem, use T4800, etc."
- X echo
- X echo " Filename Size T1200 T2400 T4800 T9600"
- X echo " ======================================================"
- X # The transmission times below have a fudge factor of 2.5 multiplied in
- X # to account for various communications effects that slow it down.
- X wc -c * | awk '
- X $2=="total"{printf" ------------------------------------------------------\n"}
- X {printf " %-15s %8d %6.1f %6.1f %6.1f %6.1f\n", \
- X $2, $1, $1 / 3600, $1 / 7200, $1 / 14400, $1 / 28800 }'
- X # Here are the "pure" calculated times, without the fudge factor:
- X # $2, $1, $1 / 9000, $1 / 18000, $1 / 36000, $1 / 72000 }'
- X #
- X rm -f *
- X cd
- X $rmdircmmd /tmp/decod$$
- X # end case list)
- X ;;
- Xquick)
- X#****************************************************************************
- X#* Quick Option *
- X#****************************************************************************
- X# Quick Option: Give a quick listing of all files in an Alex library
- X# (from standard input).
- X echo "ALEX: Quick list option selected"
- X awk '
- X BEGIN { dsh1=99999; dsh2=99999 }
- X /------/ { if ($2=="CUT" && $3=="HERE") dsh1=NR+1 }
- X dsh1==NR && $1=="ASCII" { printf "%-15s (ASCII)\n", $2; dsh1=99999 }
- X dsh1==NR && $1!="ASCII" { dsh2=NR+1; dsh1=99999 }
- X dsh2==NR { dsh2=99999; x=index($1,".Z");
- X if (x>0) printf ("%-15s (BINARY)\n", substr($1,1,x-1));
- X else printf "%-15s (BINARY)\n", $1 }'
- X ;;
- Xesac
- X#
- Xmesg y
- ________This_Is_The_END________
- if test `wc -l < alex` -ne 846; then
- echo 'shar: alex was damaged during transit (should have been 846 bytes)'
- fi
- fi ; : end of overwriting check
- echo 'x - alex.1'
- if test -f alex.1; then echo 'shar: not overwriting alex.1'; else
- sed 's/^X//' << '________This_Is_The_END________' > alex.1
- X.TH ALEX 1C LOCAL
- X.SH NAME
- Xalex, undigest \- automatic library exchange for PC-to-PC and PC-to-Unix
- Xfile transfers
- X.SH SYNOPSIS
- X.B alex
- X[options]
- X.br
- X.B undigest
- Xfilemask
- X.SH DESCRIPTION
- X.I Alex
- Xis a program that allows automatic transfer of groups of files
- X(either ASCII or binary)
- Xbetween personal computer users, using the Kermit file
- Xtransfer protocol and electronic mail.
- X.PP
- XArguments are optional. The easiest way to use
- X.I Alex
- Xis from within one of the electronic mail programs, Msg or Mailx.
- XWhen a message created by
- X.I Alex
- Xis received in Msg, the user may type 'l' (list), followed by the message
- Xnumber. When the query 'To file/pipe:' is received, the user should
- Xrespond: |alex
- X.PP
- XIn Mailx, the user may simply type: '|<message #> alex' (without
- Xthe quotes). For instance: |2 alex
- X.PP
- XThe user will be presented with a list of all the files ready to be sent
- Xto the PC, together with the file sizes and an estimate of the number of
- Xminutes required to send each file (and a total, if there is more than
- Xone file). There are four columns
- Xof times, labeled T1200, T2400, T4800 and T9600, corresponding
- Xrespectively to times for 1200, 2400, 4800 and 9600 baud communications.
- XIf an ARDEC user is unsure of his computer's baud rate, it is probably
- Xoperating at 9600 baud.
- X.PP
- XFollowing the table of file transfer times, the user will be asked
- Xto start up the Receive Kermit transfer on his personal computer.
- X.I Alex
- Xoptions include:
- X.TP 8
- X.B \-tac
- XThis option tells Alex to use Kermit with 40-byte packets, even parity,
- Xand seven data bits, for compatibility with the Picatinny TAC. TAC users
- Xare required to use this option; others should not. (Normally, Alex
- Xuses the default Unix Kermit parameters, which are 90 byte packets, no
- Xparity, and eight data bits.)
- X.TP
- X.B \-u
- XUpload a file or set of files and send via electronic mail.
- XThe user is presented with a menu for including an optional cover letter
- Xwith his
- X.I Alex
- Xlibrary transmission. Options are (1) Send no cover letter, (2) Send standard
- X.I Alex
- Xinstruction file (a general message explaining how to download an
- X.I Alex
- Xlibrary from Mailx or Msg, using either the Crosstalk
- Xor Kermit communications programs on a PC), (3) Send your own cover letter
- Xthat you have already saved in a file, or (4) Edit the standard cover
- Xletter. If item 4 is selected,
- X.I Alex
- Xchecks for the existence of the
- Xenvironment variable EDITOR, and executes it if it exists. If no EDITOR
- Xenvironment variable has been defined,
- X.I Alex
- Xprompts the user for the name of his favorite editor.
- XFollowing cover letter selection, the
- Xuser is prompted to begin sending files via Kermit.
- X.TP
- X.B \-u libname
- XUpload a file or set of files and store the encoded library in a file
- Xcalled libname. (This is generally only used by a file archive maintainer,
- Xto keep copies of an
- X.I Alex
- Xlibrary on the Unix system for later transmission.) Naturally, no cover
- Xletter is sent for this option.
- X.TP
- X.B \-l
- XList the contents of an
- X.I Alex
- Xlibrary. The library should be supplied on the standard input. Output
- Xis just like the table produced prior to downloading.
- X.TP
- X.B \-q
- XQuick listing of the contents of an
- X.I Alex
- Xlibrary. This is just like the -l option, but much faster. However,
- Xit does not give file sizes or transmission times.
- X.TP
- X.B \-h
- XGives a quick "help" summary of the
- X.I Alex
- Xoptions.
- X.SS FOR ADVANCED USERS:
- XThe remainder of this manual entry is for advanced users only. These
- Xoptions should not be used
- Xby anyone who does not have a thorough understanding of file formats and
- Xthe ASCII codes. Other users who require a more detailed explanation of the
- X.I Alex
- Xoptions (either basic or advanced) should consult the complete
- X.I Alex
- XUser's Guide (available by electronic mail from <msdos-request@ARDEC>).
- X.TP 8
- X.B \-a
- XThis option is provided for users who wish to upload plain text (ASCII) files
- Xand send them out in a form that is readable on the Unix system.
- XThis option is not necessary for the average user, since plain text files
- Xare automatically treated properly by
- X.I Alex
- Xfor transfer between PC's.
- XIt is only provided for advanced users who wish to be able to read their
- X.I Alex
- Xlibraries on the Unix system. This option is ignored if used in
- X.I Alex
- Xdownload mode (the default), since
- X.I Alex
- Xautomatically recognizes whether a file was uploaded in ASCII mode or
- Ximage mode, and sends it properly. Since this is done on
- Xa file-by-file basis, users may even construct
- X.I Alex
- Xlibraries that contain a mixture of ASCII and binary files.
- XWARNING: If a text file happens to contain a line that begins with several
- Xdashes, it will be undigested at that line and an error will result.
- X.TP
- X.B \-d
- XThis is a "low-level" command to decode an
- X.I Alex
- Xlibrary (from standard input) and leave the files in the user's current
- Xdirectory. No file transfers or electronic mail are supported.
- XIt should be noted
- Xthat text files which originated on a PC will be unreadable on the Unix
- Xsystem, unless they were uploaded with the ASCII option.
- XThis option may not be used in conjunction with any other option.
- X.TP
- X.B \-e file1 [file2 ...]
- XThis is the inverse function of decode, allowing the user to encode an
- X.I Alex
- Xlibrary from files that already exist on the Unix system. No file transfers
- Xor electronic mail are supported. The named file (or files) are read,
- Xencoded into
- X.I Alex
- Xformat, and placed on the standard output. It is the responsibility of the
- Xuser to redirect this output to a file, for example:
- X.sp 1
- X.ti +6
- Xalex -e foo1 foo2 > foo.lib
- X.sp 1
- Xwill encode the files foo1 and foo2, and place the encoded library in
- Xfoo.lib. This option may not be used
- Xin conjunction with any other option except ASCII.
- X.PP
- X.I Undigest
- Xreads a "digested" message (one message that contains any number of files
- Xwithin it, which need to be separated) from the
- Xstandard input, and breaks the message into files.
- X.PP
- XFile names are assigned using the filemask provided on the command line to
- X.I Undigest.
- XA file number is appended to the filemask. For instance, if the filemask is
- X"foo", and the digested message contains three files within it, the three
- Xfiles will be given the names "foo0", "foo1", and "foo2".
- X.PP
- XThe separator between files in a digestified message is a line beginning
- Xwith at least five dashes.
- X.PP
- X.I Alex
- Xworks in download mode by first Undigesting its input, then decoding the
- Xundigested binary files using Atob, Uncompressing the files if they end in
- Xa .Z extension, and finally sending the files to the PC via Kermit. The
- Xupload mode does the reverse process, receiving files from the PC via
- XKermit, Compressing them (if binary mode is used), encoding them using Btoa
- X(again, only if binary), digestifying the
- Xfiles by concatenating them into one large file separated by a line of
- Xdashes, and optionally sending them out through the system mailer.
- X.SH DIAGNOSTICS
- X.TP 8
- X.B bad format or Csum to atob
- XThis message occurs when a file has been corrupted in the
- X.I Alex
- Xlibrary, usually by the electronic mail system. The originator should
- Xresend the library.
- X.TP
- X.B ALEX: Cannot specify more than one of...
- XUpload, Decode, Encode, List and Quick List are distinct options that
- Xcannot be used together.
- X.TP
- X.B (USER) Unknown user name in "username"
- X.B Message posting aborted
- XThis message occurs when an illegal electronic mail address is specified.
- X.TP
- X.B -- file unchanged
- XThis message (issued by Compress) merely tells the user that compression
- Xwas not necessary on one of his files. It can be ignored.
- X.SH FILES
- X.TP 8
- X.B /tmp/$USER$$, /tmp/undig$$, /tmp/decall$$, /tmp/decbin$$,
- X.B /tmp/decasc$$
- X(where $$ is the process id and $USER is the user
- Xname) - temporary directories to store intermediate files in the transfer
- X.TP
- X.B /tmp/alex$$.ba
- X- temporary file for the final encoded library
- X.TP
- X.B /tmp/inst$$
- X- temporary file to hold instructions for use of
- X.I Alex.
- X.TP
- X.B /tmp/$USER$$/.kermrc
- X- the Kermit initialization instructions for TAC users.
- X.SH SEE ALSO
- Xkermit(1), btoa(1C), compress(1C), msg(1), mailx(1), v6mail(1)
- X.SH AUTHORS
- XKen Van Camp, Jim Steiner
- X.SH BUGS
- XFile transmission times have been increased by a fudge factor of 2.5
- Xover the standard calculated times, to account for actual times
- Xexperienced using Kermit.
- X.PP
- XNo more than one address can be specified on either the To: or cc:
- Xlines when using the Alex upload option, due to a quirk in the v6mail
- Xprogram. Consequently, an Alex library cannot be sent to more than two
- Xpeople (unless it is first uploaded to a file, then included in a
- Xmessage through Msg or Send).
- ________This_Is_The_END________
- if test `wc -l < alex.1` -ne 226; then
- echo 'shar: alex.1 was damaged during transit (should have been 226 bytes)'
- fi
- fi ; : end of overwriting check
- exit 0
-