
if test $# -lt 3; then
  echo "Usage: tarmail mailpath \"subject-string\" directory-or-file(s)"
  exit
else
  mailpath=$1
  echo "mailpath = $mailpath"
  shift
  subject="$1"
  echo "subject-string = $subject"
  shift
  echo files = $*
  tar cvf - $* | compress | btoa | split -700 - /tmp/tm$$
  n=1
  set /tmp/tm$$*
  for f do
    {
	echo '---start beef'
	cat $f
	echo '---end beef'
    } | Mail -s "$subject - part $n of $#" $mailpath
    n=`expr $n + 1`
  done
  rm /tmp/tm$$*
fi
