#
#  Replacement calendar program
#  By: Gregg Wonderly <gregg@okstate> on 01/24/86

PATH=/bin:/usr/local/bin
tmp=/tmp/Cal$$
cal=".calendar"
lib=/usr/local/lib
trap "rm $tmp;exit" 1 2 13 15

case $1 in
-)
	sed 's/\([^:]*\):.*:\(.*\):[^:]*$/dir=\2 login=\1/' /etc/passwd | \
	while read x
	do
		eval $x
		if test -r $dir/$cal; then
			$lib/calendar $dir/$cal >$tmp
			if test -s $tmp; then
				/bin/mail $login -f "Reminder Service" <$tmp >/dev/null 2>&1
			fi
			rm $tmp
		fi
	done;;
*)
	$lib/calendar;;
esac
