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 void EnsureOnScreen(int *x, int *y, int minX, int minY);
117 char StringGet(void *getClosure);
118 void ParseFont(char *name, int number);
119 void SetFontDefaults();
121 void ParseColor(int n, char *name);
122 void ParseTextAttribs(ColorClass cc, char *s);
123 void ParseBoardSize(void * addr, char *name);
124 void ParseCommPortSettings(char *name);
125 void LoadAllSounds();
126 void SetCommPortDefaults();
127 void SaveFontArg(FILE *f, ArgDescriptor *ad);
129 void SaveAttribsArg(FILE *f, ArgDescriptor *ad);
130 void SaveColor(FILE *f, ArgDescriptor *ad);
131 void SaveBoardSize(FILE *f, char *name, void *addr);
132 void PrintCommPortSettings(FILE *f, char *name);
133 void GetWindowCoords();
135 void PopUpStartupDialog();
136 typedef char GetFunc(void *getClosure);
137 void ParseArgs(GetFunc get, void *cl);
139 // [HGM] this is an exact duplicate of something in winboard.c. Move to backend.c?
140 char *defaultTextAttribs[] =
142 COLOR_SHOUT, COLOR_SSHOUT, COLOR_CHANNEL1, COLOR_CHANNEL, COLOR_KIBITZ,
143 COLOR_TELL, COLOR_CHALLENGE, COLOR_REQUEST, COLOR_SEEK, COLOR_NORMAL,
147 ArgDescriptor argDescriptors[] = {
148 /* positional arguments */
149 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
150 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
151 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
152 { "is", ArgString, (void *) &icsNick, FALSE, INVALID },
153 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
154 { "", ArgNone, NULL, FALSE, INVALID },
155 /* keyword arguments */
156 { "saveDate", ArgInt, (void *) &saveDate, TRUE, 0 },
157 { "date", ArgInt, (void *) &dateStamp, FALSE, 0 },
158 { "autoClose", ArgTrue, (void *) &autoClose, FALSE, FALSE },
160 { "whitePieceColor", ArgColor, (void *) 0, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
161 { "wpc", ArgColor, (void *) 0, FALSE, INVALID },
162 { "blackPieceColor", ArgColor, (void *) 1, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
163 { "bpc", ArgColor, (void *) 1, FALSE, INVALID },
164 { "lightSquareColor", ArgColor, (void *) 2, TRUE, (ArgIniType) LIGHT_SQUARE_COLOR },
165 { "lsc", ArgColor, (void *) 2, FALSE, INVALID },
166 { "darkSquareColor", ArgColor, (void *) 3, TRUE, (ArgIniType) DARK_SQUARE_COLOR },
167 { "dsc", ArgColor, (void *) 3, FALSE, INVALID },
168 { "highlightSquareColor", ArgColor, (void *) 4, TRUE, (ArgIniType) HIGHLIGHT_SQUARE_COLOR },
169 { "hsc", ArgColor, (void *) 4, FALSE, INVALID },
170 { "premoveHighlightColor", ArgColor, (void *) 5, TRUE, (ArgIniType) PREMOVE_HIGHLIGHT_COLOR },
171 { "phc", ArgColor, (void *) 5, FALSE, INVALID },
172 { "movesPerSession", ArgInt, (void *) &appData.movesPerSession, TRUE, (ArgIniType) MOVES_PER_SESSION },
173 { "mps", ArgInt, (void *) &appData.movesPerSession, FALSE, INVALID },
174 { "initString", ArgString, (void *) &appData.firstInitString, FALSE, INVALID },
175 { "firstInitString", ArgString, (void *) &appData.firstInitString, FALSE, (ArgIniType) INIT_STRING },
176 { "secondInitString", ArgString, (void *) &appData.secondInitString, FALSE, (ArgIniType) INIT_STRING },
177 { "firstComputerString", ArgString, (void *) &appData.firstComputerString,
178 FALSE, (ArgIniType) COMPUTER_STRING },
179 { "secondComputerString", ArgString, (void *) &appData.secondComputerString,
180 FALSE, (ArgIniType) COMPUTER_STRING },
181 { "firstChessProgram", ArgFilename, (void *) &appData.firstChessProgram,
182 FALSE, (ArgIniType) FIRST_CHESS_PROGRAM },
183 { "fcp", ArgFilename, (void *) &appData.firstChessProgram, FALSE, INVALID },
184 { "secondChessProgram", ArgFilename, (void *) &appData.secondChessProgram,
185 FALSE, (ArgIniType) SECOND_CHESS_PROGRAM },
186 { "scp", ArgFilename, (void *) &appData.secondChessProgram, FALSE, INVALID },
187 { "fe", ArgString, (void *) &firstEngineLine, FALSE, "" },
188 { "se", ArgString, (void *) &secondEngineLine, FALSE, "" },
189 { "firstPlaysBlack", ArgBoolean, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
190 { "fb", ArgTrue, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
191 { "xfb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
192 { "-fb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
193 { "noChessProgram", ArgBoolean, (void *) &appData.noChessProgram, FALSE, FALSE },
194 { "ncp", ArgTrue, (void *) &appData.noChessProgram, FALSE, INVALID },
195 { "xncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
196 { "-ncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
197 { "firstHost", ArgString, (void *) &appData.firstHost, FALSE, (ArgIniType) FIRST_HOST },
198 { "fh", ArgString, (void *) &appData.firstHost, FALSE, INVALID },
199 { "secondHost", ArgString, (void *) &appData.secondHost, FALSE, (ArgIniType) SECOND_HOST },
200 { "sh", ArgString, (void *) &appData.secondHost, FALSE, INVALID },
201 { "firstDirectory", ArgFilename, (void *) &appData.firstDirectory, FALSE, (ArgIniType) FIRST_DIRECTORY },
202 { "fd", ArgFilename, (void *) &appData.firstDirectory, FALSE, INVALID },
203 { "secondDirectory", ArgFilename, (void *) &appData.secondDirectory, FALSE, (ArgIniType) SECOND_DIRECTORY },
204 { "sd", ArgFilename, (void *) &appData.secondDirectory, FALSE, INVALID },
205 { "variations", ArgBoolean, (void *) &appData.variations, TRUE, (ArgIniType) FALSE },
206 { "appendPV", ArgBoolean, (void *) &appData.autoExtend, TRUE, (ArgIniType) FALSE },
207 { "theme", ArgString, (void *) &theme, FALSE, (ArgIniType) "" },
209 /* some options only used by the XBoard front end, and ignored in WinBoard */
210 /* Their saving is controlled by XBOARD, which in WinBoard is defined as FALSE */
211 { "internetChessServerInputBox", ArgBoolean, (void *) &appData.icsInputBox, XBOARD, (ArgIniType) FALSE },
212 { "icsinput", ArgTrue, (void *) &appData.icsInputBox, FALSE, INVALID },
213 { "xicsinput", ArgFalse, (void *) &appData.icsInputBox, FALSE, INVALID },
214 { "cmail", ArgString, (void *) &appData.cmailGameName, FALSE, (ArgIniType) "" },
215 { "soundProgram", ArgFilename, (void *) &appData.soundProgram, XBOARD, (ArgIniType) "play" },
216 { "fontSizeTolerance", ArgInt, (void *) &appData.fontSizeTolerance, XBOARD, (ArgIniType) 4 },
217 { "lowTimeWarningColor", ArgColor, (void *) 6, XBOARD, (ArgIniType) LOWTIMEWARNING_COLOR },
218 { "lowTimeWarning", ArgBoolean, (void *) &appData.lowTimeWarning, XBOARD, (ArgIniType) FALSE },
219 { "titleInWindow", ArgBoolean, (void *) &appData.titleInWindow, XBOARD, (ArgIniType) FALSE },
220 { "title", ArgTrue, (void *) &appData.titleInWindow, FALSE, INVALID },
221 { "xtitle", ArgFalse, (void *) &appData.titleInWindow, FALSE, INVALID },
222 { "flashCount", ArgInt, (void *) &appData.flashCount, XBOARD, INVALID }, // let X handle this
223 { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE },
224 { "pieceImageDirectory", ArgFilename, (void *) &appData.pieceDirectory, TRUE, (ArgIniType) "" },
225 { "pid", ArgFilename, (void *) &appData.pieceDirectory, FALSE, INVALID },
226 { "trueColors", ArgBoolean, (void *) &appData.trueColors, TRUE, (ArgIniType) FALSE },
227 { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" },
228 { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY },
229 { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE },
231 { "dropMenu", ArgBoolean, (void *) &appData.dropMenu, TRUE, (ArgIniType) FALSE },
232 { "pieceMenu", ArgBoolean, (void *) &appData.pieceMenu, TRUE, (ArgIniType) TRUE },
233 { "sweepPromotions", ArgBoolean, (void *) &appData.sweepSelect, TRUE, (ArgIniType) FALSE },
234 { "monoMouse", ArgBoolean, (void *) &appData.monoMouse, XBOARD, (ArgIniType) FALSE },
235 { "remoteShell", ArgFilename, (void *) &appData.remoteShell, FALSE, (ArgIniType) REMOTE_SHELL },
236 { "rsh", ArgFilename, (void *) &appData.remoteShell, FALSE, INVALID },
237 { "remoteUser", ArgString, (void *) &appData.remoteUser, FALSE, (ArgIniType) "" },
238 { "ruser", ArgString, (void *) &appData.remoteUser, FALSE, INVALID },
239 { "timeDelay", ArgFloat, (void *) &appData.timeDelay, TRUE, INVALID },
240 { "td", ArgFloat, (void *) &appData.timeDelay, FALSE, INVALID },
241 { "timeControl", ArgString, (void *) &appData.timeControl, TRUE, (ArgIniType) TIME_CONTROL },
242 { "tc", ArgString, (void *) &appData.timeControl, FALSE, INVALID },
243 { "timeIncrement", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
244 { "inc", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
245 { "internetChessServerMode", ArgBoolean, (void *) &appData.icsActive, FALSE, INVALID },
246 { "ics", ArgTrue, (void *) &appData.icsActive, FALSE, (ArgIniType) FALSE },
247 { "xics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
248 { "-ics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
249 { "is", ArgString, (void *) &icsNick, FALSE, "" },
250 { "internetChessServerHost", ArgString, (void *) &appData.icsHost, FALSE, (ArgIniType) "" },
251 { "icshost", ArgString, (void *) &appData.icsHost, FALSE, INVALID },
252 { "internetChessServerPort", ArgString, (void *) &appData.icsPort, FALSE, (ArgIniType) ICS_PORT },
253 { "icsport", ArgString, (void *) &appData.icsPort, FALSE, INVALID },
254 { "internetChessServerCommPort", ArgString, (void *) &appData.icsCommPort, FALSE, (ArgIniType) ICS_COMM_PORT },
255 { "icscomm", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
256 { "internetChessServerComPort", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
257 { "icscom", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
258 { "internetChessServerLogonScript", ArgFilename, (void *) &appData.icsLogon, FALSE, (ArgIniType) ICS_LOGON },
259 { "icslogon", ArgFilename, (void *) &appData.icsLogon, FALSE, INVALID },
260 { "useTelnet", ArgBoolean, (void *) &appData.useTelnet, FALSE, INVALID },
261 { "telnet", ArgTrue, (void *) &appData.useTelnet, FALSE, INVALID },
262 { "xtelnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
263 { "-telnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
264 { "telnetProgram", ArgFilename, (void *) &appData.telnetProgram, FALSE, (ArgIniType) TELNET_PROGRAM },
265 { "internetChessserverHelper", ArgFilename, (void *) &appData.icsHelper,
266 FALSE, INVALID }, // for XB
267 { "icshelper", ArgFilename, (void *) &appData.icsHelper, FALSE, (ArgIniType) "" },
268 { "seekGraph", ArgBoolean, (void *) &appData.seekGraph, TRUE, (ArgIniType) FALSE },
269 { "sg", ArgTrue, (void *) &appData.seekGraph, FALSE, INVALID },
270 { "autoRefresh", ArgBoolean, (void *) &appData.autoRefresh, TRUE, (ArgIniType) FALSE },
271 { "autoBox", ArgBoolean, (void *) &appData.autoBox, XBOARD, (ArgIniType) TRUE },
272 { "gateway", ArgString, (void *) &appData.gateway, FALSE, (ArgIniType) "" },
273 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, (ArgIniType) "" },
274 { "lgf", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
275 { "loadGameIndex", ArgInt, (void *) &appData.loadGameIndex, FALSE, (ArgIniType) 0 },
276 { "lgi", ArgInt, (void *) &appData.loadGameIndex, FALSE, INVALID },
277 { "saveGameFile", ArgFilename, (void *) &appData.saveGameFile, TRUE, (ArgIniType) "" },
278 { "sgf", ArgFilename, (void *) &appData.saveGameFile, FALSE, INVALID },
279 { "autoSaveGames", ArgBoolean, (void *) &appData.autoSaveGames, TRUE, (ArgIniType) FALSE },
280 { "autosave", ArgTrue, (void *) &appData.autoSaveGames, FALSE, INVALID },
281 { "xautosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
282 { "-autosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
283 { "onlyOwnGames", ArgBoolean, (void *) &appData.onlyOwn, TRUE, (ArgIniType) FALSE },
284 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, (ArgIniType) "" },
285 { "lpf", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
286 { "loadPositionIndex", ArgInt, (void *) &appData.loadPositionIndex, FALSE, (ArgIniType) 1 },
287 { "lpi", ArgInt, (void *) &appData.loadPositionIndex, FALSE, INVALID },
288 { "positionDir", ArgFilename, (void *) &appData.positionDir, FALSE, (ArgIniType) "" },
289 { "savePositionFile", ArgFilename, (void *) &appData.savePositionFile, FALSE, (ArgIniType) "" },
290 { "spf", ArgFilename, (void *) &appData.savePositionFile, FALSE, INVALID },
291 { "matchMode", ArgBoolean, (void *) &appData.matchMode, FALSE, (ArgIniType) FALSE },
292 { "mm", ArgTrue, (void *) &appData.matchMode, FALSE, INVALID },
293 { "xmm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
294 { "-mm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
295 { "matchGames", ArgInt, (void *) &appData.matchGames, FALSE, (ArgIniType) 0 },
296 { "mg", ArgInt, (void *) &appData.matchGames, FALSE, INVALID },
297 { "monoMode", ArgBoolean, (void *) &appData.monoMode, TRUE, (ArgIniType) FALSE },
298 { "mono", ArgTrue, (void *) &appData.monoMode, FALSE, INVALID },
299 { "xmono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
300 { "-mono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
301 { "debugMode", ArgBoolean, (void *) &appData.debugMode, FALSE, (ArgIniType) FALSE },
302 { "debug", ArgTrue, (void *) &appData.debugMode, FALSE, INVALID },
303 { "xdebug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
304 { "-debug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
305 { "clockMode", ArgBoolean, (void *) &appData.clockMode, FALSE, (ArgIniType) TRUE },
306 { "clock", ArgTrue, (void *) &appData.clockMode, FALSE, INVALID },
307 { "xclock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
308 { "-clock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
309 { "searchTime", ArgString, (void *) &appData.searchTime, FALSE, (ArgIniType) "" },
310 { "st", ArgString, (void *) &appData.searchTime, FALSE, INVALID },
311 { "searchDepth", ArgInt, (void *) &appData.searchDepth, FALSE, (ArgIniType) 0 },
312 { "depth", ArgInt, (void *) &appData.searchDepth, FALSE, INVALID },
313 { "showCoords", ArgBoolean, (void *) &appData.showCoords, TRUE, (ArgIniType) FALSE },
314 { "coords", ArgTrue, (void *) &appData.showCoords, FALSE, INVALID },
315 { "xcoords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
316 { "-coords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
317 { "showThinking", ArgBoolean, (void *) &appData.showThinking, TRUE, (ArgIniType) FALSE },
318 { "thinking", ArgTrue, (void *) &appData.showThinking, FALSE, INVALID },
319 { "xthinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
320 { "-thinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
321 { "ponderNextMove", ArgBoolean, (void *) &appData.ponderNextMove, TRUE, (ArgIniType) TRUE },
322 { "ponder", ArgTrue, (void *) &appData.ponderNextMove, FALSE, INVALID },
323 { "xponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
324 { "-ponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
325 { "periodicUpdates", ArgBoolean, (void *) &appData.periodicUpdates, TRUE, (ArgIniType) TRUE },
326 { "periodic", ArgTrue, (void *) &appData.periodicUpdates, FALSE, INVALID },
327 { "xperiodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
328 { "-periodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
329 { "popupExitMessage", ArgBoolean, (void *) &appData.popupExitMessage, TRUE, (ArgIniType) TRUE },
330 { "exit", ArgTrue, (void *) &appData.popupExitMessage, FALSE, INVALID },
331 { "xexit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
332 { "-exit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
333 { "popupMoveErrors", ArgBoolean, (void *) &appData.popupMoveErrors, TRUE, (ArgIniType) FALSE },
334 { "popup", ArgTrue, (void *) &appData.popupMoveErrors, FALSE, INVALID },
335 { "xpopup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
336 { "-popup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
337 { "popUpErrors", ArgBoolean, (void *) &appData.popupMoveErrors,
338 FALSE, INVALID }, /* only so that old WinBoard.ini files from betas can be read */
339 { "clockFont", ArgFont, (void *) CLOCK_FONT, TRUE, INVALID },
340 { "messageFont", ArgFont, (void *) MESSAGE_FONT, TRUE, INVALID },
341 { "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. */
342 { "coordFont", ArgFont, (void *) COORD_FONT, TRUE, INVALID },
343 { "tagsFont", ArgFont, (void *) EDITTAGS_FONT, TRUE, INVALID },
344 { "commentFont", ArgFont, (void *) COMMENT_FONT, TRUE, INVALID },
345 { "icsFont", ArgFont, (void *) CONSOLE_FONT, TRUE, INVALID },
346 { "moveHistoryFont", ArgFont, (void *) MOVEHISTORY_FONT, TRUE, INVALID }, /* [AS] */
347 { "gameListFont", ArgFont, (void *) GAMELIST_FONT, TRUE, INVALID }, /* [HGM] */
348 { "boardSize", ArgBoardSize, (void *) &boardSize,
349 TRUE, (ArgIniType) -1 }, /* must come after all fonts */
350 { "size", ArgBoardSize, (void *) &boardSize, FALSE, INVALID },
351 { "ringBellAfterMoves", ArgBoolean, (void *) &appData.ringBellAfterMoves,
352 FALSE, (ArgIniType) TRUE }, /* historical; kept only so old winboard.ini files will parse */
353 { "bell", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
354 { "xbell", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
355 { "movesound", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
356 { "xmovesound", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
357 { "alwaysOnTop", ArgBoolean, (void *) &alwaysOnTop, TRUE, INVALID },
358 { "top", ArgTrue, (void *) &alwaysOnTop, FALSE, INVALID },
359 { "xtop", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
360 { "-top", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
361 { "autoCallFlag", ArgBoolean, (void *) &appData.autoCallFlag, TRUE, (ArgIniType) FALSE },
362 { "autoflag", ArgTrue, (void *) &appData.autoCallFlag, FALSE, INVALID },
363 { "xautoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
364 { "-autoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
365 { "autoComment", ArgBoolean, (void *) &appData.autoComment, TRUE, (ArgIniType) FALSE },
366 { "autocomm", ArgTrue, (void *) &appData.autoComment, FALSE, INVALID },
367 { "xautocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
368 { "-autocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
369 { "autoCreateLogon", ArgBoolean, (void *) &appData.autoCreateLogon, TRUE, (ArgIniType) FALSE },
370 { "autoObserve", ArgBoolean, (void *) &appData.autoObserve, TRUE, (ArgIniType) FALSE },
371 { "autobs", ArgTrue, (void *) &appData.autoObserve, FALSE, INVALID },
372 { "xautobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
373 { "-autobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
374 { "flipView", ArgBoolean, (void *) &appData.flipView, FALSE, (ArgIniType) FALSE },
375 { "flip", ArgTrue, (void *) &appData.flipView, FALSE, INVALID },
376 { "xflip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
377 { "-flip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
378 { "autoFlipView", ArgBoolean, (void *) &appData.autoFlipView, TRUE, (ArgIniType) TRUE },
379 { "autoflip", ArgTrue, (void *) &appData.autoFlipView, FALSE, INVALID },
380 { "xautoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
381 { "-autoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
382 { "autoRaiseBoard", ArgBoolean, (void *) &appData.autoRaiseBoard, TRUE, (ArgIniType) TRUE },
383 { "autoraise", ArgTrue, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
384 { "xautoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
385 { "-autoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
386 { "alwaysPromoteToQueen", ArgBoolean, (void *) &appData.alwaysPromoteToQueen, TRUE, (ArgIniType) FALSE },
387 { "queen", ArgTrue, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
388 { "xqueen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
389 { "-queen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
390 { "oldSaveStyle", ArgBoolean, (void *) &appData.oldSaveStyle, TRUE, (ArgIniType) FALSE },
391 { "oldsave", ArgTrue, (void *) &appData.oldSaveStyle, FALSE, INVALID },
392 { "xoldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
393 { "-oldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
394 { "quietPlay", ArgBoolean, (void *) &appData.quietPlay, TRUE, (ArgIniType) FALSE },
395 { "quiet", ArgTrue, (void *) &appData.quietPlay, FALSE, INVALID },
396 { "xquiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
397 { "-quiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
398 { "getMoveList", ArgBoolean, (void *) &appData.getMoveList, TRUE, (ArgIniType) TRUE },
399 { "moves", ArgTrue, (void *) &appData.getMoveList, FALSE, INVALID },
400 { "xmoves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
401 { "-moves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
402 { "testLegality", ArgBoolean, (void *) &appData.testLegality, TRUE, (ArgIniType) TRUE },
403 { "legal", ArgTrue, (void *) &appData.testLegality, FALSE, INVALID },
404 { "xlegal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
405 { "-legal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
406 { "premove", ArgBoolean, (void *) &appData.premove, TRUE, (ArgIniType) TRUE },
407 { "pre", ArgTrue, (void *) &appData.premove, FALSE, INVALID },
408 { "xpre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
409 { "-pre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
410 { "premoveWhite", ArgBoolean, (void *) &appData.premoveWhite, TRUE, (ArgIniType) FALSE },
411 { "prewhite", ArgTrue, (void *) &appData.premoveWhite, FALSE, INVALID },
412 { "xprewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
413 { "-prewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
414 { "premoveWhiteText", ArgString, (void *) &appData.premoveWhiteText, TRUE, (ArgIniType) "" },
415 { "premoveBlack", ArgBoolean, (void *) &appData.premoveBlack, TRUE, (ArgIniType) FALSE },
416 { "preblack", ArgTrue, (void *) &appData.premoveBlack, FALSE, INVALID },
417 { "xpreblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
418 { "-preblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
419 { "premoveBlackText", ArgString, (void *) &appData.premoveBlackText, TRUE, (ArgIniType) "" },
420 { "icsAlarm", ArgBoolean, (void *) &appData.icsAlarm, TRUE, (ArgIniType) TRUE},
421 { "alarm", ArgTrue, (void *) &appData.icsAlarm, FALSE},
422 { "xalarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
423 { "-alarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
424 { "icsAlarmTime", ArgInt, (void *) &appData.icsAlarmTime, TRUE, (ArgIniType) 5000},
425 { "localLineEditing", ArgBoolean, (void *) &appData.localLineEditing, FALSE, (ArgIniType) TRUE},
426 { "edit", ArgTrue, (void *) &appData.localLineEditing, FALSE, INVALID },
427 { "xedit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
428 { "-edit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
429 { "animateMoving", ArgBoolean, (void *) &appData.animate, TRUE, (ArgIniType) TRUE },
430 { "animate", ArgTrue, (void *) &appData.animate, FALSE, INVALID },
431 { "xanimate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
432 { "-animate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
433 { "animateSpeed", ArgInt, (void *) &appData.animSpeed, TRUE, (ArgIniType) 10 },
434 { "animateDragging", ArgBoolean, (void *) &appData.animateDragging, TRUE, (ArgIniType) TRUE },
435 { "drag", ArgTrue, (void *) &appData.animateDragging, FALSE, INVALID },
436 { "xdrag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
437 { "-drag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
438 { "blindfold", ArgBoolean, (void *) &appData.blindfold, TRUE, (ArgIniType) FALSE },
439 { "blind", ArgTrue, (void *) &appData.blindfold, FALSE, INVALID },
440 { "xblind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
441 { "-blind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
442 { "highlightLastMove", ArgBoolean,
443 (void *) &appData.highlightLastMove, TRUE, (ArgIniType) TRUE },
444 { "highlight", ArgTrue, (void *) &appData.highlightLastMove, FALSE, INVALID },
445 { "xhighlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
446 { "-highlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
447 { "highlightDragging", ArgBoolean,
448 (void *) &appData.highlightDragging, !XBOARD, (ArgIniType) TRUE },
449 { "highdrag", ArgTrue, (void *) &appData.highlightDragging, FALSE, INVALID },
450 { "xhighdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
451 { "-highdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
452 { "colorizeMessages", ArgBoolean, (void *) &appData.colorize, TRUE, (ArgIniType) TRUE },
453 { "colorize", ArgTrue, (void *) &appData.colorize, FALSE, INVALID },
454 { "xcolorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
455 { "-colorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
456 { "colorShout", ArgAttribs, (void *) ColorShout, TRUE, INVALID },
457 { "colorSShout", ArgAttribs, (void *) ColorSShout, TRUE, INVALID },
458 { "colorCShout", ArgAttribs, (void *) ColorSShout, FALSE, INVALID }, // for XB
459 { "colorChannel1", ArgAttribs, (void *) ColorChannel1, TRUE, INVALID },
460 { "colorChannel", ArgAttribs, (void *) ColorChannel, TRUE, INVALID },
461 { "colorKibitz", ArgAttribs, (void *) ColorKibitz, TRUE, INVALID },
462 { "colorTell", ArgAttribs, (void *) ColorTell, TRUE, INVALID },
463 { "colorChallenge", ArgAttribs, (void *) ColorChallenge, TRUE, INVALID },
464 { "colorRequest", ArgAttribs, (void *) ColorRequest, TRUE, INVALID },
465 { "colorSeek", ArgAttribs, (void *) ColorSeek, TRUE, INVALID },
466 { "colorNormal", ArgAttribs, (void *) ColorNormal, TRUE, INVALID },
467 { "colorBackground", ArgColor, (void *) 7, TRUE, COLOR_BKGD },
468 { "soundShout", ArgFilename, (void *) &appData.soundShout, TRUE, (ArgIniType) "" },
469 { "soundSShout", ArgFilename, (void *) &appData.soundSShout, TRUE, (ArgIniType) "" },
470 { "soundCShout", ArgFilename, (void *) &appData.soundSShout, FALSE, (ArgIniType) "" }, // for XB
471 { "soundChannel1", ArgFilename, (void *) &appData.soundChannel1, TRUE, (ArgIniType) "" },
472 { "soundChannel", ArgFilename, (void *) &appData.soundChannel, TRUE, (ArgIniType) "" },
473 { "soundKibitz", ArgFilename, (void *) &appData.soundKibitz, TRUE, (ArgIniType) "" },
474 { "soundTell", ArgFilename, (void *) &appData.soundTell, TRUE, (ArgIniType) "" },
475 { "soundChallenge", ArgFilename, (void *) &appData.soundChallenge, TRUE, (ArgIniType) "" },
476 { "soundRequest", ArgFilename, (void *) &appData.soundRequest, TRUE, (ArgIniType) "" },
477 { "soundSeek", ArgFilename, (void *) &appData.soundSeek, TRUE, (ArgIniType) "" },
478 { "soundMove", ArgFilename, (void *) &appData.soundMove, TRUE, (ArgIniType) "" },
479 { "soundBell", ArgFilename, (void *) &appData.soundBell, TRUE, (ArgIniType) SOUND_BELL },
480 { "soundRoar", ArgFilename, (void *) &appData.soundRoar, TRUE, (ArgIniType) "" },
481 { "soundIcsWin", ArgFilename, (void *) &appData.soundIcsWin, TRUE, (ArgIniType) "" },
482 { "soundIcsLoss", ArgFilename, (void *) &appData.soundIcsLoss, TRUE, (ArgIniType) "" },
483 { "soundIcsDraw", ArgFilename, (void *) &appData.soundIcsDraw, TRUE, (ArgIniType) "" },
484 { "soundIcsUnfinished", ArgFilename, (void *) &appData.soundIcsUnfinished, TRUE, (ArgIniType) "" },
485 { "soundIcsAlarm", ArgFilename, (void *) &appData.soundIcsAlarm, TRUE, (ArgIniType) "" },
486 { "disguisePromotedPieces", ArgBoolean, (void *) &appData.disguise, TRUE, (ArgIniType) TRUE },
487 { "reuseFirst", ArgBoolean, (void *) &appData.reuseFirst, FALSE, (ArgIniType) TRUE },
488 { "reuse", ArgTrue, (void *) &appData.reuseFirst, FALSE, INVALID },
489 { "xreuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
490 { "-reuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
491 { "reuseChessPrograms", ArgBoolean,
492 (void *) &appData.reuseFirst, FALSE, INVALID }, /* backward compat only */
493 { "reuseSecond", ArgBoolean, (void *) &appData.reuseSecond, FALSE, (ArgIniType) TRUE },
494 { "reuse2", ArgTrue, (void *) &appData.reuseSecond, FALSE, INVALID },
495 { "xreuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
496 { "-reuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
497 { "comPortSettings", ArgCommSettings, (void *) /*&dcb*/ 0, TRUE, INVALID },
498 { "settingsFile", ArgSettingsFilename, (void *) &settingsFileName, FALSE, (ArgIniType) SETTINGS_FILE },
499 { "ini", ArgSettingsFilename, (void *) &settingsFileName, FALSE, INVALID },
500 { "at", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
501 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
502 { "saveSettingsFile", ArgFilename, (void *) &settingsFileName, FALSE, INVALID },
503 { "backupSettingsFile", ArgBackupSettingsFile, (void *) &settingsFileName, FALSE, INVALID },
504 { "saveSettingsOnExit", ArgBoolean, (void *) &saveSettingsOnExit, TRUE, (ArgIniType) TRUE },
505 { "chessProgram", ArgBoolean, (void *) &chessProgram, FALSE, (ArgIniType) FALSE },
506 { "cp", ArgTrue, (void *) &chessProgram, FALSE, INVALID },
507 { "xcp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
508 { "-cp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
509 { "icsMenu", ArgString, (void *) &icsTextMenuString, TRUE, (ArgIniType) ICS_TEXT_MENU_DEFAULT },
510 { "icsNames", ArgString, (void *) &icsNames, TRUE, (ArgIniType) ICS_NAMES },
511 { "singleEngineList", ArgBoolean, (void *) &singleList, !XBOARD, (ArgIniType) FALSE },
512 { "recentEngines", ArgInt, (void *) &appData.recentEngines, TRUE, (ArgIniType) 6 },
513 { "recentEngineList", ArgString, (void *) &appData.recentEngineList, TRUE, (ArgIniType) "" },
514 { "firstChessProgramNames", ArgString, (void *) &firstChessProgramNames,
515 TRUE, (ArgIniType) FCP_NAMES },
516 { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames,
517 !XBOARD, (ArgIniType) SCP_NAMES },
518 { "themeNames", ArgString, (void *) &appData.themeNames, TRUE, (ArgIniType) "native -upf false -ub false -ubt false -pid \"\"\n" },
519 { "addMasterOption", ArgMaster, NULL, FALSE, INVALID },
520 { "installEngine", ArgInstall, (void *) &firstChessProgramNames, FALSE, (ArgIniType) "" },
521 { "installTheme", ArgInstall, (void *) &appData.themeNames, FALSE, (ArgIniType) "" },
522 { "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" },
523 { "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID },
524 { "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" },
525 { "firstProtocolVersion", ArgInt, (void *) &appData.firstProtocolVersion, FALSE, (ArgIniType) PROTOVER },
526 { "secondProtocolVersion", ArgInt, (void *) &appData.secondProtocolVersion,FALSE, (ArgIniType) PROTOVER },
527 { "showButtonBar", ArgBoolean, (void *) &appData.showButtonBar, TRUE, (ArgIniType) TRUE },
528 { "buttons", ArgTrue, (void *) &appData.showButtonBar, FALSE, INVALID },
529 { "xbuttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
530 { "-buttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
532 /* [AS] New features */
533 { "firstScoreAbs", ArgBoolean, (void *) &appData.firstScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
534 { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
535 { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE },
536 { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE },
537 { "liteBackTextureFile", ArgFilename, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
538 { "lbtf", ArgFilename, (void *) &appData.liteBackTextureFile, FALSE, INVALID },
539 { "darkBackTextureFile", ArgFilename, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
540 { "dbtf", ArgFilename, (void *) &appData.darkBackTextureFile, FALSE, INVALID },
541 { "liteBackTextureMode", ArgInt, (void *) &appData.liteBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
542 { "lbtm", ArgInt, (void *) &appData.liteBackTextureMode, FALSE, INVALID },
543 { "darkBackTextureMode", ArgInt, (void *) &appData.darkBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
544 { "dbtm", ArgInt, (void *) &appData.darkBackTextureMode, FALSE, INVALID },
545 { "renderPiecesWithFont", ArgString, (void *) &appData.renderPiecesWithFont, TRUE, (ArgIniType) "" },
546 { "pf", ArgString, (void *) &appData.renderPiecesWithFont, FALSE, INVALID },
547 { "fontPieceToCharTable", ArgString, (void *) &appData.fontToPieceTable, TRUE, (ArgIniType) "" },
548 { "fptc", ArgString, (void *) &appData.fontToPieceTable, FALSE, INVALID },
549 { "fontPieceBackColorWhite", ArgColor, (void *) 8, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
550 { "fontPieceForeColorWhite", ArgColor, (void *) 9, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
551 { "fontPieceBackColorBlack", ArgColor, (void *) 10, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
552 { "fontPieceForeColorBlack", ArgColor, (void *) 11, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
553 { "fpfcw", ArgColor, (void *) 9, FALSE, INVALID },
554 { "fpbcb", ArgColor, (void *) 10, FALSE, INVALID },
555 { "fontPieceSize", ArgInt, (void *) &appData.fontPieceSize, TRUE, (ArgIniType) 80 },
556 { "overrideLineGap", ArgInt, (void *) &appData.overrideLineGap, TRUE, (ArgIniType) 1 },
557 { "adjudicateLossThreshold", ArgInt, (void *) &appData.adjudicateLossThreshold, TRUE, (ArgIniType) 0 },
558 { "delayBeforeQuit", ArgInt, (void *) &appData.delayBeforeQuit, TRUE, (ArgIniType) 0 },
559 { "delayAfterQuit", ArgInt, (void *) &appData.delayAfterQuit, TRUE, (ArgIniType) 0 },
560 { "nameOfDebugFile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, (ArgIniType) DEBUG_FILE },
561 { "debugfile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, INVALID },
562 { "pgnEventHeader", ArgString, (void *) &appData.pgnEventHeader, TRUE, (ArgIniType) "Computer Chess Game" },
563 { "defaultFrcPosition", ArgInt, (void *) &appData.defaultFrcPosition, TRUE, (ArgIniType) -1 },
564 { "shuffleOpenings", ArgTrue, (void *) &shuffleOpenings, FALSE, INVALID },
565 { "fischerCastling", ArgTrue, (void *) &appData.fischerCastling, FALSE, INVALID },
566 { "gameListTags", ArgString, (void *) &appData.gameListTags, TRUE, (ArgIniType) GLT_DEFAULT_TAGS },
567 { "saveOutOfBookInfo", ArgBoolean, (void *) &appData.saveOutOfBookInfo, TRUE, (ArgIniType) TRUE },
568 { "showEvalInMoveHistory", ArgBoolean, (void *) &appData.showEvalInMoveHistory, TRUE, (ArgIniType) TRUE },
569 { "evalHistColorWhite", ArgColor, (void *) 12, TRUE, (ArgIniType) "#FFFFB0" },
570 { "evalHistColorBlack", ArgColor, (void *) 13, TRUE, (ArgIniType) "#AD5D3D" },
571 { "highlightMoveWithArrow", ArgBoolean, (void *) &appData.highlightMoveWithArrow, TRUE, (ArgIniType) FALSE },
572 { "highlightArrowColor", ArgColor, (void *) 14, TRUE, (ArgIniType) "#FFFF80" },
573 { "stickyWindows", ArgBoolean, (void *) &appData.useStickyWindows, TRUE, (ArgIniType) TRUE },
574 { "adjudicateDrawMoves", ArgInt, (void *) &appData.adjudicateDrawMoves, TRUE, (ArgIniType) 0 },
575 { "autoDisplayComment", ArgBoolean, (void *) &appData.autoDisplayComment, TRUE, (ArgIniType) TRUE },
576 { "autoDisplayTags", ArgBoolean, (void *) &appData.autoDisplayTags, TRUE, (ArgIniType) TRUE },
577 { "firstIsUCI", ArgBoolean, (void *) &appData.firstIsUCI, FALSE, (ArgIniType) FALSE },
578 { "fUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
579 { "firstUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
580 { "secondIsUCI", ArgBoolean, (void *) &appData.secondIsUCI, FALSE, (ArgIniType) FALSE },
581 { "secondUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
582 { "sUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
583 { "fUCCI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
584 { "sUCCI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
585 { "fUSI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
586 { "sUSI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
587 { "firstHasOwnBookUCI", ArgBoolean, (void *) &appData.firstHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
588 { "fNoOwnBookUCI", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
589 { "firstXBook", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
590 { "secondHasOwnBookUCI", ArgBoolean, (void *) &appData.secondHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
591 { "sNoOwnBookUCI", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
592 { "secondXBook", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
593 { "adapterCommand", ArgFilename, (void *) &appData.adapterCommand, TRUE, (ArgIniType) "polyglot -noini -ec \"%fcp\" -ed \"%fd\"" },
594 { "uxiAdapter", ArgFilename, (void *) &appData.ucciAdapter, TRUE, (ArgIniType) "" },
595 { "polyglotDir", ArgFilename, (void *) &appData.polyglotDir, TRUE, (ArgIniType) "" },
596 { "usePolyglotBook", ArgBoolean, (void *) &appData.usePolyglotBook, TRUE, (ArgIniType) FALSE },
597 { "polyglotBook", ArgFilename, (void *) &appData.polyglotBook, TRUE, (ArgIniType) "" },
598 { "bookDepth", ArgInt, (void *) &appData.bookDepth, TRUE, (ArgIniType) 12 },
599 { "bookVariation", ArgInt, (void *) &appData.bookStrength, TRUE, (ArgIniType) 50 },
600 { "discourageOwnBooks", ArgBoolean, (void *) &appData.defNoBook, TRUE, (ArgIniType) FALSE },
601 { "mcBookMode", ArgTrue, (void *) &mcMode, FALSE, (ArgIniType) FALSE },
602 { "defaultHashSize", ArgInt, (void *) &appData.defaultHashSize, TRUE, (ArgIniType) 64 },
603 { "defaultCacheSizeEGTB", ArgInt, (void *) &appData.defaultCacheSizeEGTB, TRUE, (ArgIniType) 4 },
604 { "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" },
605 { "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
606 { "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
607 { "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
608 { "upf", ArgBoolean, (void *) &appData.useFont, FALSE, INVALID },
609 { "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
610 { "ubt", ArgBoolean, (void *) &appData.useBitmaps, FALSE, INVALID },
611 { "useBorder", ArgBoolean, (void *) &appData.useBorder, TRUE, (ArgIniType) FALSE },
612 { "ub", ArgBoolean, (void *) &appData.useBorder, FALSE, INVALID },
613 { "border", ArgFilename, (void *) &appData.border, TRUE, (ArgIniType) "" },
614 { "finger", ArgFilename, (void *) &appData.finger, FALSE, (ArgIniType) "" },
615 { "epd", ArgTrue, (void *) &appData.epd, FALSE, INVALID },
616 { "inscriptions", ArgString, (void *) &appData.inscriptions, FALSE, (ArgIniType) "" },
617 { "autoInstall", ArgString, (void *) &appData.autoInstall, XBOARD, (ArgIniType) "" },
618 { "fixedSize", ArgBoolean, (void *) &appData.fixedSize, TRUE, (ArgIniType) FALSE },
620 // [HGM] tournament options
621 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
622 { "tf", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
623 { "participants", ArgString, (void *) &appData.participants, FALSE, (ArgIniType) "" },
624 { "tourneyType", ArgInt, (void *) &appData.tourneyType, FALSE, (ArgIniType) 0 },
625 { "tt", ArgInt, (void *) &appData.tourneyType, FALSE, INVALID },
626 { "tourneyCycles", ArgInt, (void *) &appData.tourneyCycles, FALSE, (ArgIniType) 1 },
627 { "cy", ArgInt, (void *) &appData.tourneyCycles, FALSE, INVALID },
628 { "results", ArgString, (void *) &appData.results, FALSE, (ArgIniType) "" },
629 { "syncAfterRound", ArgBoolean, (void *) &appData.roundSync, FALSE, (ArgIniType) FALSE },
630 { "syncAfterCycle", ArgBoolean, (void *) &appData.cycleSync, FALSE, (ArgIniType) TRUE },
631 { "seedBase", ArgInt, (void *) &appData.seedBase, FALSE, (ArgIniType) 1 },
632 { "pgnNumberTag", ArgBoolean, (void *) &appData.numberTag, TRUE, (ArgIniType) FALSE },
633 { "afterGame", ArgString, (void *) &appData.afterGame, FALSE, INVALID },
634 { "afterTourney", ArgString, (void *) &appData.afterTourney, FALSE, INVALID },
636 /* [HGM] board-size, adjudication and misc. options */
637 { "oneClickMove", ArgBoolean, (void *) &appData.oneClick, TRUE, (ArgIniType) FALSE },
638 { "boardWidth", ArgInt, (void *) &appData.NrFiles, FALSE, (ArgIniType) -1 },
639 { "boardHeight", ArgInt, (void *) &appData.NrRanks, FALSE, (ArgIniType) -1 },
640 { "rankOffset", ArgInt, (void *) &appData.rankOffset, FALSE, (ArgIniType) 0 },
641 { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, FALSE, (ArgIniType) -1 },
642 { "defaultMatchGames", ArgInt, (void *) &appData.defaultMatchGames, TRUE, (ArgIniType) 10 },
643 { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 },
644 { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID },
645 { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID },
646 { "colorNickNames", ArgString, (void *) &appData.colorNickNames, FALSE, INVALID },
647 { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, FALSE, (ArgIniType) FALSE },
648 { "allWhite", ArgBoolean, (void *) &appData.allWhite, FALSE, (ArgIniType) FALSE },
649 { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE },
650 { "firstAlphaRank", ArgBoolean, (void *) &first.alphaRank, FALSE, (ArgIniType) FALSE },
651 { "secondAlphaRank", ArgBoolean, (void *) &second.alphaRank, FALSE, (ArgIniType) FALSE },
652 { "testClaims", ArgBoolean, (void *) &appData.testClaims, TRUE, (ArgIniType) FALSE },
653 { "checkMates", ArgBoolean, (void *) &appData.checkMates, TRUE, (ArgIniType) FALSE },
654 { "materialDraws", ArgBoolean, (void *) &appData.materialDraws, TRUE, (ArgIniType) FALSE },
655 { "trivialDraws", ArgBoolean, (void *) &appData.trivialDraws, TRUE, (ArgIniType) FALSE },
656 { "ruleMoves", ArgInt, (void *) &appData.ruleMoves, TRUE, (ArgIniType) 51 },
657 { "repeatsToDraw", ArgInt, (void *) &appData.drawRepeats, TRUE, (ArgIniType) 6 },
658 { "backgroundObserve", ArgBoolean, (void *) &appData.bgObserve, TRUE, (ArgIniType) FALSE },
659 { "dualBoard", ArgBoolean, (void *) &appData.dualBoard, TRUE, (ArgIniType) FALSE },
660 { "autoKibitz", ArgTrue, (void *) &appData.autoKibitz, FALSE, INVALID },
661 { "engineDebugOutput", ArgInt, (void *) &appData.engineComments, FALSE, (ArgIniType) 1 },
662 { "userName", ArgString, (void *) &appData.userName, FALSE, INVALID },
663 { "rewindIndex", ArgInt, (void *) &appData.rewindIndex, FALSE, INVALID },
664 { "sameColorGames", ArgInt, (void *) &appData.sameColorGames, FALSE, INVALID },
665 { "smpCores", ArgInt, (void *) &appData.smpCores, TRUE, (ArgIniType) 1 },
666 { "egtFormats", ArgString, (void *) &appData.egtFormats, TRUE, (ArgIniType) "" },
667 { "niceEngines", ArgInt, (void *) &appData.niceEngines, TRUE, INVALID },
668 { "logoSize", ArgInt, (void *) &appData.logoSize, XBOARD, INVALID },
669 { "logoDir", ArgFilename, (void *) &appData.logoDir, XBOARD, (ArgIniType) "." },
670 { "firstLogo", ArgFilename, (void *) &appData.firstLogo, FALSE, (ArgIniType) "" },
671 { "secondLogo", ArgFilename, (void *) &appData.secondLogo, FALSE, (ArgIniType) "" },
672 { "autoLogo", ArgBoolean, (void *) &appData.autoLogo, TRUE, INVALID },
673 { "firstOptions", ArgString, (void *) &appData.firstOptions, FALSE, (ArgIniType) "" },
674 { "secondOptions", ArgString, (void *) &appData.secondOptions, FALSE, (ArgIniType) "" },
675 { "firstFeatures", ArgString, (void *) &appData.features[0], FALSE, (ArgIniType) "" },
676 { "secondFeatures", ArgString, (void *) &appData.features[1], FALSE, (ArgIniType) "" },
677 { "featureDefaults", ArgString, (void *) &appData.featureDefaults, TRUE, (ArgIniType) "" },
678 { "firstNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride1, FALSE, (ArgIniType) NULL },
679 { "secondNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride2, FALSE, (ArgIniType) NULL },
680 { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID },
681 { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID },
682 { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID },
683 { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, (ArgIniType) FALSE },
684 { "firstPgnName", ArgString, (void *) &appData.pgnName[0], FALSE, (ArgIniType) "" },
685 { "fn", ArgString, (void *) &appData.pgnName[0], FALSE, INVALID },
686 { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" },
687 { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID },
688 { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE },
689 { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE },
690 { "evalZoom", ArgInt, (void *) &appData.zoom, TRUE, (ArgIniType) 1 },
691 { "evalThreshold", ArgInt, (void *) &appData.evalThreshold, TRUE, (ArgIniType) 25 },
692 { "firstPseudo", ArgTrue, (void *) &appData.pseudo[0], FALSE, FALSE },
693 { "secondPseudo", ArgTrue, (void *) &appData.pseudo[1], FALSE, FALSE },
694 { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE },
695 { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE },
696 { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" },
697 { "defaultTourneyName", ArgFilename, (void *) &appData.defName, TRUE, "" },
698 { "eloThresholdAny", ArgInt, (void *) &appData.eloThreshold1, FALSE, (ArgIniType) 0 },
699 { "eloThresholdBoth", ArgInt, (void *) &appData.eloThreshold2, FALSE, (ArgIniType) 0 },
700 { "dateThreshold", ArgInt, (void *) &appData.dateThreshold, FALSE, (ArgIniType) 0 },
701 { "searchMode", ArgInt, (void *) &appData.searchMode, FALSE, (ArgIniType) 1 },
702 { "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 },
703 { "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE },
704 { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE },
705 { "viewer", ArgTrue, (void *) &appData.viewer, FALSE, FALSE },
706 { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" },
707 { "tourneyOptions", ArgString, (void *) &appData.tourneyOptions, TRUE, (ArgIniType) "-ncp -mm -saveSettingsOnExit false" },
708 { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE },
709 { "topLevel", ArgBoolean, (void *) &appData.topLevel, XBOARD, (ArgIniType) TOPLEVEL },
710 { "dialogColor", ArgString, (void *) &appData.dialogColor, XBOARD, (ArgIniType) "" },
711 { "buttonColor", ArgString, (void *) &appData.buttonColor, XBOARD, (ArgIniType) "" },
712 { "firstDrawDepth", ArgInt, (void *) &appData.drawDepth[0], FALSE, (ArgIniType) 0 },
713 { "secondDrawDepth", ArgInt, (void *) &appData.drawDepth[1], FALSE, (ArgIniType) 0 },
714 { "memoHeaders", ArgBoolean, (void *) &appData.headers, TRUE, (ArgIniType) FALSE },
715 { "startupMessage", ArgString, (void *) &appData.message, FALSE, (ArgIniType) "" },
716 { "messageSuppress", ArgString, (void *) &appData.suppress, XBOARD, (ArgIniType) "" },
717 { "fen", ArgString, (void *) &appData.fen, FALSE, (ArgIniType) "" },
718 { "men", ArgString, (void *) &appData.men, FALSE, (ArgIniType) "" },
719 { "analysisBell", ArgInt, (void *) &appData.analysisBell, TRUE, (ArgIniType) 0 },
722 { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
723 { "zt", ArgTrue, (void *) &appData.zippyTalk, FALSE, INVALID },
724 { "xzt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
725 { "-zt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
726 { "zippyPlay", ArgBoolean, (void *) &appData.zippyPlay, FALSE, (ArgIniType) ZIPPY_PLAY },
727 { "zp", ArgTrue, (void *) &appData.zippyPlay, FALSE, INVALID },
728 { "xzp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
729 { "-zp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
730 { "zippyLines", ArgFilename, (void *) &appData.zippyLines, FALSE, (ArgIniType) ZIPPY_LINES },
731 { "zippyPinhead", ArgString, (void *) &appData.zippyPinhead, FALSE, (ArgIniType) ZIPPY_PINHEAD },
732 { "zippyPassword", ArgString, (void *) &appData.zippyPassword, FALSE, (ArgIniType) ZIPPY_PASSWORD },
733 { "zippyPassword2", ArgString, (void *) &appData.zippyPassword2, FALSE, (ArgIniType) ZIPPY_PASSWORD2 },
734 { "zippyWrongPassword", ArgString, (void *) &appData.zippyWrongPassword,
735 FALSE, (ArgIniType) ZIPPY_WRONG_PASSWORD },
736 { "zippyAcceptOnly", ArgString, (void *) &appData.zippyAcceptOnly, FALSE, (ArgIniType) ZIPPY_ACCEPT_ONLY },
737 { "zippyUseI", ArgBoolean, (void *) &appData.zippyUseI, FALSE, (ArgIniType) ZIPPY_USE_I },
738 { "zui", ArgTrue, (void *) &appData.zippyUseI, FALSE, INVALID },
739 { "xzui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
740 { "-zui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
741 { "zippyBughouse", ArgInt, (void *) &appData.zippyBughouse, FALSE, (ArgIniType) ZIPPY_BUGHOUSE },
742 { "zippyNoplayCrafty", ArgBoolean, (void *) &appData.zippyNoplayCrafty,
743 FALSE, (ArgIniType) ZIPPY_NOPLAY_CRAFTY },
744 { "znc", ArgTrue, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
745 { "xznc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
746 { "-znc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
747 { "zippyGameEnd", ArgString, (void *) &appData.zippyGameEnd, FALSE, (ArgIniType) ZIPPY_GAME_END },
748 { "zippyGameStart", ArgString, (void *) &appData.zippyGameStart, FALSE, (ArgIniType) ZIPPY_GAME_START },
749 { "zippyAdjourn", ArgBoolean, (void *) &appData.zippyAdjourn, FALSE, (ArgIniType) ZIPPY_ADJOURN },
750 { "zadj", ArgTrue, (void *) &appData.zippyAdjourn, FALSE, INVALID },
751 { "xzadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
752 { "-zadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
753 { "zippyAbort", ArgBoolean, (void *) &appData.zippyAbort, FALSE, (ArgIniType) ZIPPY_ABORT },
754 { "zab", ArgTrue, (void *) &appData.zippyAbort, FALSE, INVALID },
755 { "xzab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
756 { "-zab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
757 { "zippyVariants", ArgString, (void *) &appData.zippyVariants, FALSE, (ArgIniType) ZIPPY_VARIANTS },
758 { "zippyMaxGames", ArgInt, (void *)&appData.zippyMaxGames, FALSE, (ArgIniType) ZIPPY_MAX_GAMES},
759 { "zippyReplayTimeout", ArgInt, (void *)&appData.zippyReplayTimeout, FALSE, (ArgIniType) ZIPPY_REPLAY_TIMEOUT },
760 { "zippyShortGame", ArgInt, (void *)&appData.zippyShortGame, FALSE, INVALID },
761 /* Kludge to allow winboard.ini files from buggy 4.0.4 to be read: */
762 { "zippyReplyTimeout", ArgInt, (void *)&junk, FALSE, INVALID },
764 /* [HGM] options for broadcasting and time odds */
765 { "chatBoxes", ArgString, (void *) &appData.chatBoxes, !XBOARD, (ArgIniType) NULL },
766 { "serverMoves", ArgString, (void *) &appData.serverMovesName, FALSE, (ArgIniType) NULL },
767 { "serverFile", ArgString, (void *) &appData.serverFileName, FALSE, (ArgIniType) NULL },
768 { "suppressLoadMoves", ArgBoolean, (void *) &appData.suppressLoadMoves, FALSE, (ArgIniType) FALSE },
769 { "serverPause", ArgInt, (void *) &appData.serverPause, FALSE, (ArgIniType) 15 },
770 { "firstTimeOdds", ArgInt, (void *) &appData.firstTimeOdds, FALSE, (ArgIniType) 1 },
771 { "secondTimeOdds", ArgInt, (void *) &appData.secondTimeOdds, FALSE, (ArgIniType) 1 },
772 { "timeOddsMode", ArgInt, (void *) &appData.timeOddsMode, TRUE, INVALID },
773 { "firstAccumulateTC", ArgInt, (void *) &appData.firstAccumulateTC, FALSE, (ArgIniType) 1 },
774 { "secondAccumulateTC", ArgInt, (void *) &appData.secondAccumulateTC, FALSE, (ArgIniType) 1 },
775 { "firstNPS", ArgInt, (void *) &appData.firstNPS, FALSE, (ArgIniType) -1 },
776 { "secondNPS", ArgInt, (void *) &appData.secondNPS, FALSE, (ArgIniType) -1 },
777 { "noGUI", ArgTrue, (void *) &appData.noGUI, FALSE, INVALID },
778 { "keepLineBreaksICS", ArgBoolean, (void *) &appData.noJoin, TRUE, INVALID },
779 { "wrapContinuationSequence", ArgString, (void *) &appData.wrapContSeq, FALSE, INVALID },
780 { "useInternalWrap", ArgTrue, (void *) &appData.useInternalWrap, FALSE, INVALID }, /* noJoin usurps this if set */
781 { "openCommand", ArgString, (void *) &appData.sysOpen, FALSE, "xdg-open" },
783 // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others
784 { "minX", ArgZ, (void *) &minX, FALSE, INVALID }, // [HGM] placement: to make sure auxiliary windows can be placed
785 { "minY", ArgZ, (void *) &minY, FALSE, INVALID },
786 { "winWidth", ArgInt, (void *) &wpMain.width, TRUE, INVALID }, // [HGM] placement: dummies to remember right & bottom
787 { "winHeight", ArgInt, (void *) &wpMain.height, TRUE, INVALID }, // for attaching auxiliary windows to them
788 { "x", ArgInt, (void *) &wpMain.x, TRUE, (ArgIniType) CW_USEDEFAULT },
789 { "y", ArgInt, (void *) &wpMain.y, TRUE, (ArgIniType) CW_USEDEFAULT },
790 { "icsUp", ArgBoolean, (void *) &wpConsole.visible, XBOARD, (ArgIniType) FALSE },
791 { "icsX", ArgX, (void *) &wpConsole.x, TRUE, (ArgIniType) CW_USEDEFAULT },
792 { "icsY", ArgY, (void *) &wpConsole.y, TRUE, (ArgIniType) CW_USEDEFAULT },
793 { "icsW", ArgInt, (void *) &wpConsole.width, TRUE, (ArgIniType) CW_USEDEFAULT },
794 { "icsH", ArgInt, (void *) &wpConsole.height, TRUE, (ArgIniType) CW_USEDEFAULT },
795 { "commentX", ArgX, (void *) &wpComment.x, TRUE, (ArgIniType) CW_USEDEFAULT },
796 { "commentY", ArgY, (void *) &wpComment.y, TRUE, (ArgIniType) CW_USEDEFAULT },
797 { "commentW", ArgInt, (void *) &wpComment.width, TRUE, (ArgIniType) CW_USEDEFAULT },
798 { "commentH", ArgInt, (void *) &wpComment.height, TRUE, (ArgIniType) CW_USEDEFAULT },
799 { "tagsX", ArgX, (void *) &wpTags.x, TRUE, (ArgIniType) CW_USEDEFAULT },
800 { "tagsY", ArgY, (void *) &wpTags.y, TRUE, (ArgIniType) CW_USEDEFAULT },
801 { "tagsW", ArgInt, (void *) &wpTags.width, TRUE, (ArgIniType) CW_USEDEFAULT },
802 { "tagsH", ArgInt, (void *) &wpTags.height, TRUE, (ArgIniType) CW_USEDEFAULT },
803 { "gameListX", ArgX, (void *) &wpGameList.x, TRUE, (ArgIniType) CW_USEDEFAULT },
804 { "gameListY", ArgY, (void *) &wpGameList.y, TRUE, (ArgIniType) CW_USEDEFAULT },
805 { "gameListW", ArgInt, (void *) &wpGameList.width, TRUE, (ArgIniType) CW_USEDEFAULT },
806 { "gameListH", ArgInt, (void *) &wpGameList.height, TRUE, (ArgIniType) CW_USEDEFAULT },
808 { "slaveX", ArgX, (void *) &wpDualBoard.x, TRUE, (ArgIniType) CW_USEDEFAULT },
809 { "slaveY", ArgY, (void *) &wpDualBoard.y, TRUE, (ArgIniType) CW_USEDEFAULT },
810 { "slaveW", ArgInt, (void *) &wpDualBoard.width, FALSE, (ArgIniType) CW_USEDEFAULT },
811 { "slaveH", ArgInt, (void *) &wpDualBoard.height, FALSE, (ArgIniType) CW_USEDEFAULT },
813 /* [AS] Layout stuff */
814 { "moveHistoryUp", ArgBoolean, (void *) &wpMoveHistory.visible, TRUE, (ArgIniType) TRUE },
815 { "moveHistoryX", ArgX, (void *) &wpMoveHistory.x, TRUE, (ArgIniType) CW_USEDEFAULT },
816 { "moveHistoryY", ArgY, (void *) &wpMoveHistory.y, TRUE, (ArgIniType) CW_USEDEFAULT },
817 { "moveHistoryW", ArgInt, (void *) &wpMoveHistory.width, TRUE, (ArgIniType) CW_USEDEFAULT },
818 { "moveHistoryH", ArgInt, (void *) &wpMoveHistory.height, TRUE, (ArgIniType) CW_USEDEFAULT },
820 { "evalGraphUp", ArgBoolean, (void *) &wpEvalGraph.visible, TRUE, (ArgIniType) TRUE },
821 { "evalGraphX", ArgX, (void *) &wpEvalGraph.x, TRUE, (ArgIniType) CW_USEDEFAULT },
822 { "evalGraphY", ArgY, (void *) &wpEvalGraph.y, TRUE, (ArgIniType) CW_USEDEFAULT },
823 { "evalGraphW", ArgInt, (void *) &wpEvalGraph.width, TRUE, (ArgIniType) CW_USEDEFAULT },
824 { "evalGraphH", ArgInt, (void *) &wpEvalGraph.height, TRUE, (ArgIniType) CW_USEDEFAULT },
826 { "engineOutputUp", ArgBoolean, (void *) &wpEngineOutput.visible, TRUE, (ArgIniType) TRUE },
827 { "engineOutputX", ArgX, (void *) &wpEngineOutput.x, TRUE, (ArgIniType) CW_USEDEFAULT },
828 { "engineOutputY", ArgY, (void *) &wpEngineOutput.y, TRUE, (ArgIniType) CW_USEDEFAULT },
829 { "engineOutputW", ArgInt, (void *) &wpEngineOutput.width, TRUE, (ArgIniType) CW_USEDEFAULT },
830 { "engineOutputH", ArgInt, (void *) &wpEngineOutput.height, TRUE, (ArgIniType) CW_USEDEFAULT },
832 { NULL, ArgNone, NULL, FALSE, INVALID }
836 /* Kludge for indirection files on command line */
837 char* lastIndirectionFilename;
838 ArgDescriptor argDescriptorIndirection =
839 { "", ArgSettingsFilename, (void *) NULL, FALSE };
842 ExitArgError(char *msg, char *badArg, Boolean quit)
847 len = snprintf(buf, MSG_SIZ, msg, badArg);
848 if( (len >= MSG_SIZ) && appData.debugMode )
849 fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
851 if(!quit) { printf(_("%s in settings file\n"), buf); return; } // DisplayError does not work yet at this stage...
852 DisplayFatalError(buf, 0, 2);
857 AppendToSettingsFile (char *line)
862 if(f = fopen(SETTINGS_FILE, "r")) {
865 while((buf[i] = c = fgetc(f)) != '\n' && c != EOF) if(i < MSG_SIZ-1) i++;
867 if(!strcmp(line, buf)) return; // line occurs
869 // line did not occur; add it
871 if(f = fopen(SETTINGS_FILE, "a")) {
874 fprintf(f, "-date %10lu\n%s\n", now.sec, line);
884 if(*p == '-' || *p == '+') p++;
885 while(*p) if(!isdigit(*p++)) ExitArgError(_("Bad integer value %s"), s, TRUE);
890 StringGet(void *getClosure)
892 char **p = (char **) getClosure;
897 FileGet(void *getClosure)
900 FILE* f = (FILE*) getClosure;
903 if (c == '\r') c = getc(f); // work around DOS format files by bypassing the '\r' completely
910 /* Parse settings file named "name". If file found, return the
911 full name in fullname and return TRUE; else return FALSE */
913 ParseSettingsFile(char *name, char **addr)
917 char buf[MSG_SIZ], fullname[MSG_SIZ];
920 ok = MySearchPath(installDir, name, fullname);
921 if(!ok && strchr(name, '.') == NULL)
922 { // append default file-name extension '.ini' when needed
923 len = snprintf(buf,MSG_SIZ, "%s.ini", name);
924 if( (len >= MSG_SIZ) && appData.debugMode )
925 fprintf(debugFP, "ParseSettingsFile: buffer truncated. Input: name=%s \n",name);
927 ok = MySearchPath(installDir, buf, fullname);
930 f = fopen(fullname, "r");
932 if(f == NULL && *fullname != '/' && !addr) { // when a relative name did not work
934 snprintf(buf, MSG_SIZ, "~/.xboard/themes/conf/%s", name);
935 MySearchPath(installDir, buf, fullname); // first look in user's own files
936 f = fopen(fullname, "r");
938 snprintf(buf, MSG_SIZ, "%s/themes/conf", dataDir);
939 MySearchPath(buf, name, fullname); // also look in standard place
940 f = fopen(fullname, "r");
946 ASSIGN(*addr, fullname);
948 ParseArgs(FileGet, f);
957 ParseArgs(GetFunc get, void *cl)
959 char argName[MAX_ARG_LEN];
960 char argValue[MAX_ARG_LEN];
966 int posarg = 4; // default is game file
971 while (ch == ' ' || ch == '\n' || ch == '\t') ch = get(cl);
972 if (ch == NULLCHAR) break;
974 /* Comment to end of line */
976 while (ch != '\n' && ch != NULLCHAR) ch = get(cl);
978 } else if (ch == SLASH || ch == '-') {
981 while (ch != ' ' && ch != '=' && ch != ':' && ch != NULLCHAR &&
982 ch != '\n' && ch != '\t') {
987 for (ad = argDescriptors; ad->argName != NULL; ad++)
988 if (strcmp(ad->argName, argName + 1) == 0) break;
989 if (ad->argName == NULL) {
990 char endChar = (ch && ch != '\n' && (ch = get(cl)) == '{' ? '}' : '\n');
991 ExitArgError(_("Unrecognized argument %s"), argName, get != &FileGet); // [HGM] make unknown argument non-fatal
992 while (ch != endChar && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on (or until closing '}' )
993 if(ch == '}') ch = get(cl);
994 continue; // so that when it is in a settings file, it is the only setting that will be purged from it
996 } else if (ch == '@') {
997 /* Indirection file */
998 ad = &argDescriptorIndirection;
1001 /* Positional argument */
1002 ad = &argDescriptors[posarg++];
1004 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
1007 if (ad->argType == ArgTwo) { // [HGM] kludgey arg type, not suitable for saving
1008 *(Boolean *) ad->argLoc = 2;
1011 if (ad->argType == ArgTrue) {
1012 *(Boolean *) ad->argLoc = TRUE;
1015 if (ad->argType == ArgFalse) {
1016 *(Boolean *) ad->argLoc = FALSE;
1020 while (ch == ' ' || ch == '=' || ch == ':' || ch == '\t') ch = get(cl);
1021 if (ch == NULLCHAR || ch == '\n') {
1022 ExitArgError(_("No value provided for argument %s"), argName, TRUE);
1026 // Quoting with { }. No characters have to (or can) be escaped.
1027 // Thus the string cannot contain a '}' character.
1047 } else if (ch == '\'' || ch == '"') {
1048 // Quoting with ' ' or " ", with \ as escape character.
1049 // Inconvenient for long strings that may contain Windows filenames.
1075 if (ad->argType == ArgFilename
1076 || ad->argType == ArgSettingsFilename) {
1082 ExitArgError(_("Incomplete \\ escape in value for %s"), argName, TRUE);
1106 for (i = 0; i < 3; i++) {
1107 if (ch >= '0' && ch <= '7') {
1108 octval = octval*8 + (ch - '0');
1115 *q++ = (char) octval;
1126 while ((ch != ' ' || posflag) && ch != NULLCHAR && ch != '\t' && ch != '\n') { // space allowed in positional arg
1133 if(posflag) { // positional argument: the argName was implied, and per default set as -lgf
1134 int len = strlen(argValue) - 4; // start of filename extension
1135 if(len < 0) len = 0;
1136 if(!StrCaseCmp(argValue + len, ".trn")) {
1137 ad = &argDescriptors[2]; // correct implied type to -tf
1138 appData.tourney = TRUE; // let it parse -tourneyOptions later
1139 } else if(!StrCaseCmp(argValue + len, ".fen") || !StrCaseCmp(argValue + len, ".epd")) {
1140 ad = &argDescriptors[1]; // correct implied type to -lpf
1141 appData.viewer = TRUE;
1142 } else if(!StrCaseCmp(argValue + len, ".ini") || !StrCaseCmp(argValue + len, ".xop")) {
1143 ad = &argDescriptors[0]; // correct implied type to -opt
1144 } else if(GetEngineLine(argValue, 11)) {
1145 ad = &argDescriptors[3]; // correct implied type to -is
1146 } else { // keep default -lgf, but let it imply viewer mode as well
1147 appData.viewer = TRUE;
1149 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
1152 switch (ad->argType) {
1154 *(int *) ad->argLoc = ValidateInt(argValue);
1158 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute
1162 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...)
1166 *(int *) ad->argLoc = ValidateInt(argValue);
1167 EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY);
1171 *(float *) ad->argLoc = (float) atof(argValue);
1176 if(argValue[0] == '~' && argValue[1] == '~') {
1177 char buf[4*MSG_SIZ]; // expand ~~
1178 snprintf(buf, 4*MSG_SIZ, "%s%s", dataDir, argValue+2);
1179 ASSIGN(*(char **) ad->argLoc, buf);
1182 ASSIGN(*(char **) ad->argLoc, argValue);
1185 case ArgBackupSettingsFile: // no-op if non-default settings-file already successfully read
1186 if(strcmp(*(char**)ad->argLoc, SETTINGS_FILE)) break;
1187 case ArgSettingsFilename:
1189 if (ParseSettingsFile(argValue, (char**)ad->argLoc)) {
1191 if (ad->argLoc != NULL) {
1193 ExitArgError(_("Failed to open indirection file %s"), argValue, TRUE);
1200 switch (argValue[0]) {
1203 *(Boolean *) ad->argLoc = TRUE;
1207 *(Boolean *) ad->argLoc = FALSE;
1210 ExitArgError(_("Unrecognized boolean argument value %s"), argValue, TRUE);
1216 ParseColor((int)(intptr_t)ad->argLoc, argValue);
1220 ColorClass cc = (ColorClass)ad->argLoc;
1221 ParseTextAttribs(cc, argValue); // [HGM] wrapper for platform independency
1226 ParseBoardSize(ad->argLoc, argValue);
1230 ParseFont(argValue, (int)(intptr_t)ad->argLoc);
1233 case ArgCommSettings:
1234 ParseCommPortSettings(argValue);
1238 AppendToSettingsFile(argValue);
1242 q = *(char **) ad->argLoc;
1243 if((saveDate == 0 || saveDate - dateStamp < 0) && !strstr(q, argValue) ) {
1244 int l = strlen(q) + strlen(argValue);
1245 *(char **) ad->argLoc = malloc(l+2);
1246 snprintf(*(char **) ad->argLoc, l+2, "%s%s\n", q, argValue);
1252 ExitArgError(_("Unrecognized argument %s"), argValue, TRUE);
1262 ParseArgsFromString(char *p)
1264 ParseArgs(StringGet, &p);
1268 ParseArgsFromFile(FILE *f)
1270 ParseArgs(FileGet, f);
1274 ParseIcsTextMenu(char *icsTextMenuString)
1277 IcsTextMenuEntry *e = icsTextMenuEntry;
1278 char *p = icsTextMenuString;
1279 while (e->item != NULL && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1282 if (e->command != NULL) {
1288 e = icsTextMenuEntry;
1289 while (*p && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1290 if (*p == ';' || *p == '\n') {
1291 e->item = strdup("-");
1294 } else if (*p == '-') {
1295 e->item = strdup("-");
1300 char *q, *r, *s, *t;
1303 if (q == NULL) break;
1305 r = strchr(q + 1, ',');
1306 if (r == NULL) break;
1308 s = strchr(r + 1, ',');
1309 if (s == NULL) break;
1312 t = strchr(s + 1, c);
1315 t = strchr(s + 1, c);
1317 if (t != NULL) *t = NULLCHAR;
1318 e->item = strdup(p);
1319 e->command = strdup(q + 1);
1320 e->getname = *(r + 1) != '0';
1321 e->immediate = *(s + 1) != '0';
1325 if (t == NULL) break;
1334 SetDefaultTextAttribs()
1337 for (cc = (ColorClass)0; cc < ColorNone; cc++) {
1338 ParseTextAttribs(cc, defaultTextAttribs[cc]);
1343 SetDefaultsFromList()
1344 { // [HGM] ini: take defaults from argDescriptor list
1347 for(i=0; argDescriptors[i].argName != NULL; i++) {
1348 if(argDescriptors[i].defaultValue != INVALID)
1349 switch(argDescriptors[i].argType) {
1354 *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1360 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1364 case ArgSettingsFilename:
1365 if((char *)argDescriptors[i].defaultValue)
1366 *(char **) argDescriptors[i].argLoc = strdup((char *)argDescriptors[i].defaultValue);
1369 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1372 ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue);
1374 case ArgFloat: // floats cannot be casted to int without precision loss
1375 default: ; // some arg types cannot be initialized through table
1381 InitAppData(char *lpCmdLine)
1384 char buf[MAX_ARG_LEN], currDir[MSG_SIZ];
1387 /* Initialize to defaults */
1388 SetDefaultsFromList(); // this sets most defaults
1390 // some parameters for which there are no options!
1391 appData.Iconic = FALSE; /*unused*/
1392 appData.icsEngineAnalyze = FALSE;
1394 // float: casting to int is not harmless, so default cannot be contained in table
1395 appData.timeDelay = TIME_DELAY;
1396 appData.timeIncrement = -314159;
1398 // some complex, platform-dependent stuff that could not be handled from table
1399 SetDefaultTextAttribs();
1401 SetCommPortDefaults();
1403 /* Parse default settings file if any */
1404 ParseSettingsFile(settingsFileName, &settingsFileName);
1406 /* Parse command line */
1407 ParseArgs(StringGet, &lpCmdLine);
1409 if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
1410 if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions);
1411 chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);
1412 appData.icsActive |= GetEngineLine(icsNick, 10);
1414 /* [HGM] make sure board size is acceptable */
1415 if(appData.NrFiles > BOARD_FILES ||
1416 appData.NrRanks > BOARD_RANKS )
1417 DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2);
1419 if(!*appData.secondChessProgram) { // [HGM] scp defaults to fcp
1420 ASSIGN(appData.secondChessProgram, appData.firstChessProgram);
1421 ASSIGN(appData.secondDirectory, appData.firstDirectory);
1422 appData.secondIsUCI = appData.firstIsUCI; // copy type too!
1425 /* [HGM] After parsing the options from the .ini file, and overruling them
1426 * with options from the command line, we now make an even higher priority
1427 * overrule by WB options attached to the engine command line. This so that
1428 * tournament managers can use WB options (such as /timeOdds) that follow
1431 if(appData.firstChessProgram != NULL) {
1432 char *p = StrStr(appData.firstChessProgram, "WBopt");
1433 static char *f = "first";
1434 char buf[MSG_SIZ], *q = buf;
1438 { // engine command line contains WinBoard options
1439 len = snprintf(buf, MSG_SIZ, p+6, f, f, f, f, f, f, f, f, f, f); // replace %s in them by "first"
1440 if( (len >= MSG_SIZ) && appData.debugMode )
1441 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1443 ParseArgs(StringGet, &q);
1444 p[-1] = 0; // cut them offengine command line
1447 // now do same for second chess program
1448 if(appData.secondChessProgram != NULL) {
1449 char *p = StrStr(appData.secondChessProgram, "WBopt");
1450 static char *s = "second";
1451 char buf[MSG_SIZ], *q = buf;
1455 { // engine command line contains WinBoard options
1456 len = snprintf(buf,MSG_SIZ, p+6, s, s, s, s, s, s, s, s, s, s); // replace %s in them by "first"
1457 if( (len >= MSG_SIZ) && appData.debugMode )
1458 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1460 ParseArgs(StringGet, &q);
1461 p[-1] = 0; // cut them offengine command line
1465 /* Propagate options that affect others */
1466 if (appData.matchMode || appData.matchGames) chessProgram = TRUE;
1467 if (appData.icsActive || appData.noChessProgram) {
1468 chessProgram = FALSE; /* not local chess program mode */
1470 if(appData.timeIncrement == -314159) { // new storage mechanism of (mps,inc) in use and no -inc on command line
1471 if(appData.movesPerSession <= 0) { // new encoding of incremental mode
1472 appData.timeIncrement = -appData.movesPerSession/1000.;
1473 } else appData.timeIncrement = -1;
1475 if(appData.movesPerSession <= 0) appData.movesPerSession = MOVES_PER_SESSION; // mps <= 0 is invalid in any case
1476 if(*appData.defaultPathEGTB) { // append value of deprecated -defaultPathEGTB to -egtFormats
1477 snprintf(buf, MAX_ARG_LEN, "%s%snalimov:%s", appData.egtFormats, (*appData.egtFormats ?"," : ""), appData.defaultPathEGTB);
1478 ASSIGN(appData.egtFormats, buf);
1479 ASSIGN(appData.defaultPathEGTB, "");
1482 /* Open startup dialog if needed */
1483 if ((!appData.noChessProgram && !chessProgram && !appData.icsActive) ||
1484 (appData.icsActive && *appData.icsHost == NULLCHAR) ||
1485 (chessProgram && (*appData.firstChessProgram == NULLCHAR ||
1486 *appData.secondChessProgram == NULLCHAR)))
1487 PopUpStartupDialog();
1489 /* Make sure save files land in the right (?) directory */
1490 if (MyGetFullPathName(appData.saveGameFile, buf)) {
1491 appData.saveGameFile = strdup(buf);
1493 if (MyGetFullPathName(appData.savePositionFile, buf)) {
1494 appData.savePositionFile = strdup(buf);
1497 if(autoClose) { // was called for updating settingsfile only
1498 if(saveSettingsOnExit) SaveSettings(settingsFileName);
1502 /* Finish initialization for fonts and sounds */
1505 GetCurrentDirectory(MSG_SIZ, currDir);
1506 SetCurrentDirectory(installDir);
1508 SetCurrentDirectory(currDir);
1510 p = icsTextMenuString;
1512 FILE* f = fopen(p + 1, "r");
1514 DisplayFatalError(p + 1, errno, 2);
1517 i = fread(buf, 1, sizeof(buf)-1, f);
1522 ParseIcsTextMenu(strdup(p));
1526 SaveSettings(char* name)
1530 char dir[MSG_SIZ], buf[MSG_SIZ];
1531 int mps = appData.movesPerSession;
1534 if (!MainWindowUp() && !autoClose) return;
1536 GetTimeMark(&now); saveDate = now.sec;
1538 GetCurrentDirectory(MSG_SIZ, dir);
1539 if(MySearchPath(installDir, name, buf)) {
1540 f = fopen(buf, "w");
1542 SetCurrentDirectory(installDir);
1543 f = fopen(name, "w");
1544 SetCurrentDirectory(dir);
1547 DisplayError(name, errno);
1552 fprintf(f, "; %s Save Settings file\n", PACKAGE_STRING);
1554 fprintf(f, "; You can edit the values of options that are already set in this file,\n");
1555 fprintf(f, "; but if you add other options, the next Save Settings will not save them.\n");
1556 fprintf(f, "; Use a shortcut, an @indirection file, or a .bat file instead.\n");
1561 /* [AS] Move history */
1562 wpMoveHistory.visible = MoveHistoryIsUp();
1564 /* [AS] Eval graph */
1565 wpEvalGraph.visible = EvalGraphIsUp();
1567 /* [AS] Engine output */
1568 wpEngineOutput.visible = EngineOutputIsUp();
1570 // [HGM] in WB we have to copy sound names to appData first
1573 if(appData.timeIncrement >= 0) appData.movesPerSession = -1000*appData.timeIncrement; // kludge to store mps & inc as one
1575 for (ad = argDescriptors; ad->argName != NULL; ad++) {
1576 if (!ad->save) continue;
1577 switch (ad->argType) {
1580 char *p = *(char **)ad->argLoc;
1581 if(p == NULL) break; // just in case
1582 if ((strchr(p, '\\') || strchr(p, '\n')) && !strchr(p, '}')) {
1583 /* Quote multiline values or \-containing values
1584 with { } if possible */
1585 fprintf(f, OPTCHAR "%s" SEPCHAR "{%s}\n", ad->argName, p);
1587 /* Else quote with " " */
1588 fprintf(f, OPTCHAR "%s" SEPCHAR "\"", ad->argName);
1590 if (*p == '\n') fprintf(f, "\n");
1591 else if (*p == '\r') fprintf(f, "\\r");
1592 else if (*p == '\t') fprintf(f, "\\t");
1593 else if (*p == '\b') fprintf(f, "\\b");
1594 else if (*p == '\f') fprintf(f, "\\f");
1595 else if (*p < ' ') fprintf(f, "\\%03o", *p);
1596 else if (*p == '\"') fprintf(f, "\\\"");
1597 else if (*p == '\\') fprintf(f, "\\\\");
1607 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc);
1610 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.x); // [HGM] placement: store relative value
1613 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.y);
1616 fprintf(f, OPTCHAR "%s" SEPCHAR "%g\n", ad->argName, *(float *)ad->argLoc);
1619 fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName,
1620 (*(Boolean *)ad->argLoc) ? "true" : "false");
1623 if (*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1626 if (!*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1632 SaveAttribsArg(f, ad);
1635 if(*(char**)ad->argLoc == NULL) break; // just in case
1636 { char buf[MSG_SIZ];
1637 snprintf(buf, MSG_SIZ, "%s", *(char**)ad->argLoc);
1639 if(strstr(buf, dataDir) == buf)
1640 snprintf(buf, MSG_SIZ, "~~%s", *(char**)ad->argLoc + strlen(dataDir));
1642 if (strchr(buf, '\"')) {
1643 fprintf(f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, buf);
1645 fprintf(f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, buf);
1650 SaveBoardSize(f, ad->argName, ad->argLoc);
1655 case ArgCommSettings:
1656 PrintCommPortSettings(f, ad->argName);
1659 case ArgBackupSettingsFile:
1660 case ArgSettingsFilename: ;
1666 appData.movesPerSession = mps;
1670 GetArgValue(char *name)
1671 { // retrieve (as text) current value of string or int argument given by name
1672 // (this is used for maing the values available in the adapter command)
1676 for (ad = argDescriptors; ad->argName != NULL; ad++)
1677 if (strcmp(ad->argName, name) == 0) break;
1679 if (ad->argName == NULL) return FALSE;
1681 switch(ad->argType) {
1684 strncpy(name, *(char**) ad->argLoc, MSG_SIZ);
1688 len = snprintf(name, MSG_SIZ, "%d", *(int*) ad->argLoc);
1689 if( (len >= MSG_SIZ) && appData.debugMode )
1690 fprintf(debugFP, "GetArgValue: buffer truncated.\n");
1694 len = snprintf(name, MSG_SIZ, "%s", *(Boolean*) ad->argLoc ? "true" : "false");
1695 if( (len >= MSG_SIZ) && appData.debugMode )
1696 fprintf(debugFP, "GetArgValue: buffer truncated.\n");