#!/bin/sh
#
# send files from any machine at Cypress to remote site. scn 5/16/91
#
username=""
filename=""
remotesite=""
opt=""
modemsys="hilbert"
mesg="Usage: $0 [-m user] file remote-site"

# check number of parameters

if test  $# -lt 2
	then
		echo "Missing parameters!"
		echo $mesg
		exit
fi

if test  $# -gt 4
	then
		echo "Too many parameters!"
		echo $mesg
		exit
fi

# trap nasty signals

trap "trap '' 0; exit" 0 1 2 13 15

#	get parameters

if test $1 = "-m"
	then
		username="$2"
		filename="$3"
		remotesite="$4"
	else
		filename="$1"
		remotesite="$2"
fi

if test ! -f $filename
	then
		echo "File $filename not found!"
		exit
fi

if test $username
	then
		echo "Sending file $filename to site $remotesite, and email to $username."
		opt="-m -n$username"
	else
		echo "sending file $filename to site $remotesite."
		opt="-m"
fi
		
/usr/ucb/rcp $filename $modemsys:/usr/spool/uucppublic
/usr/ucb/rsh $modemsys /bin/uucp $opt /usr/spool/uucppublic/$filename $remotesite\\!/usr/spool/uucppublic
