[net.chess] Move sending scrip

jeff@heurikon.UUCP (02/10/84)

I have found this script helpful in sending off game moves.
When a move comes in, I use a mail command to append the message
to the end of the apprpriate "./chess/<whoever>" file for that game.
Then I edit the end of the file, add my next move, exit the
editor and enter "send <whoever>"  This script ("send") mails
the move to the opponent and records that fact in a "log" file.

Does anybody else have some ideas along these lines?  Please post.

###################################################################
:
# Send and log game moves.  Game moves may be sent in one of two ways:
#   If no arguments:  All game[0-9]* files are checked.  Any which
#     have a lone "." on the last line of the game[0-9]* file will
#     be sent.  The last line of each such file will be deleted.
#   With arguments:  All filenames passed as arguments will be sent.
#     No changes will be made to the files.
# In either case, it is assumed that the first line of the file
#   is the destination path for 'mail' and that .. is your home dir.
#
if test $# -gt 0 ; then
	for i do
		dest=`head -1 $i`
		echo ---- | cat $i - ../.signature | mail $dest
		echo  `date` Sent $i move to $dest >> log
	done
else
	for i in game[0-9]* ; do
		if test "`tail -1 $i` " = ". " ; then
			dest=`head -1 $i`
			ed $i > /dev/null <<-"CMDS"
				$,$d
				w
				q
				CMDS
			echo ---- | cat $i - ../.signature | mail $dest
			echo  `date` Sent $i move to $dest >> log
		fi
	done
fi
exit
-- 
/"""\	Jeffrey Mattox, Heurikon Corp, Madison, WI
|O.O|	{harpo, hao, philabs}!seismo!uwvax!heurikon!jeff  (news & mail)
\_=_/				     ihnp4!heurikon!jeff  (mail - fast)