X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=c144984e450095fab95cd55a92c5aadc2f0115dd;hb=532a8a1561833a5ba0d571025c8c30c40502a976;hp=2965507e9390512f476b7f7f71b6608719c4a6b7;hpb=3ee26c011464ede33114f0d166cca0e8fb1f86b2;p=xboard.git diff --git a/backend.c b/backend.c index 2965507..c144984 100644 --- a/backend.c +++ b/backend.c @@ -77,6 +77,7 @@ #if STDC_HEADERS # include # include +# include #else /* not STDC_HEADERS */ # if HAVE_STRING_H # include @@ -1423,12 +1424,14 @@ KeepAlive() /* added routine for printf style output to ics */ void ics_printf(char *format, ...) { - char buffer[MSG_SIZ], *args; - - args = (char *)&format + sizeof(format); - vsnprintf(buffer, sizeof(buffer), format, args); - buffer[sizeof(buffer)-1] = '\0'; - SendToICS(buffer); + char buffer[MSG_SIZ]; + va_list args; + + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + buffer[sizeof(buffer)-1] = '\0'; + SendToICS(buffer); + va_end(args); } void @@ -1549,6 +1552,10 @@ StringToVariant(e) while( *e++ != '_'); } + if(StrCaseStr(e, "misc/")) { // [HGM] on FICS, misc/shogi is not shogi + v = VariantNormal; + found = TRUE; + } else for (i=0; i gameInfo.holdingsWidth) { - for(i=0; i=BOARD_LEFT; j--) - board[i][j+newHoldingsWidth-gameInfo.holdingsWidth] = - board[i][j]; - for(i=0; i gameInfo.holdingsWidth) { + for(i=0; i=BOARD_LEFT; j--) + board[i][j+newHoldingsWidth-gameInfo.holdingsWidth] = + board[i][j]; + for(i=0; i= 5 && buf[buf_len-5]=='\n' && buf[buf_len-4]=='\\' && + if(!appData.noJoin && buf_len >= 5 && buf[buf_len-5]=='\n' && buf[buf_len-4]=='\\' && buf[buf_len-3]==' ' && buf[buf_len-2]==' ' && buf[buf_len-1]==' ') { buf_len -= 5; // [HGM] ICS: join continuation line of Lasker 2.2.3 server with previous if(buf_len == 0 || buf[buf_len-1] != ' ') @@ -2214,7 +2225,8 @@ read_from_ics(isr, closure, data, count, error) sprintf(str, "/set-quietly interface %s\n/set-quietly style 12\n", programVersion); - + if (!appData.noJoin) + strcat(str, "/set-quietly wrap 0\n"); } else if (ics_type == ICS_CHESSNET) { sprintf(str, "/style 12\n"); } else { @@ -2224,10 +2236,12 @@ read_from_ics(isr, closure, data, count, error) #ifdef WIN32 strcat(str, "$iset nohighlight 1\n"); #endif + if (!appData.noJoin) + strcat(str, "$iset nowrap 1\n"); strcat(str, "$iset lock 1\n$style 12\n"); - NotifyFrontendLogin(); } SendToICS(str); + NotifyFrontendLogin(); intfSet = TRUE; } @@ -9589,7 +9603,7 @@ SaveGamePGN(f) fprintf(f, " "); linelen++; } - fprintf(f, numtext); + fprintf(f, "%s", numtext); linelen += numlen; /* Get move */ @@ -9607,7 +9621,7 @@ SaveGamePGN(f) fprintf(f, " "); linelen++; } - fprintf(f, move_buffer); + fprintf(f, "%s", move_buffer); linelen += movelen; /* [AS] Add PV info if present */ @@ -9651,7 +9665,7 @@ SaveGamePGN(f) fprintf(f, " "); linelen++; } - fprintf(f, move_buffer); + fprintf(f, "%s", move_buffer); linelen += movelen; } @@ -10314,8 +10328,7 @@ AnalyzeModeEvent() first.analyzing = TRUE; /*first.maybeThinking = TRUE;*/ first.maybeThinking = FALSE; /* avoid killing GNU Chess */ - AnalysisPopUp(_("Analysis"), - _("Starting analysis mode...\nIf this message stays up, your chess program does not support analysis.")); + EngineOutputPopUp(); } if (!appData.icsEngineAnalyze) gameMode = AnalyzeMode; pausing = FALSE; @@ -10341,8 +10354,7 @@ AnalyzeFileEvent() first.analyzing = TRUE; /*first.maybeThinking = TRUE;*/ first.maybeThinking = FALSE; /* avoid killing GNU Chess */ - AnalysisPopUp(_("Analysis"), - _("Starting analysis mode...\nIf this message stays up, your chess program does not support analysis.")); + EngineOutputPopUp(); } gameMode = AnalyzeFile; pausing = FALSE; @@ -10840,7 +10852,7 @@ ExitAnalyzeMode() SendToProgram("exit\n", &first); first.analyzing = FALSE; } - AnalysisPopDown(); + EngineOutputPopDown(); thinkOutput[0] = NULLCHAR; } @@ -12684,12 +12696,10 @@ void DisplayAnalysisText(text) char *text; { - char buf[MSG_SIZ]; - - if (gameMode == AnalyzeMode || gameMode == AnalyzeFile - || appData.icsEngineAnalyze) { - sprintf(buf, "Analysis (%s)", first.tidy); - AnalysisPopUp(buf, text); + if (gameMode == AnalyzeMode || gameMode == AnalyzeFile + || appData.icsEngineAnalyze) + { + EngineOutputPopUp(); } } @@ -13492,6 +13502,14 @@ PositionToFEN(move, overrideCastling) } else { *p++ = '-'; } + } else if(move == backwardMostMove) { + // [HGM] perhaps we should always do it like this, and forget the above? + if(epStatus[move] >= 0) { + *p++ = epStatus[move] + AAA; + *p++ = whiteToPlay ? '6'+BOARD_HEIGHT-8 : '3'; + } else { + *p++ = '-'; + } } else { *p++ = '-'; }