2 * args.c -- Option parsing and saving for X and Windows versions of XBoard
4 * Copyright 1991 by Digital Equipment Corporation, Maynard,
7 * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8 * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc.
10 * Enhancements Copyright 2005 Alessandro Scotti
12 * The following terms apply to Digital Equipment Corporation's copyright
14 * ------------------------------------------------------------------------
17 * Permission to use, copy, modify, and distribute this software and its
18 * documentation for any purpose and without fee is hereby granted,
19 * provided that the above copyright notice appear in all copies and that
20 * both that copyright notice and this permission notice appear in
21 * supporting documentation, and that the name of Digital not be
22 * used in advertising or publicity pertaining to distribution of the
23 * software without specific, written prior permission.
25 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
26 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
27 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
28 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
29 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
30 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
32 * ------------------------------------------------------------------------
34 * The following terms apply to the enhanced version of XBoard
35 * distributed by the Free Software Foundation:
36 * ------------------------------------------------------------------------
38 * GNU XBoard is free software: you can redistribute it and/or modify
39 * it under the terms of the GNU General Public License as published by
40 * the Free Software Foundation, either version 3 of the License, or (at
41 * your option) any later version.
43 * GNU XBoard is distributed in the hope that it will be useful, but
44 * WITHOUT ANY WARRANTY; without even the implied warranty of
45 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
46 * General Public License for more details.
48 * You should have received a copy of the GNU General Public License
49 * along with this program. If not, see http://www.gnu.org/licenses/. *
51 *------------------------------------------------------------------------
52 ** See the file ChangeLog for a revision history.
55 // Note: this file is not a normal header, but contains executable code
56 // for #inclusion in winboard.c and xboard.c, rather than separate compilation,
57 // so that it can make use of the proper context of #defined symbols and
58 // declarations in those files.
61 ArgString, ArgInt, ArgFloat, ArgBoolean, ArgTrue, ArgFalse, ArgNone,
62 ArgColor, ArgAttribs, ArgFilename, ArgBoardSize, ArgFont, ArgCommSettings,
63 ArgSettingsFilename, ArgBackupSettingsFile, ArgTwo, ArgInstall, ArgMaster,
64 ArgX, ArgY, ArgZ // [HGM] placement: for window-placement options stored relative to main window
67 typedef void *ArgIniType;
69 #define INVALID (ArgIniType) 6915 /* Some number unlikely to be needed as default for anything */
70 #define MAX_ARG_LEN 128*1024 /* [AS] For Roger Brown's very long list! */
77 String *pString; // ArgString
79 float *pFloat; // ArgFloat
80 Boolean *pBoolean; // ArgBoolean
81 COLORREF *pColor; // ArgColor
82 ColorClass cc; // ArgAttribs
83 String *pFilename; // ArgFilename
84 BoardSize *pBoardSize; // ArgBoardSize
85 int whichFont; // ArgFont
86 DCB *pDCB; // ArgCommSettings
87 String *pFilename; // ArgSettingsFilename
92 ArgIniType defaultValue;
102 IcsTextMenuEntry icsTextMenuEntry[ICS_TEXT_MENU_SIZE];
103 char dataDir[MSG_SIZ] = DATADIR;
111 char *firstEngineLine;
112 char *secondEngineLine;
116 char *engineListFile;
118 void EnsureOnScreen(int *x, int *y, int minX, int minY);
119 char StringGet(void *getClosure);
120 void ParseFont(char *name, int number);
121 void SetFontDefaults();
123 void ParseColor(int n, char *name);
124 void ParseTextAttribs(ColorClass cc, char *s);
125 void ParseBoardSize(void * addr, char *name);
126 void ParseCommPortSettings(char *name);
127 void LoadAllSounds();
128 void SetCommPortDefaults();
129 void SaveFontArg(FILE *f, ArgDescriptor *ad);
131 void SaveAttribsArg(FILE *f, ArgDescriptor *ad);
132 void SaveColor(FILE *f, ArgDescriptor *ad);
133 void SaveBoardSize(FILE *f, char *name, void *addr);
134 void PrintCommPortSettings(FILE *f, char *name);
135 void GetWindowCoords();
137 void PopUpStartupDialog();
138 typedef char GetFunc(void *getClosure);
139 void ParseArgs(GetFunc get, void *cl);
141 // [HGM] this is an exact duplicate of something in winboard.c. Move to backend.c?
142 char *defaultTextAttribs[] =
144 COLOR_SHOUT, COLOR_SSHOUT, COLOR_CHANNEL1, COLOR_CHANNEL, COLOR_KIBITZ,
145 COLOR_TELL, COLOR_CHALLENGE, COLOR_REQUEST, COLOR_SEEK, COLOR_NORMAL,
149 ArgDescriptor argDescriptors[] = {
150 /* positional arguments */
151 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
152 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
153 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
154 { "is", ArgString, (void *) &icsNick, FALSE, INVALID },
155 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
156 { "", ArgNone, NULL, FALSE, INVALID },
157 /* keyword arguments */
158 { "saveDate", ArgInt, (void *) &saveDate, TRUE, 0 },
159 { "date", ArgInt, (void *) &dateStamp, FALSE, 0 },
160 { "autoClose", ArgTrue, (void *) &autoClose, FALSE, FALSE },
162 { "whitePieceColor", ArgColor, (void *) 0, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
163 { "wpc", ArgColor, (void *) 0, FALSE, INVALID },
164 { "blackPieceColor", ArgColor, (void *) 1, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
165 { "bpc", ArgColor, (void *) 1, FALSE, INVALID },
166 { "lightSquareColor", ArgColor, (void *) 2, TRUE, (ArgIniType) LIGHT_SQUARE_COLOR },
167 { "lsc", ArgColor, (void *) 2, FALSE, INVALID },
168 { "darkSquareColor", ArgColor, (void *) 3, TRUE, (ArgIniType) DARK_SQUARE_COLOR },
169 { "dsc", ArgColor, (void *) 3, FALSE, INVALID },
170 { "highlightSquareColor", ArgColor, (void *) 4, TRUE, (ArgIniType) HIGHLIGHT_SQUARE_COLOR },
171 { "hsc", ArgColor, (void *) 4, FALSE, INVALID },
172 { "premoveHighlightColor", ArgColor, (void *) 5, TRUE, (ArgIniType) PREMOVE_HIGHLIGHT_COLOR },
173 { "phc", ArgColor, (void *) 5, FALSE, INVALID },
174 { "movesPerSession", ArgInt, (void *) &appData.movesPerSession, TRUE, (ArgIniType) MOVES_PER_SESSION },
175 { "mps", ArgInt, (void *) &appData.movesPerSession, FALSE, INVALID },
176 { "initString", ArgString, (void *) &appData.firstInitString, FALSE, INVALID },
177 { "firstInitString", ArgString, (void *) &appData.firstInitString, FALSE, (ArgIniType) INIT_STRING },
178 { "secondInitString", ArgString, (void *) &appData.secondInitString, FALSE, (ArgIniType) INIT_STRING },
179 { "firstComputerString", ArgString, (void *) &appData.firstComputerString,
180 FALSE, (ArgIniType) COMPUTER_STRING },
181 { "secondComputerString", ArgString, (void *) &appData.secondComputerString,
182 FALSE, (ArgIniType) COMPUTER_STRING },
183 { "firstChessProgram", ArgFilename, (void *) &appData.firstChessProgram,
184 FALSE, (ArgIniType) FIRST_CHESS_PROGRAM },
185 { "fcp", ArgFilename, (void *) &appData.firstChessProgram, FALSE, INVALID },
186 { "secondChessProgram", ArgFilename, (void *) &appData.secondChessProgram,
187 FALSE, (ArgIniType) SECOND_CHESS_PROGRAM },
188 { "scp", ArgFilename, (void *) &appData.secondChessProgram, FALSE, INVALID },
189 { "fe", ArgString, (void *) &firstEngineLine, FALSE, "" },
190 { "se", ArgString, (void *) &secondEngineLine, FALSE, "" },
191 { "firstPlaysBlack", ArgBoolean, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
192 { "fb", ArgTrue, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
193 { "xfb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
194 { "-fb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
195 { "noChessProgram", ArgBoolean, (void *) &appData.noChessProgram, FALSE, FALSE },
196 { "ncp", ArgTrue, (void *) &appData.noChessProgram, FALSE, INVALID },
197 { "xncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
198 { "-ncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
199 { "firstHost", ArgString, (void *) &appData.firstHost, FALSE, (ArgIniType) FIRST_HOST },
200 { "fh", ArgString, (void *) &appData.firstHost, FALSE, INVALID },
201 { "secondHost", ArgString, (void *) &appData.secondHost, FALSE, (ArgIniType) SECOND_HOST },
202 { "sh", ArgString, (void *) &appData.secondHost, FALSE, INVALID },
203 { "firstDirectory", ArgFilename, (void *) &appData.firstDirectory, FALSE, (ArgIniType) FIRST_DIRECTORY },
204 { "fd", ArgFilename, (void *) &appData.firstDirectory, FALSE, INVALID },
205 { "secondDirectory", ArgFilename, (void *) &appData.secondDirectory, FALSE, (ArgIniType) SECOND_DIRECTORY },
206 { "sd", ArgFilename, (void *) &appData.secondDirectory, FALSE, INVALID },
207 { "variations", ArgBoolean, (void *) &appData.variations, TRUE, (ArgIniType) FALSE },
208 { "appendPV", ArgBoolean, (void *) &appData.autoExtend, TRUE, (ArgIniType) FALSE },
209 { "theme", ArgString, (void *) &theme, FALSE, (ArgIniType) "" },
211 /* some options only used by the XBoard front end, and ignored in WinBoard */
212 /* Their saving is controlled by XBOARD, which in WinBoard is defined as FALSE */
213 { "internetChessServerInputBox", ArgBoolean, (void *) &appData.icsInputBox, XBOARD, (ArgIniType) FALSE },
214 { "icsinput", ArgTrue, (void *) &appData.icsInputBox, FALSE, INVALID },
215 { "xicsinput", ArgFalse, (void *) &appData.icsInputBox, FALSE, INVALID },
216 { "cmail", ArgString, (void *) &appData.cmailGameName, FALSE, (ArgIniType) "" },
217 { "soundProgram", ArgFilename, (void *) &appData.soundProgram, XBOARD, (ArgIniType) "play" },
218 { "fontSizeTolerance", ArgInt, (void *) &appData.fontSizeTolerance, XBOARD, (ArgIniType) 4 },
219 { "lowTimeWarningColor", ArgColor, (void *) 6, XBOARD, (ArgIniType) LOWTIMEWARNING_COLOR },
220 { "lowTimeWarning", ArgBoolean, (void *) &appData.lowTimeWarning, XBOARD, (ArgIniType) FALSE },
221 { "titleInWindow", ArgBoolean, (void *) &appData.titleInWindow, XBOARD, (ArgIniType) FALSE },
222 { "title", ArgTrue, (void *) &appData.titleInWindow, FALSE, INVALID },
223 { "xtitle", ArgFalse, (void *) &appData.titleInWindow, FALSE, INVALID },
224 { "flashCount", ArgInt, (void *) &appData.flashCount, XBOARD, INVALID }, // let X handle this
225 { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE },
226 { "pieceImageDirectory", ArgFilename, (void *) &appData.pieceDirectory, TRUE, (ArgIniType) "" },
227 { "pid", ArgFilename, (void *) &appData.pieceDirectory, FALSE, INVALID },
228 { "trueColors", ArgBoolean, (void *) &appData.trueColors, XBOARD, (ArgIniType) (2*!XBOARD) },
229 { "jewelled", ArgInt, (void *) &appData.jewelled, FALSE, (ArgIniType) -1 },
230 { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" },
231 { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY },
232 { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE },
234 { "dropMenu", ArgBoolean, (void *) &appData.dropMenu, TRUE, (ArgIniType) FALSE },
235 { "pieceMenu", ArgBoolean, (void *) &appData.pieceMenu, TRUE, (ArgIniType) TRUE },
236 { "sweepPromotions", ArgBoolean, (void *) &appData.sweepSelect, TRUE, (ArgIniType) FALSE },
237 { "monoMouse", ArgBoolean, (void *) &appData.monoMouse, XBOARD, (ArgIniType) FALSE },
238 { "remoteShell", ArgFilename, (void *) &appData.remoteShell, FALSE, (ArgIniType) REMOTE_SHELL },
239 { "rsh", ArgFilename, (void *) &appData.remoteShell, FALSE, INVALID },
240 { "remoteUser", ArgString, (void *) &appData.remoteUser, FALSE, (ArgIniType) "" },
241 { "ruser", ArgString, (void *) &appData.remoteUser, FALSE, INVALID },
242 { "timeDelay", ArgFloat, (void *) &appData.timeDelay, TRUE, INVALID },
243 { "td", ArgFloat, (void *) &appData.timeDelay, FALSE, INVALID },
244 { "timeControl", ArgString, (void *) &appData.timeControl, TRUE, (ArgIniType) TIME_CONTROL },
245 { "tc", ArgString, (void *) &appData.timeControl, FALSE, INVALID },
246 { "timeIncrement", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
247 { "inc", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
248 { "internetChessServerMode", ArgBoolean, (void *) &appData.icsActive, FALSE, INVALID },
249 { "ics", ArgTrue, (void *) &appData.icsActive, FALSE, (ArgIniType) FALSE },
250 { "xics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
251 { "-ics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
252 { "is", ArgString, (void *) &icsNick, FALSE, "" },
253 { "internetChessServerHost", ArgString, (void *) &appData.icsHost, FALSE, (ArgIniType) "" },
254 { "icshost", ArgString, (void *) &appData.icsHost, FALSE, INVALID },
255 { "internetChessServerPort", ArgString, (void *) &appData.icsPort, FALSE, (ArgIniType) ICS_PORT },
256 { "icsport", ArgString, (void *) &appData.icsPort, FALSE, INVALID },
257 { "internetChessServerCommPort", ArgString, (void *) &appData.icsCommPort, FALSE, (ArgIniType) ICS_COMM_PORT },
258 { "icscomm", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
259 { "internetChessServerComPort", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
260 { "icscom", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
261 { "internetChessServerLogonScript", ArgFilename, (void *) &appData.icsLogon, FALSE, (ArgIniType) ICS_LOGON },
262 { "icslogon", ArgFilename, (void *) &appData.icsLogon, FALSE, INVALID },
263 { "useTelnet", ArgBoolean, (void *) &appData.useTelnet, FALSE, INVALID },
264 { "telnet", ArgTrue, (void *) &appData.useTelnet, FALSE, INVALID },
265 { "xtelnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
266 { "-telnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
267 { "telnetProgram", ArgFilename, (void *) &appData.telnetProgram, FALSE, (ArgIniType) TELNET_PROGRAM },
268 { "internetChessserverHelper", ArgFilename, (void *) &appData.icsHelper,
269 FALSE, INVALID }, // for XB
270 { "icshelper", ArgFilename, (void *) &appData.icsHelper, FALSE, (ArgIniType) "" },
271 { "seekGraph", ArgBoolean, (void *) &appData.seekGraph, TRUE, (ArgIniType) FALSE },
272 { "sg", ArgTrue, (void *) &appData.seekGraph, FALSE, INVALID },
273 { "autoRefresh", ArgBoolean, (void *) &appData.autoRefresh, TRUE, (ArgIniType) FALSE },
274 { "autoBox", ArgBoolean, (void *) &appData.autoBox, XBOARD, (ArgIniType) TRUE },
275 { "gateway", ArgString, (void *) &appData.gateway, FALSE, (ArgIniType) "" },
276 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, (ArgIniType) "" },
277 { "lgf", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
278 { "loadGameIndex", ArgInt, (void *) &appData.loadGameIndex, FALSE, (ArgIniType) 0 },
279 { "lgi", ArgInt, (void *) &appData.loadGameIndex, FALSE, INVALID },
280 { "saveGameFile", ArgFilename, (void *) &appData.saveGameFile, TRUE, (ArgIniType) "" },
281 { "sgf", ArgFilename, (void *) &appData.saveGameFile, FALSE, INVALID },
282 { "autoSaveGames", ArgBoolean, (void *) &appData.autoSaveGames, TRUE, (ArgIniType) FALSE },
283 { "autosave", ArgTrue, (void *) &appData.autoSaveGames, FALSE, INVALID },
284 { "xautosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
285 { "-autosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
286 { "onlyOwnGames", ArgBoolean, (void *) &appData.onlyOwn, TRUE, (ArgIniType) FALSE },
287 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, (ArgIniType) "" },
288 { "lpf", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
289 { "loadPositionIndex", ArgInt, (void *) &appData.loadPositionIndex, FALSE, (ArgIniType) 1 },
290 { "lpi", ArgInt, (void *) &appData.loadPositionIndex, FALSE, INVALID },
291 { "positionDir", ArgFilename, (void *) &appData.positionDir, FALSE, (ArgIniType) "" },
292 { "savePositionFile", ArgFilename, (void *) &appData.savePositionFile, FALSE, (ArgIniType) "" },
293 { "spf", ArgFilename, (void *) &appData.savePositionFile, FALSE, INVALID },
294 { "matchMode", ArgBoolean, (void *) &appData.matchMode, FALSE, (ArgIniType) FALSE },
295 { "mm", ArgTrue, (void *) &appData.matchMode, FALSE, INVALID },
296 { "xmm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
297 { "-mm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
298 { "matchGames", ArgInt, (void *) &appData.matchGames, FALSE, (ArgIniType) 0 },
299 { "mg", ArgInt, (void *) &appData.matchGames, FALSE, INVALID },
300 { "monoMode", ArgBoolean, (void *) &appData.monoMode, TRUE, (ArgIniType) FALSE },
301 { "mono", ArgTrue, (void *) &appData.monoMode, FALSE, INVALID },
302 { "xmono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
303 { "-mono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
304 { "debugMode", ArgBoolean, (void *) &appData.debugMode, FALSE, (ArgIniType) FALSE },
305 { "debug", ArgTrue, (void *) &appData.debugMode, FALSE, INVALID },
306 { "xdebug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
307 { "-debug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
308 { "clockMode", ArgBoolean, (void *) &appData.clockMode, FALSE, (ArgIniType) TRUE },
309 { "clock", ArgTrue, (void *) &appData.clockMode, FALSE, INVALID },
310 { "xclock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
311 { "-clock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
312 { "searchTime", ArgString, (void *) &appData.searchTime, FALSE, (ArgIniType) "" },
313 { "st", ArgString, (void *) &appData.searchTime, FALSE, INVALID },
314 { "searchDepth", ArgInt, (void *) &appData.searchDepth, FALSE, (ArgIniType) 0 },
315 { "depth", ArgInt, (void *) &appData.searchDepth, FALSE, INVALID },
316 { "showCoords", ArgBoolean, (void *) &appData.showCoords, TRUE, (ArgIniType) FALSE },
317 { "coords", ArgTrue, (void *) &appData.showCoords, FALSE, INVALID },
318 { "xcoords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
319 { "-coords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
320 { "showThinking", ArgBoolean, (void *) &appData.showThinking, TRUE, (ArgIniType) FALSE },
321 { "thinking", ArgTrue, (void *) &appData.showThinking, FALSE, INVALID },
322 { "xthinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
323 { "-thinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
324 { "ponderNextMove", ArgBoolean, (void *) &appData.ponderNextMove, TRUE, (ArgIniType) TRUE },
325 { "ponder", ArgTrue, (void *) &appData.ponderNextMove, FALSE, INVALID },
326 { "xponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
327 { "-ponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
328 { "periodicUpdates", ArgBoolean, (void *) &appData.periodicUpdates, TRUE, (ArgIniType) TRUE },
329 { "periodic", ArgTrue, (void *) &appData.periodicUpdates, FALSE, INVALID },
330 { "xperiodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
331 { "-periodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
332 { "popupExitMessage", ArgBoolean, (void *) &appData.popupExitMessage, TRUE, (ArgIniType) TRUE },
333 { "exit", ArgTrue, (void *) &appData.popupExitMessage, FALSE, INVALID },
334 { "xexit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
335 { "-exit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
336 { "popupMoveErrors", ArgBoolean, (void *) &appData.popupMoveErrors, TRUE, (ArgIniType) FALSE },
337 { "popup", ArgTrue, (void *) &appData.popupMoveErrors, FALSE, INVALID },
338 { "xpopup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
339 { "-popup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
340 { "popUpErrors", ArgBoolean, (void *) &appData.popupMoveErrors,
341 FALSE, INVALID }, /* only so that old WinBoard.ini files from betas can be read */
342 { "clockFont", ArgFont, (void *) CLOCK_FONT, TRUE, INVALID },
343 { "messageFont", ArgFont, (void *) MESSAGE_FONT, TRUE, INVALID },
344 { "font", ArgFont, (void *) MESSAGE_FONT, FALSE, INVALID }, /* only so that old .xboardrc files will parse. -font does not work from the command line because it is captured by the X libraries. */
345 { "coordFont", ArgFont, (void *) COORD_FONT, TRUE, INVALID },
346 { "tagsFont", ArgFont, (void *) EDITTAGS_FONT, TRUE, INVALID },
347 { "commentFont", ArgFont, (void *) COMMENT_FONT, TRUE, INVALID },
348 { "icsFont", ArgFont, (void *) CONSOLE_FONT, TRUE, INVALID },
349 { "moveHistoryFont", ArgFont, (void *) MOVEHISTORY_FONT, TRUE, INVALID }, /* [AS] */
350 { "gameListFont", ArgFont, (void *) GAMELIST_FONT, TRUE, INVALID }, /* [HGM] */
351 { "boardSize", ArgBoardSize, (void *) &boardSize,
352 TRUE, (ArgIniType) -1 }, /* must come after all fonts */
353 { "size", ArgBoardSize, (void *) &boardSize, FALSE, INVALID },
354 { "ringBellAfterMoves", ArgBoolean, (void *) &appData.ringBellAfterMoves,
355 FALSE, (ArgIniType) TRUE }, /* historical; kept only so old winboard.ini files will parse */
356 { "bell", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
357 { "xbell", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
358 { "movesound", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
359 { "xmovesound", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
360 { "alwaysOnTop", ArgBoolean, (void *) &alwaysOnTop, TRUE, INVALID },
361 { "top", ArgTrue, (void *) &alwaysOnTop, FALSE, INVALID },
362 { "xtop", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
363 { "-top", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
364 { "autoCallFlag", ArgBoolean, (void *) &appData.autoCallFlag, TRUE, (ArgIniType) FALSE },
365 { "autoflag", ArgTrue, (void *) &appData.autoCallFlag, FALSE, INVALID },
366 { "xautoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
367 { "-autoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
368 { "autoComment", ArgBoolean, (void *) &appData.autoComment, TRUE, (ArgIniType) FALSE },
369 { "autocomm", ArgTrue, (void *) &appData.autoComment, FALSE, INVALID },
370 { "xautocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
371 { "-autocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
372 { "autoCreateLogon", ArgBoolean, (void *) &appData.autoCreateLogon, TRUE, (ArgIniType) FALSE },
373 { "autoObserve", ArgBoolean, (void *) &appData.autoObserve, TRUE, (ArgIniType) FALSE },
374 { "autobs", ArgTrue, (void *) &appData.autoObserve, FALSE, INVALID },
375 { "xautobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
376 { "-autobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
377 { "flipView", ArgBoolean, (void *) &appData.flipView, FALSE, (ArgIniType) FALSE },
378 { "flip", ArgTrue, (void *) &appData.flipView, FALSE, INVALID },
379 { "xflip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
380 { "-flip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
381 { "autoFlipView", ArgBoolean, (void *) &appData.autoFlipView, TRUE, (ArgIniType) TRUE },
382 { "autoflip", ArgTrue, (void *) &appData.autoFlipView, FALSE, INVALID },
383 { "xautoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
384 { "-autoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
385 { "autoRaiseBoard", ArgBoolean, (void *) &appData.autoRaiseBoard, TRUE, (ArgIniType) TRUE },
386 { "autoraise", ArgTrue, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
387 { "xautoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
388 { "-autoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
389 { "alwaysPromoteToQueen", ArgBoolean, (void *) &appData.alwaysPromoteToQueen, TRUE, (ArgIniType) FALSE },
390 { "queen", ArgTrue, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
391 { "xqueen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
392 { "-queen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
393 { "oldSaveStyle", ArgBoolean, (void *) &appData.oldSaveStyle, TRUE, (ArgIniType) FALSE },
394 { "oldsave", ArgTrue, (void *) &appData.oldSaveStyle, FALSE, INVALID },
395 { "xoldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
396 { "-oldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
397 { "quietPlay", ArgBoolean, (void *) &appData.quietPlay, TRUE, (ArgIniType) FALSE },
398 { "quiet", ArgTrue, (void *) &appData.quietPlay, FALSE, INVALID },
399 { "xquiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
400 { "-quiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
401 { "getMoveList", ArgBoolean, (void *) &appData.getMoveList, TRUE, (ArgIniType) TRUE },
402 { "moves", ArgTrue, (void *) &appData.getMoveList, FALSE, INVALID },
403 { "xmoves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
404 { "-moves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
405 { "testLegality", ArgBoolean, (void *) &appData.testLegality, TRUE, (ArgIniType) TRUE },
406 { "legal", ArgTrue, (void *) &appData.testLegality, FALSE, INVALID },
407 { "xlegal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
408 { "-legal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
409 { "premove", ArgBoolean, (void *) &appData.premove, TRUE, (ArgIniType) TRUE },
410 { "pre", ArgTrue, (void *) &appData.premove, FALSE, INVALID },
411 { "xpre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
412 { "-pre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
413 { "premoveWhite", ArgBoolean, (void *) &appData.premoveWhite, TRUE, (ArgIniType) FALSE },
414 { "prewhite", ArgTrue, (void *) &appData.premoveWhite, FALSE, INVALID },
415 { "xprewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
416 { "-prewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
417 { "premoveWhiteText", ArgString, (void *) &appData.premoveWhiteText, TRUE, (ArgIniType) "" },
418 { "premoveBlack", ArgBoolean, (void *) &appData.premoveBlack, TRUE, (ArgIniType) FALSE },
419 { "preblack", ArgTrue, (void *) &appData.premoveBlack, FALSE, INVALID },
420 { "xpreblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
421 { "-preblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
422 { "premoveBlackText", ArgString, (void *) &appData.premoveBlackText, TRUE, (ArgIniType) "" },
423 { "icsAlarm", ArgBoolean, (void *) &appData.icsAlarm, TRUE, (ArgIniType) TRUE},
424 { "alarm", ArgTrue, (void *) &appData.icsAlarm, FALSE},
425 { "xalarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
426 { "-alarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
427 { "icsAlarmTime", ArgInt, (void *) &appData.icsAlarmTime, TRUE, (ArgIniType) 5000},
428 { "localLineEditing", ArgBoolean, (void *) &appData.localLineEditing, FALSE, (ArgIniType) TRUE},
429 { "edit", ArgTrue, (void *) &appData.localLineEditing, FALSE, INVALID },
430 { "xedit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
431 { "-edit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
432 { "animateMoving", ArgBoolean, (void *) &appData.animate, TRUE, (ArgIniType) TRUE },
433 { "animate", ArgTrue, (void *) &appData.animate, FALSE, INVALID },
434 { "xanimate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
435 { "-animate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
436 { "animateSpeed", ArgInt, (void *) &appData.animSpeed, TRUE, (ArgIniType) 10 },
437 { "animateDragging", ArgBoolean, (void *) &appData.animateDragging, TRUE, (ArgIniType) TRUE },
438 { "drag", ArgTrue, (void *) &appData.animateDragging, FALSE, INVALID },
439 { "xdrag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
440 { "-drag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
441 { "blindfold", ArgBoolean, (void *) &appData.blindfold, TRUE, (ArgIniType) FALSE },
442 { "blind", ArgTrue, (void *) &appData.blindfold, FALSE, INVALID },
443 { "xblind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
444 { "-blind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
445 { "highlightLastMove", ArgBoolean,
446 (void *) &appData.highlightLastMove, TRUE, (ArgIniType) TRUE },
447 { "highlight", ArgTrue, (void *) &appData.highlightLastMove, FALSE, INVALID },
448 { "xhighlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
449 { "-highlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
450 { "highlightDragging", ArgBoolean,
451 (void *) &appData.highlightDragging, !XBOARD, (ArgIniType) TRUE },
452 { "highdrag", ArgTrue, (void *) &appData.highlightDragging, FALSE, INVALID },
453 { "xhighdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
454 { "-highdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
455 { "colorizeMessages", ArgBoolean, (void *) &appData.colorize, TRUE, (ArgIniType) TRUE },
456 { "colorize", ArgTrue, (void *) &appData.colorize, FALSE, INVALID },
457 { "xcolorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
458 { "-colorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
459 { "colorShout", ArgAttribs, (void *) ColorShout, TRUE, INVALID },
460 { "colorSShout", ArgAttribs, (void *) ColorSShout, TRUE, INVALID },
461 { "colorCShout", ArgAttribs, (void *) ColorSShout, FALSE, INVALID }, // for XB
462 { "colorChannel1", ArgAttribs, (void *) ColorChannel1, TRUE, INVALID },
463 { "colorChannel", ArgAttribs, (void *) ColorChannel, TRUE, INVALID },
464 { "colorKibitz", ArgAttribs, (void *) ColorKibitz, TRUE, INVALID },
465 { "colorTell", ArgAttribs, (void *) ColorTell, TRUE, INVALID },
466 { "colorChallenge", ArgAttribs, (void *) ColorChallenge, TRUE, INVALID },
467 { "colorRequest", ArgAttribs, (void *) ColorRequest, TRUE, INVALID },
468 { "colorSeek", ArgAttribs, (void *) ColorSeek, TRUE, INVALID },
469 { "colorNormal", ArgAttribs, (void *) ColorNormal, TRUE, INVALID },
470 { "colorBackground", ArgColor, (void *) 7, TRUE, COLOR_BKGD },
471 { "soundShout", ArgFilename, (void *) &appData.soundShout, TRUE, (ArgIniType) "" },
472 { "soundSShout", ArgFilename, (void *) &appData.soundSShout, TRUE, (ArgIniType) "" },
473 { "soundCShout", ArgFilename, (void *) &appData.soundSShout, FALSE, (ArgIniType) "" }, // for XB
474 { "soundChannel1", ArgFilename, (void *) &appData.soundChannel1, TRUE, (ArgIniType) "" },
475 { "soundChannel", ArgFilename, (void *) &appData.soundChannel, TRUE, (ArgIniType) "" },
476 { "soundKibitz", ArgFilename, (void *) &appData.soundKibitz, TRUE, (ArgIniType) "" },
477 { "soundTell", ArgFilename, (void *) &appData.soundTell, TRUE, (ArgIniType) "" },
478 { "soundChallenge", ArgFilename, (void *) &appData.soundChallenge, TRUE, (ArgIniType) "" },
479 { "soundRequest", ArgFilename, (void *) &appData.soundRequest, TRUE, (ArgIniType) "" },
480 { "soundSeek", ArgFilename, (void *) &appData.soundSeek, TRUE, (ArgIniType) "" },
481 { "soundMove", ArgFilename, (void *) &appData.soundMove, TRUE, (ArgIniType) "" },
482 { "soundBell", ArgFilename, (void *) &appData.soundBell, TRUE, (ArgIniType) SOUND_BELL },
483 { "soundRoar", ArgFilename, (void *) &appData.soundRoar, TRUE, (ArgIniType) "" },
484 { "soundIcsWin", ArgFilename, (void *) &appData.soundIcsWin, TRUE, (ArgIniType) "" },
485 { "soundIcsLoss", ArgFilename, (void *) &appData.soundIcsLoss, TRUE, (ArgIniType) "" },
486 { "soundIcsDraw", ArgFilename, (void *) &appData.soundIcsDraw, TRUE, (ArgIniType) "" },
487 { "soundIcsUnfinished", ArgFilename, (void *) &appData.soundIcsUnfinished, TRUE, (ArgIniType) "" },
488 { "soundIcsAlarm", ArgFilename, (void *) &appData.soundIcsAlarm, TRUE, (ArgIniType) "" },
489 { "disguisePromotedPieces", ArgBoolean, (void *) &appData.disguise, TRUE, (ArgIniType) TRUE },
490 { "reuseFirst", ArgBoolean, (void *) &appData.reuseFirst, FALSE, (ArgIniType) TRUE },
491 { "reuse", ArgTrue, (void *) &appData.reuseFirst, FALSE, INVALID },
492 { "xreuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
493 { "-reuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
494 { "reuseChessPrograms", ArgBoolean,
495 (void *) &appData.reuseFirst, FALSE, INVALID }, /* backward compat only */
496 { "reuseSecond", ArgBoolean, (void *) &appData.reuseSecond, FALSE, (ArgIniType) TRUE },
497 { "reuse2", ArgTrue, (void *) &appData.reuseSecond, FALSE, INVALID },
498 { "xreuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
499 { "-reuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
500 { "comPortSettings", ArgCommSettings, (void *) /*&dcb*/ 0, TRUE, INVALID },
501 { "settingsFile", ArgSettingsFilename, (void *) &settingsFileName, FALSE, (ArgIniType) SETTINGS_FILE },
502 { "ini", ArgSettingsFilename, (void *) &settingsFileName, FALSE, INVALID },
503 { "at", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
504 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
505 { "saveSettingsFile", ArgFilename, (void *) &settingsFileName, FALSE, INVALID },
506 { "backupSettingsFile", ArgBackupSettingsFile, (void *) &settingsFileName, FALSE, INVALID },
507 { "saveSettingsOnExit", ArgBoolean, (void *) &saveSettingsOnExit, TRUE, (ArgIniType) TRUE },
508 { "chessProgram", ArgBoolean, (void *) &chessProgram, FALSE, (ArgIniType) FALSE },
509 { "cp", ArgTrue, (void *) &chessProgram, FALSE, INVALID },
510 { "xcp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
511 { "-cp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
512 { "icsMenu", ArgString, (void *) &icsTextMenuString, TRUE, (ArgIniType) ICS_TEXT_MENU_DEFAULT },
513 { "icsNames", ArgString, (void *) &icsNames, TRUE, (ArgIniType) ICS_NAMES },
514 { "singleEngineList", ArgBoolean, (void *) &singleList, !XBOARD, (ArgIniType) FALSE },
515 { "recentEngines", ArgInt, (void *) &appData.recentEngines, TRUE, (ArgIniType) 6 },
516 { "recentEngineList", ArgString, (void *) &appData.recentEngineList, TRUE, (ArgIniType) "" },
517 { "firstChessProgramNames", ArgString, (void *) &firstChessProgramNames,
518 TRUE, (ArgIniType) FCP_NAMES },
519 { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames,
520 !XBOARD, (ArgIniType) SCP_NAMES },
521 { "themeNames", ArgString, (void *) &appData.themeNames, TRUE, (ArgIniType) "native -upf false -ub false -ubt false -pid \"\"\n" },
522 { "engineList", ArgFilename, (void *) &engineListFile, TRUE, (ArgIniType) "" },
523 { "addMasterOption", ArgMaster, NULL, FALSE, INVALID },
524 { "installEngine", ArgInstall, (void *) &firstChessProgramNames, FALSE, (ArgIniType) "" },
525 { "installTheme", ArgInstall, (void *) &appData.themeNames, FALSE, (ArgIniType) "" },
526 { "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" },
527 { "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID },
528 { "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" },
529 { "firstProtocolVersion", ArgInt, (void *) &appData.firstProtocolVersion, FALSE, (ArgIniType) PROTOVER },
530 { "secondProtocolVersion", ArgInt, (void *) &appData.secondProtocolVersion,FALSE, (ArgIniType) PROTOVER },
531 { "showButtonBar", ArgBoolean, (void *) &appData.showButtonBar, TRUE, (ArgIniType) TRUE },
532 { "buttons", ArgTrue, (void *) &appData.showButtonBar, FALSE, INVALID },
533 { "xbuttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
534 { "-buttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
536 /* [AS] New features */
537 { "firstScoreAbs", ArgBoolean, (void *) &appData.firstScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
538 { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
539 { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE },
540 { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE },
541 { "pgnTimeLeft", ArgBoolean, (void *) &appData.cumulativeTimePGN, TRUE, (ArgIniType) FALSE },
542 { "liteBackTextureFile", ArgFilename, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
543 { "lbtf", ArgFilename, (void *) &appData.liteBackTextureFile, FALSE, INVALID },
544 { "darkBackTextureFile", ArgFilename, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
545 { "dbtf", ArgFilename, (void *) &appData.darkBackTextureFile, FALSE, INVALID },
546 { "liteBackTextureMode", ArgInt, (void *) &appData.liteBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
547 { "lbtm", ArgInt, (void *) &appData.liteBackTextureMode, FALSE, INVALID },
548 { "darkBackTextureMode", ArgInt, (void *) &appData.darkBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
549 { "dbtm", ArgInt, (void *) &appData.darkBackTextureMode, FALSE, INVALID },
550 { "renderPiecesWithFont", ArgString, (void *) &appData.renderPiecesWithFont, TRUE, (ArgIniType) "" },
551 { "pf", ArgString, (void *) &appData.renderPiecesWithFont, FALSE, INVALID },
552 { "fontPieceToCharTable", ArgString, (void *) &appData.fontToPieceTable, TRUE, (ArgIniType) "" },
553 { "fptc", ArgString, (void *) &appData.fontToPieceTable, FALSE, INVALID },
554 { "fontPieceBackColorWhite", ArgColor, (void *) 8, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
555 { "fontPieceForeColorWhite", ArgColor, (void *) 9, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
556 { "fontPieceBackColorBlack", ArgColor, (void *) 10, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
557 { "fontPieceForeColorBlack", ArgColor, (void *) 11, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
558 { "fpfcw", ArgColor, (void *) 9, FALSE, INVALID },
559 { "fpbcb", ArgColor, (void *) 10, FALSE, INVALID },
560 { "fontPieceSize", ArgInt, (void *) &appData.fontPieceSize, TRUE, (ArgIniType) 80 },
561 { "overrideLineGap", ArgInt, (void *) &appData.overrideLineGap, TRUE, (ArgIniType) 1 },
562 { "adjudicateLossThreshold", ArgInt, (void *) &appData.adjudicateLossThreshold, TRUE, (ArgIniType) 0 },
563 { "delayBeforeQuit", ArgInt, (void *) &appData.delayBeforeQuit, TRUE, (ArgIniType) 0 },
564 { "delayAfterQuit", ArgInt, (void *) &appData.delayAfterQuit, TRUE, (ArgIniType) 0 },
565 { "nameOfDebugFile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, (ArgIniType) DEBUG_FILE },
566 { "debugfile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, INVALID },
567 { "pgnEventHeader", ArgString, (void *) &appData.pgnEventHeader, TRUE, (ArgIniType) "Computer Chess Game" },
568 { "defaultFrcPosition", ArgInt, (void *) &appData.defaultFrcPosition, TRUE, (ArgIniType) -1 },
569 { "shuffleOpenings", ArgTrue, (void *) &shuffleOpenings, FALSE, INVALID },
570 { "fischerCastling", ArgTrue, (void *) &appData.fischerCastling, FALSE, INVALID },
571 { "gameListTags", ArgString, (void *) &appData.gameListTags, TRUE, (ArgIniType) GLT_DEFAULT_TAGS },
572 { "saveOutOfBookInfo", ArgBoolean, (void *) &appData.saveOutOfBookInfo, TRUE, (ArgIniType) TRUE },
573 { "showEvalInMoveHistory", ArgBoolean, (void *) &appData.showEvalInMoveHistory, TRUE, (ArgIniType) TRUE },
574 { "evalHistColorWhite", ArgColor, (void *) 12, TRUE, (ArgIniType) "#FFFFB0" },
575 { "evalHistColorBlack", ArgColor, (void *) 13, TRUE, (ArgIniType) "#AD5D3D" },
576 { "highlightMoveWithArrow", ArgBoolean, (void *) &appData.highlightMoveWithArrow, TRUE, (ArgIniType) FALSE },
577 { "highlightArrowColor", ArgColor, (void *) 14, TRUE, (ArgIniType) "#FFFF80" },
578 { "stickyWindows", ArgBoolean, (void *) &appData.useStickyWindows, TRUE, (ArgIniType) TRUE },
579 { "adjudicateDrawMoves", ArgInt, (void *) &appData.adjudicateDrawMoves, TRUE, (ArgIniType) 0 },
580 { "autoDisplayComment", ArgBoolean, (void *) &appData.autoDisplayComment, TRUE, (ArgIniType) TRUE },
581 { "autoDisplayTags", ArgBoolean, (void *) &appData.autoDisplayTags, TRUE, (ArgIniType) TRUE },
582 { "firstIsUCI", ArgBoolean, (void *) &appData.firstIsUCI, FALSE, (ArgIniType) FALSE },
583 { "fUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
584 { "firstUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
585 { "secondIsUCI", ArgBoolean, (void *) &appData.secondIsUCI, FALSE, (ArgIniType) FALSE },
586 { "secondUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
587 { "sUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
588 { "fUCCI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
589 { "sUCCI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
590 { "fUSI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
591 { "sUSI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
592 { "firstHasOwnBookUCI", ArgBoolean, (void *) &appData.firstHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
593 { "fNoOwnBookUCI", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
594 { "firstXBook", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
595 { "secondHasOwnBookUCI", ArgBoolean, (void *) &appData.secondHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
596 { "sNoOwnBookUCI", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
597 { "secondXBook", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
598 { "adapterCommand", ArgFilename, (void *) &appData.adapterCommand, TRUE, (ArgIniType) "polyglot -noini -ec \"%fcp\" -ed \"%fd\"" },
599 { "uxiAdapter", ArgFilename, (void *) &appData.ucciAdapter, TRUE, (ArgIniType) "" },
600 { "polyglotDir", ArgFilename, (void *) &appData.polyglotDir, TRUE, (ArgIniType) "" },
601 { "usePolyglotBook", ArgBoolean, (void *) &appData.usePolyglotBook, TRUE, (ArgIniType) FALSE },
602 { "polyglotBook", ArgFilename, (void *) &appData.polyglotBook, TRUE, (ArgIniType) "" },
603 { "bookDepth", ArgInt, (void *) &appData.bookDepth, TRUE, (ArgIniType) 12 },
604 { "bookVariation", ArgInt, (void *) &appData.bookStrength, TRUE, (ArgIniType) 50 },
605 { "discourageOwnBooks", ArgBoolean, (void *) &appData.defNoBook, TRUE, (ArgIniType) FALSE },
606 { "mcBookMode", ArgTrue, (void *) &mcMode, FALSE, (ArgIniType) FALSE },
607 { "defaultHashSize", ArgInt, (void *) &appData.defaultHashSize, TRUE, (ArgIniType) 64 },
608 { "defaultCacheSizeEGTB", ArgInt, (void *) &appData.defaultCacheSizeEGTB, TRUE, (ArgIniType) 4 },
609 { "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" },
610 { "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
611 { "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
612 { "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
613 { "upf", ArgBoolean, (void *) &appData.useFont, FALSE, INVALID },
614 { "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
615 { "ubt", ArgBoolean, (void *) &appData.useBitmaps, FALSE, INVALID },
616 { "useBorder", ArgBoolean, (void *) &appData.useBorder, TRUE, (ArgIniType) FALSE },
617 { "ub", ArgBoolean, (void *) &appData.useBorder, FALSE, INVALID },
618 { "border", ArgFilename, (void *) &appData.border, TRUE, (ArgIniType) "" },
619 { "finger", ArgFilename, (void *) &appData.finger, FALSE, (ArgIniType) "" },
620 { "epd", ArgTrue, (void *) &appData.epd, FALSE, INVALID },
621 { "inscriptions", ArgString, (void *) &appData.inscriptions, FALSE, (ArgIniType) "" },
622 { "autoInstall", ArgString, (void *) &appData.autoInstall, XBOARD, (ArgIniType) "" },
623 { "replace", ArgString, (void *) &replace, FALSE, (ArgIniType) NULL },
624 { "fixedSize", ArgBoolean, (void *) &appData.fixedSize, TRUE, (ArgIniType) FALSE },
625 { "showMoveTime", ArgBoolean, (void *) &appData.moveTime, TRUE, (ArgIniType) FALSE },
626 { "bmpSave", ArgInt, (void *) &appData.bmpSave, FALSE, 0 },
627 { "defaultEngineInstallDir", ArgFilename, (void *) &appData.defEngDir, FALSE, (ArgIniType) "." },
628 { "defaultInstallProtocol", ArgInt, (void *) &appData.defProtocol, TRUE, (ArgIniType) 0 },
630 // [HGM] tournament options
631 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
632 { "tf", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
633 { "participants", ArgString, (void *) &appData.participants, FALSE, (ArgIniType) "" },
634 { "tourneyType", ArgInt, (void *) &appData.tourneyType, FALSE, (ArgIniType) 0 },
635 { "tt", ArgInt, (void *) &appData.tourneyType, FALSE, INVALID },
636 { "tourneyCycles", ArgInt, (void *) &appData.tourneyCycles, FALSE, (ArgIniType) 1 },
637 { "cy", ArgInt, (void *) &appData.tourneyCycles, FALSE, INVALID },
638 { "results", ArgString, (void *) &appData.results, FALSE, (ArgIniType) "" },
639 { "syncAfterRound", ArgBoolean, (void *) &appData.roundSync, FALSE, (ArgIniType) FALSE },
640 { "syncAfterCycle", ArgBoolean, (void *) &appData.cycleSync, FALSE, (ArgIniType) TRUE },
641 { "seedBase", ArgInt, (void *) &appData.seedBase, FALSE, (ArgIniType) 1 },
642 { "pgnNumberTag", ArgBoolean, (void *) &appData.numberTag, TRUE, (ArgIniType) FALSE },
643 { "afterGame", ArgString, (void *) &appData.afterGame, FALSE, INVALID },
644 { "afterTourney", ArgString, (void *) &appData.afterTourney, FALSE, INVALID },
646 /* [HGM] board-size, adjudication and misc. options */
647 { "oneClickMove", ArgBoolean, (void *) &appData.oneClick, TRUE, (ArgIniType) FALSE },
648 { "boardWidth", ArgInt, (void *) &appData.NrFiles, FALSE, (ArgIniType) -1 },
649 { "boardHeight", ArgInt, (void *) &appData.NrRanks, FALSE, (ArgIniType) -1 },
650 { "rankOffset", ArgInt, (void *) &appData.rankOffset, FALSE, (ArgIniType) 0 },
651 { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, FALSE, (ArgIniType) -1 },
652 { "defaultMatchGames", ArgInt, (void *) &appData.defaultMatchGames, TRUE, (ArgIniType) 10 },
653 { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 },
654 { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID },
655 { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID },
656 { "colorNickNames", ArgString, (void *) &appData.colorNickNames, FALSE, INVALID },
657 { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, FALSE, (ArgIniType) FALSE },
658 { "allWhite", ArgBoolean, (void *) &appData.allWhite, FALSE, (ArgIniType) FALSE },
659 { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE },
660 { "firstAlphaRank", ArgBoolean, (void *) &first.alphaRank, FALSE, (ArgIniType) FALSE },
661 { "secondAlphaRank", ArgBoolean, (void *) &second.alphaRank, FALSE, (ArgIniType) FALSE },
662 { "testClaims", ArgBoolean, (void *) &appData.testClaims, TRUE, (ArgIniType) FALSE },
663 { "checkMates", ArgBoolean, (void *) &appData.checkMates, TRUE, (ArgIniType) FALSE },
664 { "materialDraws", ArgBoolean, (void *) &appData.materialDraws, TRUE, (ArgIniType) FALSE },
665 { "trivialDraws", ArgBoolean, (void *) &appData.trivialDraws, TRUE, (ArgIniType) FALSE },
666 { "ruleMoves", ArgInt, (void *) &appData.ruleMoves, TRUE, (ArgIniType) 51 },
667 { "repeatsToDraw", ArgInt, (void *) &appData.drawRepeats, TRUE, (ArgIniType) 6 },
668 { "backgroundObserve", ArgBoolean, (void *) &appData.bgObserve, TRUE, (ArgIniType) FALSE },
669 { "dualBoard", ArgBoolean, (void *) &appData.dualBoard, TRUE, (ArgIniType) FALSE },
670 { "autoKibitz", ArgTrue, (void *) &appData.autoKibitz, FALSE, INVALID },
671 { "engineDebugOutput", ArgInt, (void *) &appData.engineComments, FALSE, (ArgIniType) 1 },
672 { "userName", ArgString, (void *) &appData.userName, FALSE, INVALID },
673 { "rewindIndex", ArgInt, (void *) &appData.rewindIndex, FALSE, INVALID },
674 { "sameColorGames", ArgInt, (void *) &appData.sameColorGames, FALSE, INVALID },
675 { "smpCores", ArgInt, (void *) &appData.smpCores, TRUE, (ArgIniType) 1 },
676 { "egtFormats", ArgString, (void *) &appData.egtFormats, TRUE, (ArgIniType) "" },
677 { "niceEngines", ArgInt, (void *) &appData.niceEngines, TRUE, INVALID },
678 { "logoSize", ArgInt, (void *) &appData.logoSize, XBOARD, INVALID },
679 { "logoDir", ArgFilename, (void *) &appData.logoDir, XBOARD, (ArgIniType) "." },
680 { "firstLogo", ArgFilename, (void *) &appData.firstLogo, FALSE, (ArgIniType) "" },
681 { "secondLogo", ArgFilename, (void *) &appData.secondLogo, FALSE, (ArgIniType) "" },
682 { "autoLogo", ArgBoolean, (void *) &appData.autoLogo, TRUE, INVALID },
683 { "firstOptions", ArgString, (void *) &appData.firstOptions, FALSE, (ArgIniType) "" },
684 { "secondOptions", ArgString, (void *) &appData.secondOptions, FALSE, (ArgIniType) "" },
685 { "firstFeatures", ArgString, (void *) &appData.features[0], FALSE, (ArgIniType) "" },
686 { "secondFeatures", ArgString, (void *) &appData.features[1], FALSE, (ArgIniType) "" },
687 { "featureDefaults", ArgString, (void *) &appData.featureDefaults, TRUE, (ArgIniType) "" },
688 { "firstNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride1, FALSE, (ArgIniType) NULL },
689 { "secondNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride2, FALSE, (ArgIniType) NULL },
690 { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID },
691 { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID },
692 { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID },
693 { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, (ArgIniType) FALSE },
694 { "firstPgnName", ArgString, (void *) &appData.pgnName[0], FALSE, (ArgIniType) "" },
695 { "fn", ArgString, (void *) &appData.pgnName[0], FALSE, INVALID },
696 { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" },
697 { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID },
698 { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE },
699 { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE },
700 { "evalZoom", ArgInt, (void *) &appData.zoom, TRUE, (ArgIniType) 1 },
701 { "evalThreshold", ArgInt, (void *) &appData.evalThreshold, TRUE, (ArgIniType) 25 },
702 { "firstPseudo", ArgTrue, (void *) &appData.pseudo[0], FALSE, FALSE },
703 { "secondPseudo", ArgTrue, (void *) &appData.pseudo[1], FALSE, FALSE },
704 { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE },
705 { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE },
706 { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" },
707 { "defaultTourneyName", ArgFilename, (void *) &appData.defName, TRUE, "" },
708 { "eloThresholdAny", ArgInt, (void *) &appData.eloThreshold1, FALSE, (ArgIniType) 0 },
709 { "eloThresholdBoth", ArgInt, (void *) &appData.eloThreshold2, FALSE, (ArgIniType) 0 },
710 { "dateThreshold", ArgInt, (void *) &appData.dateThreshold, FALSE, (ArgIniType) 0 },
711 { "searchMode", ArgInt, (void *) &appData.searchMode, FALSE, (ArgIniType) 1 },
712 { "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 },
713 { "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE },
714 { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE },
715 { "viewer", ArgTrue, (void *) &appData.viewer, FALSE, FALSE },
716 { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" },
717 { "tourneyOptions", ArgString, (void *) &appData.tourneyOptions, TRUE, (ArgIniType) "-ncp -mm -saveSettingsOnExit false" },
718 { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE },
719 { "topLevel", ArgBoolean, (void *) &appData.topLevel, XBOARD, (ArgIniType) TOPLEVEL },
720 { "dialogColor", ArgString, (void *) &appData.dialogColor, XBOARD, (ArgIniType) "" },
721 { "buttonColor", ArgString, (void *) &appData.buttonColor, XBOARD, (ArgIniType) "" },
722 { "firstDrawDepth", ArgInt, (void *) &appData.drawDepth[0], FALSE, (ArgIniType) 0 },
723 { "secondDrawDepth", ArgInt, (void *) &appData.drawDepth[1], FALSE, (ArgIniType) 0 },
724 { "memoHeaders", ArgBoolean, (void *) &appData.headers, TRUE, (ArgIniType) FALSE },
725 { "startupMessage", ArgString, (void *) &appData.message, FALSE, (ArgIniType) "" },
726 { "messageSuppress", ArgString, (void *) &appData.suppress, XBOARD, (ArgIniType) "" },
727 { "fen", ArgString, (void *) &appData.fen, FALSE, (ArgIniType) "" },
728 { "men", ArgString, (void *) &appData.men, FALSE, (ArgIniType) "" },
729 { "analysisBell", ArgInt, (void *) &appData.analysisBell, TRUE, (ArgIniType) 0 },
732 { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
733 { "zt", ArgTrue, (void *) &appData.zippyTalk, FALSE, INVALID },
734 { "xzt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
735 { "-zt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
736 { "zippyPlay", ArgBoolean, (void *) &appData.zippyPlay, FALSE, (ArgIniType) ZIPPY_PLAY },
737 { "zp", ArgTrue, (void *) &appData.zippyPlay, FALSE, INVALID },
738 { "xzp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
739 { "-zp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
740 { "zippyLines", ArgFilename, (void *) &appData.zippyLines, FALSE, (ArgIniType) ZIPPY_LINES },
741 { "zippyPinhead", ArgString, (void *) &appData.zippyPinhead, FALSE, (ArgIniType) ZIPPY_PINHEAD },
742 { "zippyPassword", ArgString, (void *) &appData.zippyPassword, FALSE, (ArgIniType) ZIPPY_PASSWORD },
743 { "zippyPassword2", ArgString, (void *) &appData.zippyPassword2, FALSE, (ArgIniType) ZIPPY_PASSWORD2 },
744 { "zippyWrongPassword", ArgString, (void *) &appData.zippyWrongPassword,
745 FALSE, (ArgIniType) ZIPPY_WRONG_PASSWORD },
746 { "zippyAcceptOnly", ArgString, (void *) &appData.zippyAcceptOnly, FALSE, (ArgIniType) ZIPPY_ACCEPT_ONLY },
747 { "zippyUseI", ArgBoolean, (void *) &appData.zippyUseI, FALSE, (ArgIniType) ZIPPY_USE_I },
748 { "zui", ArgTrue, (void *) &appData.zippyUseI, FALSE, INVALID },
749 { "xzui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
750 { "-zui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
751 { "zippyBughouse", ArgInt, (void *) &appData.zippyBughouse, FALSE, (ArgIniType) ZIPPY_BUGHOUSE },
752 { "zippyNoplayCrafty", ArgBoolean, (void *) &appData.zippyNoplayCrafty,
753 FALSE, (ArgIniType) ZIPPY_NOPLAY_CRAFTY },
754 { "znc", ArgTrue, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
755 { "xznc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
756 { "-znc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
757 { "zippyGameEnd", ArgString, (void *) &appData.zippyGameEnd, FALSE, (ArgIniType) ZIPPY_GAME_END },
758 { "zippyGameStart", ArgString, (void *) &appData.zippyGameStart, FALSE, (ArgIniType) ZIPPY_GAME_START },
759 { "zippyAdjourn", ArgBoolean, (void *) &appData.zippyAdjourn, FALSE, (ArgIniType) ZIPPY_ADJOURN },
760 { "zadj", ArgTrue, (void *) &appData.zippyAdjourn, FALSE, INVALID },
761 { "xzadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
762 { "-zadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
763 { "zippyAbort", ArgBoolean, (void *) &appData.zippyAbort, FALSE, (ArgIniType) ZIPPY_ABORT },
764 { "zab", ArgTrue, (void *) &appData.zippyAbort, FALSE, INVALID },
765 { "xzab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
766 { "-zab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
767 { "zippyVariants", ArgString, (void *) &appData.zippyVariants, FALSE, (ArgIniType) ZIPPY_VARIANTS },
768 { "zippyMaxGames", ArgInt, (void *)&appData.zippyMaxGames, FALSE, (ArgIniType) ZIPPY_MAX_GAMES},
769 { "zippyReplayTimeout", ArgInt, (void *)&appData.zippyReplayTimeout, FALSE, (ArgIniType) ZIPPY_REPLAY_TIMEOUT },
770 { "zippyShortGame", ArgInt, (void *)&appData.zippyShortGame, FALSE, INVALID },
771 /* Kludge to allow winboard.ini files from buggy 4.0.4 to be read: */
772 { "zippyReplyTimeout", ArgInt, (void *)&junk, FALSE, INVALID },
774 /* [HGM] options for broadcasting and time odds */
775 { "chatBoxes", ArgString, (void *) &appData.chatBoxes, !XBOARD, (ArgIniType) NULL },
776 { "serverMoves", ArgString, (void *) &appData.serverMovesName, FALSE, (ArgIniType) NULL },
777 { "serverFile", ArgString, (void *) &appData.serverFileName, FALSE, (ArgIniType) NULL },
778 { "suppressLoadMoves", ArgBoolean, (void *) &appData.suppressLoadMoves, FALSE, (ArgIniType) FALSE },
779 { "serverPause", ArgInt, (void *) &appData.serverPause, FALSE, (ArgIniType) 15 },
780 { "firstTimeOdds", ArgInt, (void *) &appData.firstTimeOdds, FALSE, (ArgIniType) 1 },
781 { "secondTimeOdds", ArgInt, (void *) &appData.secondTimeOdds, FALSE, (ArgIniType) 1 },
782 { "timeOddsMode", ArgInt, (void *) &appData.timeOddsMode, TRUE, INVALID },
783 { "firstAccumulateTC", ArgInt, (void *) &appData.firstAccumulateTC, FALSE, (ArgIniType) 1 },
784 { "secondAccumulateTC", ArgInt, (void *) &appData.secondAccumulateTC, FALSE, (ArgIniType) 1 },
785 { "firstNPS", ArgInt, (void *) &appData.firstNPS, FALSE, (ArgIniType) -1 },
786 { "secondNPS", ArgInt, (void *) &appData.secondNPS, FALSE, (ArgIniType) -1 },
787 { "noGUI", ArgTrue, (void *) &appData.noGUI, FALSE, INVALID },
788 { "keepLineBreaksICS", ArgBoolean, (void *) &appData.noJoin, TRUE, INVALID },
789 { "wrapContinuationSequence", ArgString, (void *) &appData.wrapContSeq, FALSE, INVALID },
790 { "useInternalWrap", ArgTrue, (void *) &appData.useInternalWrap, FALSE, INVALID }, /* noJoin usurps this if set */
791 { "openCommand", ArgString, (void *) &appData.sysOpen, FALSE, "xdg-open" },
793 // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others
794 { "minX", ArgZ, (void *) &minX, FALSE, INVALID }, // [HGM] placement: to make sure auxiliary windows can be placed
795 { "minY", ArgZ, (void *) &minY, FALSE, INVALID },
796 { "winWidth", ArgInt, (void *) &wpMain.width, TRUE, INVALID }, // [HGM] placement: dummies to remember right & bottom
797 { "winHeight", ArgInt, (void *) &wpMain.height, TRUE, INVALID }, // for attaching auxiliary windows to them
798 { "x", ArgInt, (void *) &wpMain.x, TRUE, (ArgIniType) CW_USEDEFAULT },
799 { "y", ArgInt, (void *) &wpMain.y, TRUE, (ArgIniType) CW_USEDEFAULT },
800 { "icsUp", ArgBoolean, (void *) &wpConsole.visible, XBOARD, (ArgIniType) FALSE },
801 { "icsX", ArgX, (void *) &wpConsole.x, TRUE, (ArgIniType) CW_USEDEFAULT },
802 { "icsY", ArgY, (void *) &wpConsole.y, TRUE, (ArgIniType) CW_USEDEFAULT },
803 { "icsW", ArgInt, (void *) &wpConsole.width, TRUE, (ArgIniType) CW_USEDEFAULT },
804 { "icsH", ArgInt, (void *) &wpConsole.height, TRUE, (ArgIniType) CW_USEDEFAULT },
805 { "commentX", ArgX, (void *) &wpComment.x, TRUE, (ArgIniType) CW_USEDEFAULT },
806 { "commentY", ArgY, (void *) &wpComment.y, TRUE, (ArgIniType) CW_USEDEFAULT },
807 { "commentW", ArgInt, (void *) &wpComment.width, TRUE, (ArgIniType) CW_USEDEFAULT },
808 { "commentH", ArgInt, (void *) &wpComment.height, TRUE, (ArgIniType) CW_USEDEFAULT },
809 { "tagsX", ArgX, (void *) &wpTags.x, TRUE, (ArgIniType) CW_USEDEFAULT },
810 { "tagsY", ArgY, (void *) &wpTags.y, TRUE, (ArgIniType) CW_USEDEFAULT },
811 { "tagsW", ArgInt, (void *) &wpTags.width, TRUE, (ArgIniType) CW_USEDEFAULT },
812 { "tagsH", ArgInt, (void *) &wpTags.height, TRUE, (ArgIniType) CW_USEDEFAULT },
813 { "gameListX", ArgX, (void *) &wpGameList.x, TRUE, (ArgIniType) CW_USEDEFAULT },
814 { "gameListY", ArgY, (void *) &wpGameList.y, TRUE, (ArgIniType) CW_USEDEFAULT },
815 { "gameListW", ArgInt, (void *) &wpGameList.width, TRUE, (ArgIniType) CW_USEDEFAULT },
816 { "gameListH", ArgInt, (void *) &wpGameList.height, TRUE, (ArgIniType) CW_USEDEFAULT },
818 { "slaveX", ArgX, (void *) &wpDualBoard.x, TRUE, (ArgIniType) CW_USEDEFAULT },
819 { "slaveY", ArgY, (void *) &wpDualBoard.y, TRUE, (ArgIniType) CW_USEDEFAULT },
820 { "slaveW", ArgInt, (void *) &wpDualBoard.width, FALSE, (ArgIniType) CW_USEDEFAULT },
821 { "slaveH", ArgInt, (void *) &wpDualBoard.height, FALSE, (ArgIniType) CW_USEDEFAULT },
823 /* [AS] Layout stuff */
824 { "moveHistoryUp", ArgBoolean, (void *) &wpMoveHistory.visible, TRUE, (ArgIniType) TRUE },
825 { "moveHistoryX", ArgX, (void *) &wpMoveHistory.x, TRUE, (ArgIniType) CW_USEDEFAULT },
826 { "moveHistoryY", ArgY, (void *) &wpMoveHistory.y, TRUE, (ArgIniType) CW_USEDEFAULT },
827 { "moveHistoryW", ArgInt, (void *) &wpMoveHistory.width, TRUE, (ArgIniType) CW_USEDEFAULT },
828 { "moveHistoryH", ArgInt, (void *) &wpMoveHistory.height, TRUE, (ArgIniType) CW_USEDEFAULT },
830 { "evalGraphUp", ArgBoolean, (void *) &wpEvalGraph.visible, TRUE, (ArgIniType) TRUE },
831 { "evalGraphX", ArgX, (void *) &wpEvalGraph.x, TRUE, (ArgIniType) CW_USEDEFAULT },
832 { "evalGraphY", ArgY, (void *) &wpEvalGraph.y, TRUE, (ArgIniType) CW_USEDEFAULT },
833 { "evalGraphW", ArgInt, (void *) &wpEvalGraph.width, TRUE, (ArgIniType) CW_USEDEFAULT },
834 { "evalGraphH", ArgInt, (void *) &wpEvalGraph.height, TRUE, (ArgIniType) CW_USEDEFAULT },
836 { "engineOutputUp", ArgBoolean, (void *) &wpEngineOutput.visible, TRUE, (ArgIniType) TRUE },
837 { "engineOutputX", ArgX, (void *) &wpEngineOutput.x, TRUE, (ArgIniType) CW_USEDEFAULT },
838 { "engineOutputY", ArgY, (void *) &wpEngineOutput.y, TRUE, (ArgIniType) CW_USEDEFAULT },
839 { "engineOutputW", ArgInt, (void *) &wpEngineOutput.width, TRUE, (ArgIniType) CW_USEDEFAULT },
840 { "engineOutputH", ArgInt, (void *) &wpEngineOutput.height, TRUE, (ArgIniType) CW_USEDEFAULT },
842 { NULL, ArgNone, NULL, FALSE, INVALID }
846 /* Kludge for indirection files on command line */
847 char* lastIndirectionFilename;
848 ArgDescriptor argDescriptorIndirection =
849 { "", ArgSettingsFilename, (void *) NULL, FALSE };
852 ExitArgError(char *msg, char *badArg, Boolean quit)
857 len = snprintf(buf, MSG_SIZ, msg, badArg);
858 if( (len >= MSG_SIZ) && appData.debugMode )
859 fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
861 if(!quit) { printf(_("%s in settings file\n"), buf); return; } // DisplayError does not work yet at this stage...
862 DisplayFatalError(buf, 0, 2);
867 AppendToSettingsFile (char *line)
872 if(f = fopen(SETTINGS_FILE, "r")) {
875 while((buf[i] = c = fgetc(f)) != '\n' && c != EOF) if(i < MSG_SIZ-1) i++;
877 if(!strcmp(line, buf)) return; // line occurs
879 // line did not occur; add it
881 if(f = fopen(SETTINGS_FILE, "a")) {
884 fprintf(f, "-date %10lu\n%s\n", now.sec, line);
894 if(*p == '-' || *p == '+') p++;
895 while(*p) if(!isdigit(*p++)) ExitArgError(_("Bad integer value %s"), s, TRUE);
900 StringGet(void *getClosure)
902 char **p = (char **) getClosure;
907 FileGet(void *getClosure)
910 FILE* f = (FILE*) getClosure;
913 if (c == '\r') c = getc(f); // work around DOS format files by bypassing the '\r' completely
920 /* Parse settings file named "name". If file found, return the
921 full name in fullname and return TRUE; else return FALSE */
923 ParseSettingsFile(char *name, char **addr)
927 char buf[MSG_SIZ], fullname[MSG_SIZ];
930 ok = MySearchPath(installDir, name, fullname);
931 if(!ok && strchr(name, '.') == NULL)
932 { // append default file-name extension '.ini' when needed
933 len = snprintf(buf,MSG_SIZ, "%s.ini", name);
934 if( (len >= MSG_SIZ) && appData.debugMode )
935 fprintf(debugFP, "ParseSettingsFile: buffer truncated. Input: name=%s \n",name);
937 ok = MySearchPath(installDir, buf, fullname);
940 f = fopen(fullname, "r");
942 if(f == NULL && *fullname != '/' && !addr) { // when a relative name did not work
944 snprintf(buf, MSG_SIZ, "~/.xboard/themes/conf/%s", name);
945 MySearchPath(installDir, buf, fullname); // first look in user's own files
946 f = fopen(fullname, "r");
948 snprintf(buf, MSG_SIZ, "%s/themes/conf", dataDir);
949 MySearchPath(buf, name, fullname); // also look in standard place
950 f = fopen(fullname, "r");
956 ASSIGN(*addr, fullname);
958 ParseArgs(FileGet, f);
967 ParseArgs(GetFunc get, void *cl)
969 char argName[MAX_ARG_LEN];
970 char argValue[MAX_ARG_LEN];
976 int posarg = 4; // default is game file
981 while (ch == ' ' || ch == '\n' || ch == '\t') ch = get(cl);
982 if (ch == NULLCHAR) break;
984 /* Comment to end of line */
986 while (ch != '\n' && ch != NULLCHAR) ch = get(cl);
988 } else if (ch == SLASH || ch == '-') {
991 while (ch != ' ' && ch != '=' && ch != ':' && ch != NULLCHAR &&
992 ch != '\n' && ch != '\t') {
997 for (ad = argDescriptors; ad->argName != NULL; ad++)
998 if (strcmp(ad->argName, argName + 1) == 0) break;
999 if (ad->argName == NULL) {
1000 char endChar = (ch && ch != '\n' && (ch = get(cl)) == '{' ? '}' : '\n');
1001 ExitArgError(_("Unrecognized argument %s"), argName, get != &FileGet); // [HGM] make unknown argument non-fatal
1002 while (ch != endChar && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on (or until closing '}' )
1003 if(ch == '}') ch = get(cl);
1004 continue; // so that when it is in a settings file, it is the only setting that will be purged from it
1006 } else if (ch == '@') {
1007 /* Indirection file */
1008 ad = &argDescriptorIndirection;
1011 /* Positional argument */
1012 ad = &argDescriptors[posarg++];
1014 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
1017 if (ad->argType == ArgTwo) { // [HGM] kludgey arg type, not suitable for saving
1018 *(Boolean *) ad->argLoc = 2;
1021 if (ad->argType == ArgTrue) {
1022 *(Boolean *) ad->argLoc = TRUE;
1025 if (ad->argType == ArgFalse) {
1026 *(Boolean *) ad->argLoc = FALSE;
1030 while (ch == ' ' || ch == '=' || ch == ':' || ch == '\t') ch = get(cl);
1031 if (ch == NULLCHAR || ch == '\n') {
1032 ExitArgError(_("No value provided for argument %s"), argName, TRUE);
1036 // Quoting with { }. No characters have to (or can) be escaped.
1037 // Thus the string cannot contain a '}' character.
1057 } else if (ch == '\'' || ch == '"') {
1058 // Quoting with ' ' or " ", with \ as escape character.
1059 // Inconvenient for long strings that may contain Windows filenames.
1085 if (ad->argType == ArgFilename
1086 || ad->argType == ArgSettingsFilename) {
1092 ExitArgError(_("Incomplete \\ escape in value for %s"), argName, TRUE);
1116 for (i = 0; i < 3; i++) {
1117 if (ch >= '0' && ch <= '7') {
1118 octval = octval*8 + (ch - '0');
1125 *q++ = (char) octval;
1136 while ((ch != ' ' || posflag) && ch != NULLCHAR && ch != '\t' && ch != '\n') { // space allowed in positional arg
1143 if(posflag) { // positional argument: the argName was implied, and per default set as -lgf
1144 int len = strlen(argValue) - 4; // start of filename extension
1145 if(len < 0) len = 0;
1146 if(!StrCaseCmp(argValue + len, ".trn")) {
1147 ad = &argDescriptors[2]; // correct implied type to -tf
1148 appData.tourney = TRUE; // let it parse -tourneyOptions later
1149 } else if(!StrCaseCmp(argValue + len, ".fen") || !StrCaseCmp(argValue + len, ".epd")) {
1150 ad = &argDescriptors[1]; // correct implied type to -lpf
1151 appData.viewer = TRUE;
1152 } else if(!StrCaseCmp(argValue + len, ".ini") || !StrCaseCmp(argValue + len, ".xop")) {
1153 ad = &argDescriptors[0]; // correct implied type to -opt
1154 } else if(GetEngineLine(argValue, 11)) {
1155 ad = &argDescriptors[3]; // correct implied type to -is
1156 } else { // keep default -lgf, but let it imply viewer mode as well
1157 appData.viewer = TRUE;
1159 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
1162 switch (ad->argType) {
1164 *(int *) ad->argLoc = ValidateInt(argValue);
1168 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute
1172 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...)
1176 *(int *) ad->argLoc = ValidateInt(argValue);
1177 EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY);
1181 *(float *) ad->argLoc = (float) atof(argValue);
1186 if(argValue[0] == '~' && argValue[1] == '~') {
1187 char buf[4*MSG_SIZ]; // expand ~~
1188 snprintf(buf, 4*MSG_SIZ, "%s%s", dataDir, argValue+2);
1189 ASSIGN(*(char **) ad->argLoc, buf);
1192 if(replace) { // previous -replace option makes this string option conditional
1193 int differs = strcmp(*(char**) ad->argLoc, (char*) replace);
1194 free(replace); replace = NULL; // but expires in the process
1195 if(differs) break; // only use to replace the given string
1197 ASSIGN(*(char **) ad->argLoc, argValue);
1200 case ArgBackupSettingsFile: // no-op if non-default settings-file already successfully read
1201 if(strcmp(*(char**)ad->argLoc, SETTINGS_FILE)) break;
1202 case ArgSettingsFilename:
1204 if (ParseSettingsFile(argValue, (char**)ad->argLoc)) {
1206 if (ad->argLoc != NULL) {
1208 ExitArgError(_("Failed to open indirection file %s"), argValue, TRUE);
1215 switch (argValue[0]) {
1218 *(Boolean *) ad->argLoc = TRUE;
1222 *(Boolean *) ad->argLoc = FALSE;
1225 ExitArgError(_("Unrecognized boolean argument value %s"), argValue, TRUE);
1231 ParseColor((int)(intptr_t)ad->argLoc, argValue);
1235 ColorClass cc = (ColorClass)ad->argLoc;
1236 ParseTextAttribs(cc, argValue); // [HGM] wrapper for platform independency
1241 ParseBoardSize(ad->argLoc, argValue);
1245 ParseFont(argValue, (int)(intptr_t)ad->argLoc);
1248 case ArgCommSettings:
1249 ParseCommPortSettings(argValue);
1253 AppendToSettingsFile(argValue);
1257 q = *(char **) ad->argLoc;
1258 r = NULL; s = argValue;
1259 if(argValue[0] == '#') { // group specification
1260 r = strstr(argValue, "\\n");
1261 if(r) *r++ = '\n', *r++ = NULLCHAR, s = r, r = argValue; // split s into line-to-add (s) and group (r)
1263 if((saveDate == 0 || saveDate - dateStamp < 0) && !strstr(q, s) ) { // not seen before, and line does not occur yet
1264 int l = strlen(q) + strlen(s);
1265 if(r) { // must be put in group r
1266 char *p = strstr(q, r);
1267 if(p) { // group already exists
1268 p += strlen(r) - 1; // determine insertion point (immediately after group header line)
1269 *(char **) ad->argLoc = malloc(l+2);
1270 *p++ = NULLCHAR; // spit old value (q) at insertion point into q and p
1271 snprintf(*(char **) ad->argLoc, l+2, "%s\n%s\n%s", q, s, p); // insert (with newline)
1272 } else { // group did not exist, create at end
1274 *(char **) ad->argLoc = malloc(l);
1275 snprintf(*(char **) ad->argLoc, l, "%s%s%s\n# end\n", q, r, s);
1277 } else { // no group, just add line at end
1278 *(char **) ad->argLoc = malloc(l+2);
1279 snprintf(*(char **) ad->argLoc, l+2, "%s%s\n", q, s);
1286 ExitArgError(_("Unrecognized argument %s"), argValue, TRUE);
1296 ParseArgsFromString(char *p)
1298 ParseArgs(StringGet, &p);
1302 ParseArgsFromFile(FILE *f)
1304 ParseArgs(FileGet, f);
1308 ParseIcsTextMenu(char *icsTextMenuString)
1311 IcsTextMenuEntry *e = icsTextMenuEntry;
1312 char *p = icsTextMenuString;
1313 while (e->item != NULL && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1316 if (e->command != NULL) {
1322 e = icsTextMenuEntry;
1323 while (*p && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1324 if (*p == ';' || *p == '\n') {
1325 e->item = strdup("-");
1328 } else if (*p == '-') {
1329 e->item = strdup("-");
1334 char *q, *r, *s, *t;
1337 if (q == NULL) break;
1339 r = strchr(q + 1, ',');
1340 if (r == NULL) break;
1342 s = strchr(r + 1, ',');
1343 if (s == NULL) break;
1346 t = strchr(s + 1, c);
1349 t = strchr(s + 1, c);
1351 if (t != NULL) *t = NULLCHAR;
1352 e->item = strdup(p);
1353 e->command = strdup(q + 1);
1354 e->getname = *(r + 1) != '0';
1355 e->immediate = *(s + 1) != '0';
1359 if (t == NULL) break;
1368 SetDefaultTextAttribs()
1371 for (cc = (ColorClass)0; cc < ColorNone; cc++) {
1372 ParseTextAttribs(cc, defaultTextAttribs[cc]);
1377 SetDefaultsFromList()
1378 { // [HGM] ini: take defaults from argDescriptor list
1381 for(i=0; argDescriptors[i].argName != NULL; i++) {
1382 if(argDescriptors[i].defaultValue != INVALID)
1383 switch(argDescriptors[i].argType) {
1388 *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1394 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1398 case ArgSettingsFilename:
1399 if((char *)argDescriptors[i].defaultValue)
1400 *(char **) argDescriptors[i].argLoc = strdup((char *)argDescriptors[i].defaultValue);
1403 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1406 ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue);
1408 case ArgFloat: // floats cannot be casted to int without precision loss
1409 default: ; // some arg types cannot be initialized through table
1415 InitAppData(char *lpCmdLine)
1418 char buf[MAX_ARG_LEN], currDir[MSG_SIZ];
1421 /* Initialize to defaults */
1422 SetDefaultsFromList(); // this sets most defaults
1424 // some parameters for which there are no options!
1425 appData.Iconic = FALSE; /*unused*/
1426 appData.icsEngineAnalyze = FALSE;
1428 // float: casting to int is not harmless, so default cannot be contained in table
1429 appData.timeDelay = TIME_DELAY;
1430 appData.timeIncrement = -314159;
1432 // some complex, platform-dependent stuff that could not be handled from table
1433 SetDefaultTextAttribs();
1435 SetCommPortDefaults();
1437 /* Parse default settings file if any */
1438 ParseSettingsFile(settingsFileName, &settingsFileName);
1440 /* Parse command line */
1441 ParseArgs(StringGet, &lpCmdLine);
1443 /* if separate engine list is used, parse that too */
1444 if(*engineListFile) {
1446 MySearchPath(installDir, engineListFile, buf);
1447 if(*buf) { ASSIGN(engineListFile, buf); }
1448 ParseSettingsFile(engineListFile, &engineListFile);
1451 if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
1452 if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions);
1453 chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);
1454 appData.icsActive |= GetEngineLine(icsNick, 10);
1456 /* [HGM] make sure board size is acceptable */
1457 if(appData.NrFiles > BOARD_FILES ||
1458 appData.NrRanks > BOARD_RANKS )
1459 DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2);
1461 if(!*appData.secondChessProgram) { // [HGM] scp defaults to fcp
1462 ASSIGN(appData.secondChessProgram, appData.firstChessProgram);
1463 ASSIGN(appData.secondDirectory, appData.firstDirectory);
1464 appData.secondIsUCI = appData.firstIsUCI; // copy type too!
1467 /* [HGM] After parsing the options from the .ini file, and overruling them
1468 * with options from the command line, we now make an even higher priority
1469 * overrule by WB options attached to the engine command line. This so that
1470 * tournament managers can use WB options (such as /timeOdds) that follow
1473 if(appData.firstChessProgram != NULL) {
1474 char *p = StrStr(appData.firstChessProgram, "WBopt");
1475 static char *f = "first";
1476 char buf[MSG_SIZ], *q = buf;
1480 { // engine command line contains WinBoard options
1481 len = snprintf(buf, MSG_SIZ, p+6, f, f, f, f, f, f, f, f, f, f); // replace %s in them by "first"
1482 if( (len >= MSG_SIZ) && appData.debugMode )
1483 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1485 ParseArgs(StringGet, &q);
1486 p[-1] = 0; // cut them offengine command line
1489 // now do same for second chess program
1490 if(appData.secondChessProgram != NULL) {
1491 char *p = StrStr(appData.secondChessProgram, "WBopt");
1492 static char *s = "second";
1493 char buf[MSG_SIZ], *q = buf;
1497 { // engine command line contains WinBoard options
1498 len = snprintf(buf,MSG_SIZ, p+6, s, s, s, s, s, s, s, s, s, s); // replace %s in them by "first"
1499 if( (len >= MSG_SIZ) && appData.debugMode )
1500 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1502 ParseArgs(StringGet, &q);
1503 p[-1] = 0; // cut them offengine command line
1507 /* Propagate options that affect others */
1508 if (appData.matchMode || appData.matchGames) chessProgram = TRUE;
1509 if (appData.icsActive || appData.noChessProgram) {
1510 chessProgram = FALSE; /* not local chess program mode */
1512 if(appData.timeIncrement == -314159) { // new storage mechanism of (mps,inc) in use and no -inc on command line
1513 if(appData.movesPerSession <= 0) { // new encoding of incremental mode
1514 appData.timeIncrement = -appData.movesPerSession/1000.;
1515 } else appData.timeIncrement = -1;
1517 if(appData.movesPerSession <= 0) appData.movesPerSession = MOVES_PER_SESSION; // mps <= 0 is invalid in any case
1518 if(*appData.defaultPathEGTB) { // append value of deprecated -defaultPathEGTB to -egtFormats
1519 snprintf(buf, MAX_ARG_LEN, "%s%snalimov:%s", appData.egtFormats, (*appData.egtFormats ?"," : ""), appData.defaultPathEGTB);
1520 ASSIGN(appData.egtFormats, buf);
1521 ASSIGN(appData.defaultPathEGTB, "");
1524 /* Open startup dialog if needed */
1525 if ((!appData.noChessProgram && !chessProgram && !appData.icsActive) ||
1526 (appData.icsActive && *appData.icsHost == NULLCHAR) ||
1527 (chessProgram && (*appData.firstChessProgram == NULLCHAR ||
1528 *appData.secondChessProgram == NULLCHAR)))
1529 PopUpStartupDialog();
1531 /* Make sure save files land in the right (?) directory */
1532 if (MyGetFullPathName(appData.saveGameFile, buf)) {
1533 appData.saveGameFile = strdup(buf);
1535 if (MyGetFullPathName(appData.savePositionFile, buf)) {
1536 appData.savePositionFile = strdup(buf);
1539 if(autoClose) { // was called for updating settingsfile only
1540 if(saveSettingsOnExit) SaveSettings(settingsFileName);
1544 /* Finish initialization for fonts and sounds */
1547 GetCurrentDirectory(MSG_SIZ, currDir);
1548 SetCurrentDirectory(installDir);
1550 SetCurrentDirectory(currDir);
1552 p = icsTextMenuString;
1554 FILE* f = fopen(p + 1, "r");
1556 DisplayFatalError(p + 1, errno, 2);
1559 i = fread(buf, 1, sizeof(buf)-1, f);
1564 ParseIcsTextMenu(strdup(p));
1568 SaveSettings(char* name)
1572 char dir[MSG_SIZ], buf[MSG_SIZ];
1573 int mps = appData.movesPerSession;
1575 if (!MainWindowUp() && !autoClose) return;
1577 saveDate = programStartTime.sec;
1579 GetCurrentDirectory(MSG_SIZ, dir);
1580 if(MySearchPath(installDir, name, buf)) {
1581 f = fopen(buf, "w");
1583 SetCurrentDirectory(installDir);
1584 f = fopen(name, "w");
1585 SetCurrentDirectory(dir);
1588 DisplayError(name, errno);
1593 fprintf(f, "; %s Save Settings file\n", PACKAGE_STRING);
1595 fprintf(f, "; You can edit the values of options that are already set in this file,\n");
1596 fprintf(f, "; but if you add other options, the next Save Settings will not save them.\n");
1597 fprintf(f, "; Use a shortcut, an @indirection file, or a .bat file instead.\n");
1602 /* [AS] Move history */
1603 wpMoveHistory.visible = MoveHistoryIsUp();
1605 /* [AS] Eval graph */
1606 wpEvalGraph.visible = EvalGraphIsUp();
1608 /* [AS] Engine output */
1609 wpEngineOutput.visible = EngineOutputIsUp();
1611 // [HGM] in WB we have to copy sound names to appData first
1614 if(appData.timeIncrement >= 0) appData.movesPerSession = -1000*appData.timeIncrement; // kludge to store mps & inc as one
1616 for (ad = argDescriptors; ad->argName != NULL; ad++) {
1617 if (!ad->save) continue;
1618 switch (ad->argType) {
1621 char *p = *(char **)ad->argLoc;
1622 if(p == NULL) break; // just in case
1623 if ((strchr(p, '\\') || strchr(p, '\n')) && !strchr(p, '}')) {
1624 /* Quote multiline values or \-containing values
1625 with { } if possible */
1626 fprintf(f, OPTCHAR "%s" SEPCHAR "{%s}\n", ad->argName, p);
1628 /* Else quote with " " */
1629 fprintf(f, OPTCHAR "%s" SEPCHAR "\"", ad->argName);
1631 if (*p == '\n') fprintf(f, "\n");
1632 else if (*p == '\r') fprintf(f, "\\r");
1633 else if (*p == '\t') fprintf(f, "\\t");
1634 else if (*p == '\b') fprintf(f, "\\b");
1635 else if (*p == '\f') fprintf(f, "\\f");
1636 else if (*p < ' ') fprintf(f, "\\%03o", *p);
1637 else if (*p == '\"') fprintf(f, "\\\"");
1638 else if (*p == '\\') fprintf(f, "\\\\");
1648 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc);
1651 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.x); // [HGM] placement: store relative value
1654 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.y);
1657 fprintf(f, OPTCHAR "%s" SEPCHAR "%g\n", ad->argName, *(float *)ad->argLoc);
1660 fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName,
1661 (*(Boolean *)ad->argLoc) ? "true" : "false");
1664 if (*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1667 if (!*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1673 SaveAttribsArg(f, ad);
1676 if(*(char**)ad->argLoc == NULL) break; // just in case
1677 { char buf[MSG_SIZ];
1678 snprintf(buf, MSG_SIZ, "%s", *(char**)ad->argLoc);
1680 if(strstr(buf, dataDir) == buf)
1681 snprintf(buf, MSG_SIZ, "~~%s", *(char**)ad->argLoc + strlen(dataDir));
1683 if (strchr(buf, '\"')) {
1684 fprintf(f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, buf);
1686 fprintf(f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, buf);
1691 SaveBoardSize(f, ad->argName, ad->argLoc);
1696 case ArgCommSettings:
1697 PrintCommPortSettings(f, ad->argName);
1700 case ArgBackupSettingsFile:
1701 case ArgSettingsFilename: ;
1707 appData.movesPerSession = mps;
1711 GetArgValue(char *name)
1712 { // retrieve (as text) current value of string or int argument given by name
1713 // (this is used for maing the values available in the adapter command)
1717 for (ad = argDescriptors; ad->argName != NULL; ad++)
1718 if (strcmp(ad->argName, name) == 0) break;
1720 if (ad->argName == NULL) return FALSE;
1722 switch(ad->argType) {
1725 strncpy(name, *(char**) ad->argLoc, MSG_SIZ);
1729 len = snprintf(name, MSG_SIZ, "%d", *(int*) ad->argLoc);
1730 if( (len >= MSG_SIZ) && appData.debugMode )
1731 fprintf(debugFP, "GetArgValue: buffer truncated.\n");
1735 len = snprintf(name, MSG_SIZ, "%s", *(Boolean*) ad->argLoc ? "true" : "false");
1736 if( (len >= MSG_SIZ) && appData.debugMode )
1737 fprintf(debugFP, "GetArgValue: buffer truncated.\n");