#!/bin/sh 

if [ x$1 = x -o x$2 = x ] ; then
  echo "Usage p-Can-Fwd <game> <race>"
  exit 1
fi

game=$1
race=$2

cd $HOME/$game

whom=`grep -i '^'$race":" races:players | awk -F: '{print $2}'`

grep -i '^'${race}: $HOME/$game/X-ref > /tmp/$$.fwdlist

if [ -s /tmp/$$.fwdlist ] ; then
echo whom is $whom
(echo "These are the players to whom you ($race) can presently forward:";\
 echo ""; grep -i '^'${race}: $HOME/$game/X-ref) | /usr/ucb/mail -s "$game Forwarding list" $whom
else
echo "$race can not forward?" | mail -s "$game fwdlist problem" bampton
fi

rm /tmp/$$.fwdlist

exit 0
