home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume22 / auth-utils / part01 / tam / tamsend < prev    next >
Encoding:
Text File  |  1990-04-29  |  905 b   |  34 lines

  1. #!/bin/sh
  2. # tamsend version 1.0, 4/23/90.
  3. # Placed into the public domain by Daniel J. Bernstein.
  4. # Requires rewind, u@h2h, u@h2u.
  5. USER="`whoami`"
  6. HOST="`hostname`.my.domain"
  7. umask 077
  8. exec 4>/tmp/tam1.$$ 5</tmp/tam1.$$
  9. exec 8>/tmp/tam2.$$ 9</tmp/tam2.$$
  10. rm /tmp/tam1.$$ /tmp/tam2.$$
  11. if echo "Sent-From: $USER@$HOST" >&4 \
  12. && echo "Sent-Date: `date`" >&4 \
  13. && echo "Sent-To: $*" >&4 \
  14. && echo "" >&4 \
  15. && cat >&4
  16. then
  17.   ( for TO
  18.     do
  19.       case "$TO" in
  20.         *@*) ;;
  21.         *) TO="$TO@`hostname`";;
  22.       esac
  23.       export TO
  24.       authtcp -vR -- "`printenv TO | u@h2h`" tam \
  25.     sh -c 'printenv TO | u@h2u >&6;
  26.            head -1 <&6 | grep . ||
  27.            { multitee 5:6,8; rewind 4; rewind 5;
  28.          multitee 9:4; rewind 8; rewind 9; }' \
  29.       || echo "tamsend: ERROR: cannot send to $TO"
  30.     done
  31.     echo ""; echo "----- Message follows -----"; echo ""
  32.     cat <&5 ) 2>&1 | mail -s 'TAM log' "$USER" &
  33. fi
  34.