home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume11
/
mailsplit2.7
/
part01
/
undoc
< prev
Wrap
Text File
|
1990-03-29
|
7KB
|
145 lines
Since I tore the comments out of the code, and it is not customary to send
SCCS files around the net, I made this auxiliary file of documentation.
An alphabetical list of variables, their use and meaning:
AR = argument
CM = command line
CO = compress program may be arc, etc.
DB = Debug level (Verbosity level)
DE = Delay between pieces
FC = file count
FL = File list (build up file list from params on command line in
FL = any order (see /usr/bin/spell) for a good example of obfuscated,
FL = clever parsing code
LI = the number of lines to split pieces into
MA = mail transport agent
ME = the name of the program running
MF = Mail flags to send to transport
R = range of pieces to be re-sent during parse stage
RA = range of pieces to be re-sent if mailers on the way failed
SE = send flag; if true, send the piece. If false, don't
SP = the name of the split program
SU = subject of message (defaults to first file name)
T1 = temporary file containing output of tar and compress.
T2 = temporary file containing uuencoded stuff
T3 = temporary file(s) containing split pieces
TA = tar program (may be shar, tar, cat, etc ;-)
TD = Temporary directory in which temp files should go can be . or /tmp.
TM = Test-mode flag (-n option of make) Don't do anything, just
TM = echo what you would have done if testmode option not on.
TO = recipient(s) of message
UU = the uuencode program (may be replaced with btoa / atob ;-)
VE = version number
f = file name (piece) during loop which sends pieces
i = a loop index used during parse of the range of files to be re-sent
max= The loop-limit used in parse of range of files to be re-sent
max= is assumed to be 99 if no top-of-range is given.
n = piece number during the loop which sends pieces via mail
ne = next param on command line (after flag is set, next param gets
ne = eval'd to the var set in ne (see above)
t = a specific token containing a range to be expanded (n-m)
tok= Token during parse of range of files to be re-sent
History:
# Coder Date Comments
#------------ -------- ---------------------------------------------------
# M F Wyle 02nov87 Shamelessly stolen from tarmail :-)
# WRU 18feb88 changed variable MAILER, added SPLITTER,
# LINES, USER and a warning about uudecode
# M F Wyle 25mar88 Add tar, extract join-script in 1st msg
# WRU 03apr88 fixed some quoting problems in "echo"-strings
# cosmetic changes: renamed "mailsplit"
# created THISNAME
# fixed some typos, added Email-addresses, example,
# section for suggested improvements
# MFW 05apr88 Fix more quoting problems in echo strings (shell
# variables); added /bin/rm cleanup to join-script
# MFW 21jun88 based on WRU's suggestions:
# 1) add file-name to subject
# 2) verbose explanations
# 3) add parts-order checking! Yippeee!
# MFW 08jul88 Fix uudecode setuid bug
# MFW 12jul88 Fix empty or no files bug, added FILECOUNT
# MFW 17jul88 Added umask 0, delay before mail, check after split
# MFW 19jul88 Major re-write for flags, verbose, sccs control
# MFW 25jul88 Added a range-parser, more flags, some documentation
# Up'd release to 2.0 for distribution
# MFW 29jul88 Fixed 8 separate bugs; upgraded join-script
# to accept pieces out of order and duplicate pieces.
# MFW 04Aug88 Fixed more bugs; added comments, put sys-specific
# stuff at the top for configuring. hacked join
# script because it leaks bugs like an ant-hill.
#
# All the comments from the net about parsing ranges
# won't fix the *@&$#& bugs in join.
# MFW 11Aug88 Fixed joinr. Added -N flag, wrote Configure script,
# tested on a slew of machines
# MFW 18Aug88 made joinr compatible with old awk, added exit
Verbal description of algorithm:
====== =========== == ==========
When the program starts, it initializes some variables, then parses the
entire command line. It builds up a list of non-flag options in the F
variable. The first parameter in F is the e-mail path. All others are
files or directories.
If no subject is set via the "-s subject" flag, the subect is assigned
from the first file to send. The three temporary file names (variables
T1, T2, and T3) are then assigned.
The range of pieces to be re-sent is parsed.
Debugging output is echo'd to standard out as appropriate for the
debugging level. If the -t or -n option is set, nothing is really
done, except printing out what would have happened.
The tar, compress, split commands are performed, with appropriate
verbosity for the debugging level. Certain checks are made along the
way to verify that the commands did not fail. If one fails, the
program exits with an appropriate failure message.
The files created in $T3* are sent via mail one at a time, with
delays. The first file sent has a join-script pre-pended. A file
counter $n is used to label the subject lines.
The temporary files are deleted.
* * *
The join script which comes with each 1st message sent by mailsplit was
upgraded to accept out-of-order pieces and repeated sequences of
pieces. It ignores repeats, and glues the pieces together in their
proper order. These features involve saving each piece in a separate
file named by it's part number, and saving it only once. awk(1) can
accomplish this task easily. An associative array is formed,
containing all of the pieces seen by the script. If a piece comes
through a second time, the script notices by looking in the associative
array. Duplicate pieces are piped into the file /tmp/garbage (perhaps
I should parameterize this name?) and later deleted. Since the first
pass is now really a sort filter of the pieces, cat(1) is used to push
the sorted pieces together into uudecode.
The join script in 2.4 sucks rocks. I'm re-writing the @#*@ with
more error-checking, comments, configurable variables, and maybe it'll
work on somebody else's *@&$ machine! Can you say, "Test?"
New features in 2.5:
- There is a flag for turning off sending the joinr script.
- The joinr script is a "here" document and is spit into a temp directory
at startup.
- The package comes with a Configure script (a la Larry Wall) which will
configure site-specific commands, parameters and install the sucker!
- sccs blew up. I may move to rcs.
- Expect a better Configure script from metaconfig by 3.0
New features in 2.6:
+ joinr is LESS robust for compatibility with old awk. Expect machine-
specific joinr scripts from an intelligent Config script in 3.0
New features in 2.7:
-Use a generic subject name "archive" to strip directory names in long
paths.