1 diff -crB ../cgames-2.2/cblocks/answers.c .//cblocks/answers.c
2 *** ../cgames-2.2/cblocks/answers.c 2000-09-17 16:12:51.000000000 +0000
3 --- .//cblocks/answers.c 2010-03-29 14:04:10.775154616 +0000
12 /* The directory containing the user's solution files.
19 ! n = getline(fp, buf, sizeof buf);
22 if (*buf != '\n' && *buf != ';')
27 ! n = ggetline(fp, buf, sizeof buf);
30 if (*buf != '\n' && *buf != ';')
31 diff -crB ../cgames-2.2/cblocks/fileread.c .//cblocks/fileread.c
32 *** ../cgames-2.2/cblocks/fileread.c 2000-09-17 16:11:45.000000000 +0000
33 --- .//cblocks/fileread.c 2010-03-29 14:04:00.139318389 +0000
36 /* Read one full line from fp and store the first len characters in
39 ! int getline(FILE *fp, char *buf, int len)
44 /* Read one full line from fp and store the first len characters in
47 ! int ggetline(FILE *fp, char *buf, int len)
54 ch = fgetc(series->mapfp);
56 ! getline(series->mapfp, buf, sizeof buf);
58 for (n = 1 ; isspace(buf[n]) ; ++n) ;
59 strncpy(series->name, buf + n, sizeof series->name - 1);
62 ch = fgetc(series->mapfp);
64 ! ggetline(series->mapfp, buf, sizeof buf);
66 for (n = 1 ; isspace(buf[n]) ; ++n) ;
67 strncpy(series->name, buf + n, sizeof series->name - 1);
68 diff -crB ../cgames-2.2/cblocks/fileread.h .//cblocks/fileread.h
69 *** ../cgames-2.2/cblocks/fileread.h 2000-09-17 16:12:37.000000000 +0000
70 --- .//cblocks/fileread.h 2010-03-29 14:04:00.145152009 +0000
73 * buf are lost. The return value is the length of the string stored
74 * in buf, or -1 if fgets() returned NULL.
76 ! extern int getline(FILE *fp, char *buf, int len);
78 /* Find the puzzle files and allocate an array of gameseries
79 * structures for them.
81 * buf are lost. The return value is the length of the string stored
82 * in buf, or -1 if fgets() returned NULL.
84 ! extern int ggetline(FILE *fp, char *buf, int len);
86 /* Find the puzzle files and allocate an array of gameseries
87 * structures for them.
88 diff -crB ../cgames-2.2/cblocks/movelist.c .//cblocks/movelist.c
89 *** ../cgames-2.2/cblocks/movelist.c 2000-09-07 21:13:01.000000000 +0000
90 --- .//cblocks/movelist.c 2010-03-29 14:04:10.775154616 +0000
99 /* Initialize or reinitialize list as empty.
101 diff -crB ../cgames-2.2/cblocks/parse.c .//cblocks/parse.c
102 *** ../cgames-2.2/cblocks/parse.c 2000-09-10 03:47:09.000000000 +0000
103 --- .//cblocks/parse.c 2010-03-29 14:04:00.145152009 +0000
106 memset(map, ' ', fmi->ysize * fmi->xsize);
108 for (y = 0 ; y < fmi->ysize ; ++y) {
109 ! n = getline(fp, buf, sizeof buf);
110 if (n < 0 || *buf == ';')
114 memset(map, ' ', fmi->ysize * fmi->xsize);
116 for (y = 0 ; y < fmi->ysize ; ++y) {
117 ! n = ggetline(fp, buf, sizeof buf);
118 if (n < 0 || *buf == ';')
126 ! n = getline(fp, buf, sizeof buf);
129 if (!n || *buf == ';')
134 ! n = ggetline(fp, buf, sizeof buf);
137 if (!n || *buf == ';')
138 diff -crB ../cgames-2.2/cblocks/play.c .//cblocks/play.c
139 *** ../cgames-2.2/cblocks/play.c 2000-11-11 13:13:17.000000000 +0000
140 --- .//cblocks/play.c 2010-03-29 14:04:10.775154616 +0000
147 + #include <string.h>
149 /* The bits of a cell that move with a block.
151 diff -crB ../cgames-2.2/csokoban/answers.c .//csokoban/answers.c
152 *** ../cgames-2.2/csokoban/answers.c 2000-11-05 00:30:18.000000000 +0000
153 --- .//csokoban/answers.c 2010-03-29 14:04:00.145152009 +0000
159 ! n = getline(fp, buf, sizeof buf);
162 if (*buf != '\n' && *buf != ';')
167 ! n = ggetline(fp, buf, sizeof buf);
170 if (*buf != '\n' && *buf != ';')
173 game->movebestcount = n;
174 game->movebestpushcount = m;
176 ! if (getline(fp, buf, sizeof buf) <= 0
177 || sscanf(buf, "%d moves, %d pushes", &n, &m) < 2
178 || !readanswer(fp, &game->pushanswer, n)) {
179 copymovelist(&game->pushanswer, &game->moveanswer);
181 game->movebestcount = n;
182 game->movebestpushcount = m;
184 ! if (ggetline(fp, buf, sizeof buf) <= 0
185 || sscanf(buf, "%d moves, %d pushes", &n, &m) < 2
186 || !readanswer(fp, &game->pushanswer, n)) {
187 copymovelist(&game->pushanswer, &game->moveanswer);
188 diff -crB ../cgames-2.2/csokoban/fileread.c .//csokoban/fileread.c
189 *** ../cgames-2.2/csokoban/fileread.c 2000-09-17 16:19:59.000000000 +0000
190 --- .//csokoban/fileread.c 2010-03-29 14:04:00.145152009 +0000
193 /* Read one full line from fp and store the first len characters in
196 ! int getline(FILE *fp, char *buf, int len)
201 /* Read one full line from fp and store the first len characters in
204 ! int ggetline(FILE *fp, char *buf, int len)
213 ! n = getline(fp, buf, sizeof buf);
216 if (ch == ';' && *buf == ';') {
221 ! n = ggetline(fp, buf, sizeof buf);
224 if (ch == ';' && *buf == ';') {
230 ! getline(fp, buf + 1, sizeof buf - 1);
238 ! ggetline(fp, buf + 1, sizeof buf - 1);
245 ch = fgetc(series->mapfp);
247 ! getline(series->mapfp, buf, sizeof buf);
249 for (n = 1 ; isspace(buf[n]) ; ++n) ;
250 strncpy(series->name, buf + n, sizeof series->name - 1);
253 ch = fgetc(series->mapfp);
255 ! ggetline(series->mapfp, buf, sizeof buf);
257 for (n = 1 ; isspace(buf[n]) ; ++n) ;
258 strncpy(series->name, buf + n, sizeof series->name - 1);
259 diff -crB ../cgames-2.2/csokoban/fileread.h .//csokoban/fileread.h
260 *** ../cgames-2.2/csokoban/fileread.h 2000-09-17 16:19:32.000000000 +0000
261 --- .//csokoban/fileread.h 2010-03-29 14:04:00.145152009 +0000
264 * buf are lost. The return value is the length of the string stored
265 * in buf, or -1 if fgets() returned NULL.
267 ! extern int getline(FILE *fp, char *buf, int len);
269 /* Find the puzzle files and allocate an array of gameseries
270 * structures for them.
272 * buf are lost. The return value is the length of the string stored
273 * in buf, or -1 if fgets() returned NULL.
275 ! extern int ggetline(FILE *fp, char *buf, int len);
277 /* Find the puzzle files and allocate an array of gameseries
278 * structures for them.
279 diff -crB ../cgames-2.2/csokoban/movelist.c .//csokoban/movelist.c
280 *** ../cgames-2.2/csokoban/movelist.c 2000-09-07 21:13:16.000000000 +0000
281 --- .//csokoban/movelist.c 2010-03-29 14:04:10.775154616 +0000
287 #include "movelist.h"
288 + #include <string.h>
290 /* Initialize or reinitialize list as empty.
292 diff -crB ../cgames-2.2/csokoban/play.c .//csokoban/play.c
293 *** ../cgames-2.2/csokoban/play.c 2000-11-05 00:40:13.000000000 +0000
294 --- .//csokoban/play.c 2010-03-29 14:04:10.775154616 +0000
298 #include "csokoban.h"
301 + #include <string.h>
303 /* One entry on the saved-state stack.