--- kiwichess.old/log.cxx +++ kiwichess/log.cxx @@ -17,20 +17,35 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include #include +#include #include "log.h" FILE * Log::logfile_ = 0; +static char tmpnamebuf [256]; void Log::assign( const char * name ) { - FILE * f = (name == 0) ? stdout : fopen( name, "w" ); - - if( f != 0 && f != logfile_ ) { - close(); - logfile_ = f; + FILE *ofp; + + close(); + + if (name == 0) + { + ofp = stdout; + *tmpnamebuf = '\0'; } + else + { + sprintf (tmpnamebuf, "/var/tmp/kiwichess%d-%d.tmp", + getuid(), getpid()); + ofp = fopen (tmpnamebuf, "w"); + } + + logfile_ = ofp; } void Log::flush() @@ -45,6 +60,12 @@ if( logfile_ != 0 ) { fclose( logfile_ ); logfile_ = 0; + + if (*tmpnamebuf) + { + unlink (tmpnamebuf); + *tmpnamebuf = '\0'; + } } } --- kiwichess.old/engine.cxx +++ kiwichess/engine.cxx @@ -46,8 +46,11 @@ const char * Engine::myName = "Kiwi 0.6d"; const char * Engine::myAuthor = "Alessandro Scotti"; -const char * nameOfOpeningBook = "kiwi.obk"; -const char * nameOfConfigurationFile = "kiwi.ini"; +const char * nameOfOpeningBook = + "__META_PREFIX__/data/kiwichess.obk"; + +const char * nameOfConfigurationFile = + "__META_PREFIX__/data/kiwichess.ini"; // Search parameters int Engine::maxSearchDepthFactor = 3; --- kiwichess.old/pgn_lex.h +++ kiwichess/pgn_lex.h @@ -74,7 +74,7 @@ @return token identifier */ - PGNTokenId PGNLex::getNextToken(); + PGNTokenId getNextToken(); /** Returns the current token identifier. */ PGNTokenId tokenId() const {