X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xgamelist.c;h=8839e908e996a0ae28d6f99cfc1d18d867fbaa44;hb=e9a0808a5551217eb4fd29d949f3c7672545c168;hp=793eeb570e350cd26d10dea886129608c07d8069;hpb=b382d988c6f886f3a49483df9e3e36de0b6b0824;p=xboard.git diff --git a/xgamelist.c b/xgamelist.c index 793eeb5..8839e90 100644 --- a/xgamelist.c +++ b/xgamelist.c @@ -618,6 +618,35 @@ GameListIsUp() return glc && glc->up; } +int SaveGameListAsText(FILE *f) +{ + ListGame * lg = (ListGame *) gameList.head; + int nItem; + + if( !glc || ((ListGame *) gameList.tailPred)->number <= 0 ) { + DisplayError("Game list not loaded or empty", 0); + return False; + } + + /* Copy the list into the global memory block */ + if( f != NULL ) { + + lg = (ListGame *) gameList.head; + + for (nItem = 0; nItem < ((ListGame *) gameList.tailPred)->number; nItem++){ + char * st = GameListLineFull(lg->number, &lg->gameInfo); + char *line = GameListLine(lg->number, &lg->gameInfo); + if(filterString[0] == NULLCHAR || SearchPattern( line, filterString ) ) + fprintf( f, "%s\n", st ); + free(st); free(line); + lg = (ListGame *) lg->node.succ; + } + + fclose(f); + return True; + } + return False; +} //--------------------------------- Game-List options dialog ------------------------------------------ Widget gameListOptShell, listwidg;