openbsd-ports/games/spider/patches/patch-movelog_c
2010-05-22 21:31:57 +00:00

50 lines
1.1 KiB
Plaintext

--- movelog.c.orig Sat Sep 28 19:46:17 1991
+++ movelog.c Sat May 22 23:29:46 2010
@@ -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
@@ -31,7 +32,10 @@ static int cache_size = 0;
int deck_cache[NUM_CARDS];
int deck_index = 0;
+
extern int cheat_count;
+static int card_to_int(CardPtr);
+static int restore_game(char *, char *);
make_deck_cache()
{
@@ -745,6 +749,7 @@ char *fname;
FILE *fp;
char buf[1024], buf2[1024];
char *dp;
+int c;
fname = remove_newlines(fname);
if ((fp = fopen(fname, "r")) == NULL) {
@@ -756,7 +761,8 @@ char *dp;
/* 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 +773,8 @@ char *dp;
/* 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 == '.')