| 182 static void pgn_insert_newlines(char *block) { |
182 static void pgn_insert_newlines(char *block) { |
| 183 size_t pos = 0; |
183 size_t pos = 0; |
| 184 size_t last_space_pos = 0; |
184 size_t last_space_pos = 0; |
| 185 size_t line_len = 0; |
185 size_t line_len = 0; |
| 186 while (block[pos] != '\0') { |
186 while (block[pos] != '\0') { |
| |
187 if (block[pos] == 0x1f) { |
| |
188 block[pos++] = ' '; |
| |
189 continue; |
| |
190 } |
| 187 if (block[pos] == ' ') { |
191 if (block[pos] == ' ') { |
| 188 last_space_pos = pos; |
192 last_space_pos = pos; |
| 189 } |
193 } |
| 190 line_len++; |
194 line_len++; |
| 191 if (line_len > 80) { |
195 if (line_len > 80) { |
| 241 } |
245 } |
| 242 |
246 |
| 243 int snpr; /* return value of printf calls */ |
247 int snpr; /* return value of printf calls */ |
| 244 |
248 |
| 245 if (i % 2 == 0) { |
249 if (i % 2 == 0) { |
| 246 snpr = snprintf(moveblkptr, 16, "%d. %s", |
250 snpr = snprintf(moveblkptr, 16, "%d.\x1f%s", |
| 247 1+i/2, gamestate->moves[i].string); |
251 1+i/2, gamestate->moves[i].string); |
| 248 } else { |
252 } else { |
| 249 snpr = snprintf(moveblkptr, 16, "%s", |
253 snpr = snprintf(moveblkptr, 16, "%s", |
| 250 gamestate->moves[i].string); |
254 gamestate->moves[i].string); |
| 251 } |
255 } |