#!/bin/sh 

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

MAIL=/usr/ucb/mail

game=$1
GDIR=$HOME/$game
cd $GDIR

for x in `awk -F: '{printf ("%s ",$1)}' $GDIR/races:players` ; do
  whom=`grep ^"${x}:" $GDIR/races:players | awk -F: '{print $2}'`
  echo $x |grep '^#'  >/dev/null
  if [ $? = 0 ] ; then
    (echo "These are the players to whom you ($x) can presently forward:";\
     echo ""; grep ^$x $GDIR/X-ref) | $MAIL -s "$game Forwarding list" $whom
  fi
done

exit 0
