--- movelog.c.orig	Sat Sep 28 19:46:17 1991
+++ movelog.c	Sun Aug  3 09:33:25 2008
@@ -17,6 +17,7 @@
 #include	"defs.h"
 #include	"globals.h"
 #include	<string.h>
+#include        <stdlib.h>
 #include	<sys/file.h>
 #include	<ctype.h>
 #ifdef SVR4
@@ -745,6 +746,7 @@
 FILE	*fp;
 char	buf[1024], buf2[1024];
 char	*dp;
+int	c;
 
 	fname = remove_newlines(fname);
 	if ((fp = fopen(fname, "r")) == NULL)	{
@@ -756,7 +758,8 @@
 
 	/* read card string */
 	dp = buf;
-	while ((*dp = (char)fgetc(fp)) != EOF)	{
+	while ((c = fgetc(fp)) != EOF)	{
+		*dp = c;
 		if (*dp == '\n')	/* ignore any CR */
 			continue;
 		if (*dp == '.')
@@ -767,7 +770,8 @@
 
 	/* read moves string */
 	dp = buf2;
-	while ((*dp = (char)fgetc(fp)) != EOF)	{
+	while ((c = fgetc(fp)) != EOF)	{
+		*dp = c;
 		if (*dp == '\n')	/* ignore any CR */
 			continue;
 		if (*dp == '.')
