updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / cgames / cgames.patch
blob72dcb06d43f504260bfcbaeda2656849674aa3d0
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
4 ***************
5 *** 14,19 ****
6 --- 14,20 ----
7 #include "fileread.h"
8 #include "play.h"
9 #include "answers.h"
10 + #include <string.h>
12 /* The directory containing the user's solution files.
14 ***************
15 *** 155,161 ****
16 return TRUE;
18 for (;;) {
19 ! n = getline(fp, buf, sizeof buf);
20 if (n < 0)
21 return FALSE;
22 if (*buf != '\n' && *buf != ';')
23 --- 156,162 ----
24 return TRUE;
26 for (;;) {
27 ! n = ggetline(fp, buf, sizeof buf);
28 if (n < 0)
29 return FALSE;
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
34 ***************
35 *** 30,36 ****
36 /* Read one full line from fp and store the first len characters in
37 * buf.
39 ! int getline(FILE *fp, char *buf, int len)
41 int ch, n;
43 --- 30,36 ----
44 /* Read one full line from fp and store the first len characters in
45 * buf.
47 ! int ggetline(FILE *fp, char *buf, int len)
49 int ch, n;
51 ***************
52 *** 59,65 ****
53 for (;;) {
54 ch = fgetc(series->mapfp);
55 if (ch == ';') {
56 ! getline(series->mapfp, buf, sizeof buf);
57 if (*buf == ';') {
58 for (n = 1 ; isspace(buf[n]) ; ++n) ;
59 strncpy(series->name, buf + n, sizeof series->name - 1);
60 --- 59,65 ----
61 for (;;) {
62 ch = fgetc(series->mapfp);
63 if (ch == ';') {
64 ! ggetline(series->mapfp, buf, sizeof buf);
65 if (*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
71 ***************
72 *** 53,59 ****
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.
80 --- 53,59 ----
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
91 ***************
92 *** 7,12 ****
93 --- 7,13 ----
94 #include <stdlib.h>
95 #include "gen.h"
96 #include "movelist.h"
97 + #include <string.h>
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
104 ***************
105 *** 50,56 ****
106 memset(map, ' ', fmi->ysize * fmi->xsize);
107 p = map;
108 for (y = 0 ; y < fmi->ysize ; ++y) {
109 ! n = getline(fp, buf, sizeof buf);
110 if (n < 0 || *buf == ';')
111 break;
112 if (!ok)
113 --- 50,56 ----
114 memset(map, ' ', fmi->ysize * fmi->xsize);
115 p = map;
116 for (y = 0 ; y < fmi->ysize ; ++y) {
117 ! n = ggetline(fp, buf, sizeof buf);
118 if (n < 0 || *buf == ';')
119 break;
120 if (!ok)
121 ***************
122 *** 96,102 ****
123 int n;
125 for (;;) {
126 ! n = getline(fp, buf, sizeof buf);
127 if (n < 0)
128 return NULL;
129 if (!n || *buf == ';')
130 --- 96,102 ----
131 int n;
133 for (;;) {
134 ! n = ggetline(fp, buf, sizeof buf);
135 if (n < 0)
136 return NULL;
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
141 ***************
142 *** 9,14 ****
143 --- 9,15 ----
144 #include "cblocks.h"
145 #include "userio.h"
146 #include "play.h"
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
154 ***************
155 *** 115,121 ****
156 return TRUE;
158 for (;;) {
159 ! n = getline(fp, buf, sizeof buf);
160 if (n < 0)
161 return FALSE;
162 if (*buf != '\n' && *buf != ';')
163 --- 115,121 ----
164 return TRUE;
166 for (;;) {
167 ! n = ggetline(fp, buf, sizeof buf);
168 if (n < 0)
169 return FALSE;
170 if (*buf != '\n' && *buf != ';')
171 ***************
172 *** 133,139 ****
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);
180 --- 133,139 ----
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
191 ***************
192 *** 38,44 ****
193 /* Read one full line from fp and store the first len characters in
194 * buf.
196 ! int getline(FILE *fp, char *buf, int len)
198 int ch, n;
200 --- 38,44 ----
201 /* Read one full line from fp and store the first len characters in
202 * buf.
204 ! int ggetline(FILE *fp, char *buf, int len)
206 int ch, n;
208 ***************
209 *** 162,168 ****
210 --y;
211 if (ch == '\n')
212 continue;
213 ! n = getline(fp, buf, sizeof buf);
214 if (n < 0)
215 return FALSE;
216 if (ch == ';' && *buf == ';') {
217 --- 162,168 ----
218 --y;
219 if (ch == '\n')
220 continue;
221 ! n = ggetline(fp, buf, sizeof buf);
222 if (n < 0)
223 return FALSE;
224 if (ch == ';' && *buf == ';') {
225 ***************
226 *** 177,183 ****
227 continue;
229 buf[0] = ch;
230 ! getline(fp, buf + 1, sizeof buf - 1);
231 if (badmap)
232 continue;
233 x = 1;
234 --- 177,183 ----
235 continue;
237 buf[0] = ch;
238 ! ggetline(fp, buf + 1, sizeof buf - 1);
239 if (badmap)
240 continue;
241 x = 1;
242 ***************
243 *** 239,245 ****
244 for (;;) {
245 ch = fgetc(series->mapfp);
246 if (ch == ';') {
247 ! getline(series->mapfp, buf, sizeof buf);
248 if (*buf == ';') {
249 for (n = 1 ; isspace(buf[n]) ; ++n) ;
250 strncpy(series->name, buf + n, sizeof series->name - 1);
251 --- 239,245 ----
252 for (;;) {
253 ch = fgetc(series->mapfp);
254 if (ch == ';') {
255 ! ggetline(series->mapfp, buf, sizeof buf);
256 if (*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
262 ***************
263 *** 56,62 ****
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.
271 --- 56,62 ----
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
282 ***************
283 *** 7,12 ****
284 --- 7,13 ----
285 #include <stdlib.h>
286 #include "gen.h"
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
295 ***************
296 *** 9,14 ****
297 --- 9,15 ----
298 #include "csokoban.h"
299 #include "userio.h"
300 #include "play.h"
301 + #include <string.h>
303 /* One entry on the saved-state stack.