"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/frontend/pgn.cc" between
gnuchess-6.2.5.tar.gz and gnuchess-6.2.6.tar.gz

About: GNU Chess is a chess-playing program.

pgn.cc  (gnuchess-6.2.5):pgn.cc  (gnuchess-6.2.6)
/* pgn.c /* pgn.cc
GNU Chess frontend GNU Chess frontend
Copyright (C) 2001-2017 Free Software Foundation, Inc. Copyright (C) 2001-2020 Free Software Foundation, Inc.
GNU Chess is based on the two research programs GNU Chess is based on the two research programs
Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft. Cobalt by Chua Kong-Sian and Gazebo by Stuart Cracraft.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
skipping to change at line 65 skipping to change at line 65
****************************************************************************/ ****************************************************************************/
{ {
FILE *fp; FILE *fp;
char s[100]; char s[100];
int len; int len;
char *p; char *p;
int i; int i;
char answer = '\0'; /* Default: invalid */ char answer = '\0'; /* Default: invalid */
time_t secs; time_t secs;
struct tm *timestruct; struct tm *timestruct;
/* TRANSLATORS: "y" for "yes" */
const char *yes = _("y");
/* TRANSLATORS: "n" for "no" */
const char *no = _("n");
fp = fopen(file, "r"); fp = fopen(file, "r");
if (fp) { if (fp) {
fclose(fp); fclose(fp);
printf(_("File with name %s already exists.\n"), file); printf(_("File with name %s already exists.\n"), file);
do { do {
/* TRANSLATORS: translate "y/n" (yes/no) like you translated "y" and "n" above. */
printf(_("Overwrite file? [y/n]: ")); printf(_("Overwrite file? [y/n]: "));
answer = getchar(); answer = getchar();
if ( answer == '\n' ) { if ( answer == '\n' ) {
printf(_("Invalid answer! ")); printf(_("Invalid answer! "));
continue; continue;
} }
while( getchar() != '\n' ); while( getchar() != '\n' );
if (tolower(answer) == 'n') { if (tolower(answer) == *no) {
printf(_("File not saved.\n")); printf(_("File not saved.\n"));
return; return;
} }
else if (tolower(answer) == 'y') { else if (tolower(answer) == *yes) {
printf(_("File %s is overwritten.\n"), file); printf(_("File %s is overwritten.\n"), file);
} }
else { else {
printf(_("Invalid answer!")); printf(_("Invalid answer! "));
} }
} while (tolower(answer) != 'y' && tolower(answer) != 'n'); } while (tolower(answer) != *no && tolower(answer) != *yes);
} }
fp = fopen (file, "w"); fp = fopen (file, "w");
if (fp == NULL) if (fp == NULL)
{ {
printf ("Cannot write to file %s\n", file); printf ("Cannot write to file %s\n", file);
return; return;
} }
/* Write the seven tags */ /* Write the seven tags */
 End of changes. 8 change blocks. 
6 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)