home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # tamsend version 1.0, 4/23/90.
- # Placed into the public domain by Daniel J. Bernstein.
- # Requires rewind, u@h2h, u@h2u.
- USER="`whoami`"
- HOST="`hostname`.my.domain"
- umask 077
- exec 4>/tmp/tam1.$$ 5</tmp/tam1.$$
- exec 8>/tmp/tam2.$$ 9</tmp/tam2.$$
- rm /tmp/tam1.$$ /tmp/tam2.$$
- if echo "Sent-From: $USER@$HOST" >&4 \
- && echo "Sent-Date: `date`" >&4 \
- && echo "Sent-To: $*" >&4 \
- && echo "" >&4 \
- && cat >&4
- then
- ( for TO
- do
- case "$TO" in
- *@*) ;;
- *) TO="$TO@`hostname`";;
- esac
- export TO
- authtcp -vR -- "`printenv TO | u@h2h`" tam \
- sh -c 'printenv TO | u@h2u >&6;
- head -1 <&6 | grep . ||
- { multitee 5:6,8; rewind 4; rewind 5;
- multitee 9:4; rewind 8; rewind 9; }' \
- || echo "tamsend: ERROR: cannot send to $TO"
- done
- echo ""; echo "----- Message follows -----"; echo ""
- cat <&5 ) 2>&1 | mail -s 'TAM log' "$USER" &
- fi
-