Make frame width configurable in XB
[xboard.git] / args.h
1 /*
2  * args.c -- Option parsing and saving for X and Windows versions of XBoard
3  *
4  * Copyright 1991 by Digital Equipment Corporation, Maynard,
5  * Massachusetts.
6  *
7  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8  * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
9  *
10  * Enhancements Copyright 2005 Alessandro Scotti
11  *
12  * The following terms apply to Digital Equipment Corporation's copyright
13  * interest in XBoard:
14  * ------------------------------------------------------------------------
15  * All Rights Reserved
16  *
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.
24  *
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
31  * SOFTWARE.
32  * ------------------------------------------------------------------------
33  *
34  * The following terms apply to the enhanced version of XBoard
35  * distributed by the Free Software Foundation:
36  * ------------------------------------------------------------------------
37  *
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.
42  *
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.
47  *
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/.  *
50  *
51  *------------------------------------------------------------------------
52  ** See the file ChangeLog for a revision history.
53 */
54
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.
59
60 typedef enum {
61   ArgString, ArgInt, ArgFloat, ArgBoolean, ArgTrue, ArgFalse, ArgNone,
62   ArgColor, ArgAttribs, ArgFilename, ArgBoardSize, ArgFont, ArgCommSettings,
63   ArgSettingsFilename, ArgTwo,
64   ArgX, ArgY, ArgZ // [HGM] placement: for window-placement options stored relative to main window
65 } ArgType;
66
67 typedef void *ArgIniType;
68
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! */
71
72 typedef struct {
73   char *argName;
74   ArgType argType;
75   /***
76   union {
77     String *pString;       // ArgString
78     int *pInt;             // ArgInt
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
88   } argLoc;
89   ***/
90   void *argLoc;
91   Boolean save;
92   ArgIniType defaultValue;
93 } ArgDescriptor;
94
95 typedef struct {
96   char *item;
97   char *command;
98   Boolean getname;
99   Boolean immediate;
100 } IcsTextMenuEntry;
101
102 IcsTextMenuEntry icsTextMenuEntry[ICS_TEXT_MENU_SIZE];
103
104 int junk;
105 Boolean singleList;
106 char *homeDir;
107 int frameX, frameY; // width of window frame and title bar
108
109 void EnsureOnScreen(int *x, int *y, int minX, int minY);
110 char StringGet(void *getClosure);
111 void ParseFont(char *name, int number);
112 void SetFontDefaults();
113 void CreateFonts();
114 void ParseColor(int n, char *name);
115 void ParseTextAttribs(ColorClass cc, char *s);
116 void ParseBoardSize(void * addr, char *name);
117 void ParseCommPortSettings(char *name);
118 void LoadAllSounds();
119 void SetCommPortDefaults();
120 void SaveFontArg(FILE *f, ArgDescriptor *ad);
121 void ExportSounds();
122 void SaveAttribsArg(FILE *f, ArgDescriptor *ad);
123 void SaveColor(FILE *f, ArgDescriptor *ad);
124 void SaveBoardSize(FILE *f, char *name, void *addr);
125 void PrintCommPortSettings(FILE *f, char *name);
126 void GetWindowCoords();
127 int  MySearchPath(char *installDir, char *name, char *fullname);
128 int  MyGetFullPathName(char *name, char *fullname);
129 int  MainWindowUp();
130 void PopUpStartupDialog();
131 typedef char GetFunc(void *getClosure);
132 void ParseArgs(GetFunc get, void *cl);
133
134 // [HGM] this is an exact duplicate of something in winboard.c. Move to backend.c?
135 char *defaultTextAttribs[] =
136 {
137   COLOR_SHOUT, COLOR_SSHOUT, COLOR_CHANNEL1, COLOR_CHANNEL, COLOR_KIBITZ,
138   COLOR_TELL, COLOR_CHALLENGE, COLOR_REQUEST, COLOR_SEEK, COLOR_NORMAL,
139   "#000000"
140 };
141
142 ArgDescriptor argDescriptors[] = {
143   /* positional arguments */
144   { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
145   { "", ArgNone, NULL, FALSE, INVALID },
146   /* keyword arguments */
147   JAWS_ARGS
148   { "whitePieceColor", ArgColor, (void *) 0, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
149   { "wpc", ArgColor, (void *) 0, FALSE, INVALID },
150   { "blackPieceColor", ArgColor, (void *) 1, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
151   { "bpc", ArgColor, (void *) 1, FALSE, INVALID },
152   { "lightSquareColor", ArgColor, (void *) 2, TRUE, (ArgIniType) LIGHT_SQUARE_COLOR },
153   { "lsc", ArgColor, (void *) 2, FALSE, INVALID },
154   { "darkSquareColor", ArgColor, (void *) 3, TRUE, (ArgIniType) DARK_SQUARE_COLOR },
155   { "dsc", ArgColor, (void *) 3, FALSE, INVALID },
156   { "highlightSquareColor", ArgColor, (void *) 4, TRUE, (ArgIniType) HIGHLIGHT_SQUARE_COLOR },
157   { "hsc", ArgColor, (void *) 4, FALSE, INVALID },
158   { "premoveHighlightColor", ArgColor, (void *) 5, TRUE, (ArgIniType) PREMOVE_HIGHLIGHT_COLOR },
159   { "phc", ArgColor, (void *) 5, FALSE, INVALID },
160   { "movesPerSession", ArgInt, (void *) &appData.movesPerSession, TRUE, (ArgIniType) MOVES_PER_SESSION },
161   { "mps", ArgInt, (void *) &appData.movesPerSession, FALSE, INVALID },
162   { "initString", ArgString, (void *) &appData.firstInitString, FALSE, INVALID },
163   { "firstInitString", ArgString, (void *) &appData.firstInitString, FALSE, (ArgIniType) INIT_STRING },
164   { "secondInitString", ArgString, (void *) &appData.secondInitString, FALSE, (ArgIniType) INIT_STRING },
165   { "firstComputerString", ArgString, (void *) &appData.firstComputerString,
166     FALSE, (ArgIniType) COMPUTER_STRING },
167   { "secondComputerString", ArgString, (void *) &appData.secondComputerString,
168     FALSE, (ArgIniType) COMPUTER_STRING },
169   { "firstChessProgram", ArgFilename, (void *) &appData.firstChessProgram,
170     FALSE, (ArgIniType) FIRST_CHESS_PROGRAM },
171   { "fcp", ArgFilename, (void *) &appData.firstChessProgram, FALSE, INVALID },
172   { "secondChessProgram", ArgFilename, (void *) &appData.secondChessProgram,
173     FALSE, (ArgIniType) SECOND_CHESS_PROGRAM },
174   { "scp", ArgFilename, (void *) &appData.secondChessProgram, FALSE, INVALID },
175   { "firstPlaysBlack", ArgBoolean, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
176   { "fb", ArgTrue, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
177   { "xfb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
178   { "-fb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
179   { "noChessProgram", ArgBoolean, (void *) &appData.noChessProgram, FALSE, FALSE },
180   { "ncp", ArgTrue, (void *) &appData.noChessProgram, FALSE, INVALID },
181   { "xncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
182   { "-ncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
183   { "firstHost", ArgString, (void *) &appData.firstHost, FALSE, (ArgIniType) FIRST_HOST },
184   { "fh", ArgString, (void *) &appData.firstHost, FALSE, INVALID },
185   { "secondHost", ArgString, (void *) &appData.secondHost, FALSE, (ArgIniType) SECOND_HOST },
186   { "sh", ArgString, (void *) &appData.secondHost, FALSE, INVALID },
187   { "firstDirectory", ArgFilename, (void *) &appData.firstDirectory, FALSE, (ArgIniType) FIRST_DIRECTORY },
188   { "fd", ArgFilename, (void *) &appData.firstDirectory, FALSE, INVALID },
189   { "secondDirectory", ArgFilename, (void *) &appData.secondDirectory, FALSE, (ArgIniType) SECOND_DIRECTORY },
190   { "sd", ArgFilename, (void *) &appData.secondDirectory, FALSE, INVALID },
191   { "variations", ArgBoolean, (void *) &appData.variations, TRUE, (ArgIniType) FALSE },
192
193   /* some options only used by the XBoard front end, and ignored in WinBoard         */
194   /* Their saving is controlled by XBOARD, which in WinBoard is defined as FALSE */
195   { "internetChessServerInputBox", ArgBoolean, (void *) &appData.icsInputBox, XBOARD, (ArgIniType) FALSE },
196   { "icsinput", ArgTrue, (void *) &appData.icsInputBox, FALSE, INVALID },
197   { "xicsinput", ArgFalse, (void *) &appData.icsInputBox, FALSE, INVALID },
198   { "cmail", ArgString, (void *) &appData.cmailGameName, FALSE, (ArgIniType) "" },
199   { "soundProgram", ArgFilename, (void *) &appData.soundProgram, XBOARD, (ArgIniType) "play" },
200   { "fontSizeTolerance", ArgInt, (void *) &appData.fontSizeTolerance, XBOARD, (ArgIniType) 4 },
201   { "lowTimeWarningColor", ArgColor, (void *) 6, XBOARD, (ArgIniType) LOWTIMEWARNING_COLOR },
202   { "lowTimeWarning", ArgBoolean, (void *) &appData.lowTimeWarning, XBOARD, (ArgIniType) FALSE },
203   { "titleInWindow", ArgBoolean, (void *) &appData.titleInWindow, XBOARD, (ArgIniType) FALSE },
204   { "title", ArgTrue, (void *) &appData.titleInWindow, FALSE, INVALID },
205   { "xtitle", ArgFalse, (void *) &appData.titleInWindow, FALSE, INVALID },
206   { "flashCount", ArgInt, (void *) &appData.flashCount, XBOARD, INVALID }, // let X handle this
207   { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE },
208   { "pixmapDirectory", ArgFilename, (void *) &appData.pixmapDirectory, XBOARD, (ArgIniType) "" },
209   { "pixmap", ArgFilename, (void *) &appData.pixmapDirectory, FALSE, INVALID },
210   { "bitmapDirectory", ArgFilename, (void *) &appData.bitmapDirectory, XBOARD, (ArgIniType) "" },
211   { "bm", ArgFilename, (void *) &appData.bitmapDirectory, FALSE, INVALID },
212   { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" },
213   { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY },
214   { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE },
215
216   { "dropMenu", ArgBoolean, (void *) &appData.dropMenu, TRUE, (ArgIniType) FALSE },
217   { "pieceMenu", ArgBoolean, (void *) &appData.pieceMenu, TRUE, (ArgIniType) TRUE },
218   { "sweepPromotions", ArgBoolean, (void *) &appData.sweepSelect, TRUE, (ArgIniType) FALSE },
219   { "remoteShell", ArgFilename, (void *) &appData.remoteShell, FALSE, (ArgIniType) REMOTE_SHELL },
220   { "rsh", ArgFilename, (void *) &appData.remoteShell, FALSE, INVALID },
221   { "remoteUser", ArgString, (void *) &appData.remoteUser, FALSE, (ArgIniType) "" },
222   { "ruser", ArgString, (void *) &appData.remoteUser, FALSE, INVALID },
223   { "timeDelay", ArgFloat, (void *) &appData.timeDelay, TRUE, INVALID },
224   { "td", ArgFloat, (void *) &appData.timeDelay, FALSE, INVALID },
225   { "timeControl", ArgString, (void *) &appData.timeControl, TRUE, (ArgIniType) TIME_CONTROL },
226   { "tc", ArgString, (void *) &appData.timeControl, FALSE, INVALID },
227   { "timeIncrement", ArgFloat, (void *) &appData.timeIncrement, TRUE, INVALID },
228   { "inc", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
229   { "internetChessServerMode", ArgBoolean, (void *) &appData.icsActive, FALSE, INVALID },
230   { "ics", ArgTrue, (void *) &appData.icsActive, FALSE, (ArgIniType) FALSE },
231   { "xics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
232   { "-ics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
233   { "internetChessServerHost", ArgString, (void *) &appData.icsHost, FALSE, (ArgIniType) "" },
234   { "icshost", ArgString, (void *) &appData.icsHost, FALSE, INVALID },
235   { "internetChessServerPort", ArgString, (void *) &appData.icsPort, FALSE, (ArgIniType) ICS_PORT },
236   { "icsport", ArgString, (void *) &appData.icsPort, FALSE, INVALID },
237   { "internetChessServerCommPort", ArgString, (void *) &appData.icsCommPort, FALSE, (ArgIniType) ICS_COMM_PORT },
238   { "icscomm", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
239   { "internetChessServerComPort", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
240   { "icscom", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
241   { "internetChessServerLogonScript", ArgFilename, (void *) &appData.icsLogon, FALSE, (ArgIniType) ICS_LOGON },
242   { "icslogon", ArgFilename, (void *) &appData.icsLogon, FALSE, INVALID },
243   { "useTelnet", ArgBoolean, (void *) &appData.useTelnet, FALSE, INVALID },
244   { "telnet", ArgTrue, (void *) &appData.useTelnet, FALSE, INVALID },
245   { "xtelnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
246   { "-telnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
247   { "telnetProgram", ArgFilename, (void *) &appData.telnetProgram, FALSE, (ArgIniType) TELNET_PROGRAM },
248   { "internetChessserverHelper", ArgFilename, (void *) &appData.icsHelper,
249         FALSE, INVALID }, // for XB
250   { "icshelper", ArgFilename, (void *) &appData.icsHelper, FALSE, (ArgIniType) "" },
251   { "seekGraph", ArgBoolean, (void *) &appData.seekGraph, TRUE, (ArgIniType) FALSE },
252   { "sg", ArgTrue, (void *) &appData.seekGraph, FALSE, INVALID },
253   { "autoRefresh", ArgBoolean, (void *) &appData.autoRefresh, TRUE, (ArgIniType) FALSE },
254   { "gateway", ArgString, (void *) &appData.gateway, FALSE, (ArgIniType) "" },
255   { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, (ArgIniType) "" },
256   { "lgf", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
257   { "loadGameIndex", ArgInt, (void *) &appData.loadGameIndex, FALSE, (ArgIniType) 0 },
258   { "lgi", ArgInt, (void *) &appData.loadGameIndex, FALSE, INVALID },
259   { "saveGameFile", ArgFilename, (void *) &appData.saveGameFile, TRUE, (ArgIniType) "" },
260   { "sgf", ArgFilename, (void *) &appData.saveGameFile, FALSE, INVALID },
261   { "autoSaveGames", ArgBoolean, (void *) &appData.autoSaveGames, TRUE, (ArgIniType) FALSE },
262   { "autosave", ArgTrue, (void *) &appData.autoSaveGames, FALSE, INVALID },
263   { "xautosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
264   { "-autosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
265   { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, (ArgIniType) "" },
266   { "lpf", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
267   { "loadPositionIndex", ArgInt, (void *) &appData.loadPositionIndex, FALSE, (ArgIniType) 1 },
268   { "lpi", ArgInt, (void *) &appData.loadPositionIndex, FALSE, INVALID },
269   { "savePositionFile", ArgFilename, (void *) &appData.savePositionFile, FALSE, (ArgIniType) "" },
270   { "spf", ArgFilename, (void *) &appData.savePositionFile, FALSE, INVALID },
271   { "matchMode", ArgBoolean, (void *) &appData.matchMode, FALSE, (ArgIniType) FALSE },
272   { "mm", ArgTrue, (void *) &appData.matchMode, FALSE, INVALID },
273   { "xmm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
274   { "-mm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
275   { "matchGames", ArgInt, (void *) &appData.matchGames, FALSE, (ArgIniType) 0 },
276   { "mg", ArgInt, (void *) &appData.matchGames, FALSE, INVALID },
277   { "monoMode", ArgBoolean, (void *) &appData.monoMode, TRUE, (ArgIniType) FALSE },
278   { "mono", ArgTrue, (void *) &appData.monoMode, FALSE, INVALID },
279   { "xmono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
280   { "-mono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
281   { "debugMode", ArgBoolean, (void *) &appData.debugMode, FALSE, (ArgIniType) FALSE },
282   { "debug", ArgTrue, (void *) &appData.debugMode, FALSE, INVALID },
283   { "xdebug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
284   { "-debug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
285   { "clockMode", ArgBoolean, (void *) &appData.clockMode, FALSE, (ArgIniType) TRUE },
286   { "clock", ArgTrue, (void *) &appData.clockMode, FALSE, INVALID },
287   { "xclock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
288   { "-clock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
289   { "searchTime", ArgString, (void *) &appData.searchTime, FALSE, (ArgIniType) "" },
290   { "st", ArgString, (void *) &appData.searchTime, FALSE, INVALID },
291   { "searchDepth", ArgInt, (void *) &appData.searchDepth, FALSE, (ArgIniType) 0 },
292   { "depth", ArgInt, (void *) &appData.searchDepth, FALSE, INVALID },
293   { "showCoords", ArgBoolean, (void *) &appData.showCoords, TRUE, (ArgIniType) FALSE },
294   { "coords", ArgTrue, (void *) &appData.showCoords, FALSE, INVALID },
295   { "xcoords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
296   { "-coords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
297   { "showThinking", ArgBoolean, (void *) &appData.showThinking, TRUE, (ArgIniType) FALSE },
298   { "thinking", ArgTrue, (void *) &appData.showThinking, FALSE, INVALID },
299   { "xthinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
300   { "-thinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
301   { "ponderNextMove", ArgBoolean, (void *) &appData.ponderNextMove, TRUE, (ArgIniType) TRUE },
302   { "ponder", ArgTrue, (void *) &appData.ponderNextMove, FALSE, INVALID },
303   { "xponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
304   { "-ponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
305   { "periodicUpdates", ArgBoolean, (void *) &appData.periodicUpdates, TRUE, (ArgIniType) TRUE },
306   { "periodic", ArgTrue, (void *) &appData.periodicUpdates, FALSE, INVALID },
307   { "xperiodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
308   { "-periodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
309   { "popupExitMessage", ArgBoolean, (void *) &appData.popupExitMessage, TRUE, (ArgIniType) TRUE },
310   { "exit", ArgTrue, (void *) &appData.popupExitMessage, FALSE, INVALID },
311   { "xexit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
312   { "-exit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
313   { "popupMoveErrors", ArgBoolean, (void *) &appData.popupMoveErrors, TRUE, (ArgIniType) FALSE },
314   { "popup", ArgTrue, (void *) &appData.popupMoveErrors, FALSE, INVALID },
315   { "xpopup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
316   { "-popup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
317   { "popUpErrors", ArgBoolean, (void *) &appData.popupMoveErrors,
318     FALSE, INVALID }, /* only so that old WinBoard.ini files from betas can be read */
319   { "clockFont", ArgFont, (void *) CLOCK_FONT, TRUE, INVALID },
320   { "messageFont", ArgFont, (void *) MESSAGE_FONT, TRUE, INVALID },
321   { "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. */
322   { "coordFont", ArgFont, (void *) COORD_FONT, TRUE, INVALID },
323   { "tagsFont", ArgFont, (void *) EDITTAGS_FONT, TRUE, INVALID },
324   { "commentFont", ArgFont, (void *) COMMENT_FONT, TRUE, INVALID },
325   { "icsFont", ArgFont, (void *) CONSOLE_FONT, TRUE, INVALID },
326   { "moveHistoryFont", ArgFont, (void *) MOVEHISTORY_FONT, TRUE, INVALID }, /* [AS] */
327   { "gameListFont", ArgFont, (void *) GAMELIST_FONT, TRUE, INVALID }, /* [HGM] */
328   { "boardSize", ArgBoardSize, (void *) &boardSize,
329     TRUE, (ArgIniType) -1 }, /* must come after all fonts */
330   { "size", ArgBoardSize, (void *) &boardSize, FALSE, INVALID },
331   { "ringBellAfterMoves", ArgBoolean, (void *) &appData.ringBellAfterMoves,
332     FALSE, (ArgIniType) TRUE }, /* historical; kept only so old winboard.ini files will parse */
333   { "bell", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
334   { "xbell", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
335   { "movesound", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
336   { "xmovesound", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
337   { "alwaysOnTop", ArgBoolean, (void *) &alwaysOnTop, TRUE, INVALID },
338   { "top", ArgTrue, (void *) &alwaysOnTop, FALSE, INVALID },
339   { "xtop", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
340   { "-top", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
341   { "autoCallFlag", ArgBoolean, (void *) &appData.autoCallFlag, TRUE, (ArgIniType) FALSE },
342   { "autoflag", ArgTrue, (void *) &appData.autoCallFlag, FALSE, INVALID },
343   { "xautoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
344   { "-autoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
345   { "autoComment", ArgBoolean, (void *) &appData.autoComment, TRUE, (ArgIniType) FALSE },
346   { "autocomm", ArgTrue, (void *) &appData.autoComment, FALSE, INVALID },
347   { "xautocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
348   { "-autocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
349   { "autoObserve", ArgBoolean, (void *) &appData.autoObserve, TRUE, (ArgIniType) FALSE },
350   { "autobs", ArgTrue, (void *) &appData.autoObserve, FALSE, INVALID },
351   { "xautobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
352   { "-autobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
353   { "flipView", ArgBoolean, (void *) &appData.flipView, FALSE, (ArgIniType) FALSE },
354   { "flip", ArgTrue, (void *) &appData.flipView, FALSE, INVALID },
355   { "xflip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
356   { "-flip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
357   { "autoFlipView", ArgBoolean, (void *) &appData.autoFlipView, TRUE, (ArgIniType) TRUE },
358   { "autoflip", ArgTrue, (void *) &appData.autoFlipView, FALSE, INVALID },
359   { "xautoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
360   { "-autoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
361   { "autoRaiseBoard", ArgBoolean, (void *) &appData.autoRaiseBoard, TRUE, (ArgIniType) TRUE },
362   { "autoraise", ArgTrue, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
363   { "xautoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
364   { "-autoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
365   { "alwaysPromoteToQueen", ArgBoolean, (void *) &appData.alwaysPromoteToQueen, TRUE, (ArgIniType) FALSE },
366   { "queen", ArgTrue, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
367   { "xqueen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
368   { "-queen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
369   { "oldSaveStyle", ArgBoolean, (void *) &appData.oldSaveStyle, TRUE, (ArgIniType) FALSE },
370   { "oldsave", ArgTrue, (void *) &appData.oldSaveStyle, FALSE, INVALID },
371   { "xoldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
372   { "-oldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
373   { "quietPlay", ArgBoolean, (void *) &appData.quietPlay, TRUE, (ArgIniType) FALSE },
374   { "quiet", ArgTrue, (void *) &appData.quietPlay, FALSE, INVALID },
375   { "xquiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
376   { "-quiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
377   { "getMoveList", ArgBoolean, (void *) &appData.getMoveList, TRUE, (ArgIniType) TRUE },
378   { "moves", ArgTrue, (void *) &appData.getMoveList, FALSE, INVALID },
379   { "xmoves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
380   { "-moves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
381   { "testLegality", ArgBoolean, (void *) &appData.testLegality, TRUE, (ArgIniType) TRUE },
382   { "legal", ArgTrue, (void *) &appData.testLegality, FALSE, INVALID },
383   { "xlegal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
384   { "-legal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
385   { "premove", ArgBoolean, (void *) &appData.premove, TRUE, (ArgIniType) TRUE },
386   { "pre", ArgTrue, (void *) &appData.premove, FALSE, INVALID },
387   { "xpre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
388   { "-pre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
389   { "premoveWhite", ArgBoolean, (void *) &appData.premoveWhite, TRUE, (ArgIniType) FALSE },
390   { "prewhite", ArgTrue, (void *) &appData.premoveWhite, FALSE, INVALID },
391   { "xprewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
392   { "-prewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
393   { "premoveWhiteText", ArgString, (void *) &appData.premoveWhiteText, TRUE, (ArgIniType) "" },
394   { "premoveBlack", ArgBoolean, (void *) &appData.premoveBlack, TRUE, (ArgIniType) FALSE },
395   { "preblack", ArgTrue, (void *) &appData.premoveBlack, FALSE, INVALID },
396   { "xpreblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
397   { "-preblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
398   { "premoveBlackText", ArgString, (void *) &appData.premoveBlackText, TRUE, (ArgIniType) "" },
399   { "icsAlarm", ArgBoolean, (void *) &appData.icsAlarm, TRUE, (ArgIniType) TRUE},
400   { "alarm", ArgTrue, (void *) &appData.icsAlarm, FALSE},
401   { "xalarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
402   { "-alarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
403   { "icsAlarmTime", ArgInt, (void *) &appData.icsAlarmTime, TRUE, (ArgIniType) 5000},
404   { "localLineEditing", ArgBoolean, (void *) &appData.localLineEditing, FALSE, (ArgIniType) TRUE},
405   { "edit", ArgTrue, (void *) &appData.localLineEditing, FALSE, INVALID },
406   { "xedit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
407   { "-edit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
408   { "animateMoving", ArgBoolean, (void *) &appData.animate, TRUE, (ArgIniType) TRUE },
409   { "animate", ArgTrue, (void *) &appData.animate, FALSE, INVALID },
410   { "xanimate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
411   { "-animate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
412   { "animateSpeed", ArgInt, (void *) &appData.animSpeed, TRUE, (ArgIniType) 10 },
413   { "animateDragging", ArgBoolean, (void *) &appData.animateDragging, TRUE, (ArgIniType) TRUE },
414   { "drag", ArgTrue, (void *) &appData.animateDragging, FALSE, INVALID },
415   { "xdrag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
416   { "-drag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
417   { "blindfold", ArgBoolean, (void *) &appData.blindfold, TRUE, (ArgIniType) FALSE },
418   { "blind", ArgTrue, (void *) &appData.blindfold, FALSE, INVALID },
419   { "xblind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
420   { "-blind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
421   { "highlightLastMove", ArgBoolean,
422     (void *) &appData.highlightLastMove, TRUE, (ArgIniType) TRUE },
423   { "highlight", ArgTrue, (void *) &appData.highlightLastMove, FALSE, INVALID },
424   { "xhighlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
425   { "-highlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
426   { "highlightDragging", ArgBoolean,
427     (void *) &appData.highlightDragging, !XBOARD, (ArgIniType) TRUE },
428   { "highdrag", ArgTrue, (void *) &appData.highlightDragging, FALSE, INVALID },
429   { "xhighdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
430   { "-highdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
431   { "colorizeMessages", ArgBoolean, (void *) &appData.colorize, TRUE, (ArgIniType) TRUE },
432   { "colorize", ArgTrue, (void *) &appData.colorize, FALSE, INVALID },
433   { "xcolorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
434   { "-colorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
435   { "colorShout", ArgAttribs, (void *) ColorShout, TRUE, INVALID },
436   { "colorSShout", ArgAttribs, (void *) ColorSShout, TRUE, INVALID },
437   { "colorCShout", ArgAttribs, (void *) ColorSShout, FALSE, INVALID }, // for XB
438   { "colorChannel1", ArgAttribs, (void *) ColorChannel1, TRUE, INVALID },
439   { "colorChannel", ArgAttribs, (void *) ColorChannel, TRUE, INVALID },
440   { "colorKibitz", ArgAttribs, (void *) ColorKibitz, TRUE, INVALID },
441   { "colorTell", ArgAttribs, (void *) ColorTell, TRUE, INVALID },
442   { "colorChallenge", ArgAttribs, (void *) ColorChallenge, TRUE, INVALID },
443   { "colorRequest", ArgAttribs, (void *) ColorRequest, TRUE, INVALID },
444   { "colorSeek", ArgAttribs, (void *) ColorSeek, TRUE, INVALID },
445   { "colorNormal", ArgAttribs, (void *) ColorNormal, TRUE, INVALID },
446   { "colorBackground", ArgColor, (void *) 7, TRUE, COLOR_BKGD },
447   { "soundShout", ArgFilename, (void *) &appData.soundShout, TRUE, (ArgIniType) "" },
448   { "soundSShout", ArgFilename, (void *) &appData.soundSShout, TRUE, (ArgIniType) "" },
449   { "soundCShout", ArgFilename, (void *) &appData.soundSShout, FALSE, (ArgIniType) "" }, // for XB
450   { "soundChannel1", ArgFilename, (void *) &appData.soundChannel1, TRUE, (ArgIniType) "" },
451   { "soundChannel", ArgFilename, (void *) &appData.soundChannel, TRUE, (ArgIniType) "" },
452   { "soundKibitz", ArgFilename, (void *) &appData.soundKibitz, TRUE, (ArgIniType) "" },
453   { "soundTell", ArgFilename, (void *) &appData.soundTell, TRUE, (ArgIniType) "" },
454   { "soundChallenge", ArgFilename, (void *) &appData.soundChallenge, TRUE, (ArgIniType) "" },
455   { "soundRequest", ArgFilename, (void *) &appData.soundRequest, TRUE, (ArgIniType) "" },
456   { "soundSeek", ArgFilename, (void *) &appData.soundSeek, TRUE, (ArgIniType) "" },
457   { "soundMove", ArgFilename, (void *) &appData.soundMove, TRUE, (ArgIniType) "" },
458   { "soundBell", ArgFilename, (void *) &appData.soundBell, TRUE, (ArgIniType) SOUND_BELL },
459   { "soundIcsWin", ArgFilename, (void *) &appData.soundIcsWin, TRUE, (ArgIniType) "" },
460   { "soundIcsLoss", ArgFilename, (void *) &appData.soundIcsLoss, TRUE, (ArgIniType) "" },
461   { "soundIcsDraw", ArgFilename, (void *) &appData.soundIcsDraw, TRUE, (ArgIniType) "" },
462   { "soundIcsUnfinished", ArgFilename, (void *) &appData.soundIcsUnfinished, TRUE, (ArgIniType) "" },
463   { "soundIcsAlarm", ArgFilename, (void *) &appData.soundIcsAlarm, TRUE, (ArgIniType) "" },
464   { "disguisePromotedPieces", ArgBoolean, (void *) &appData.disguise, TRUE, (ArgIniType) TRUE },
465   { "reuseFirst", ArgBoolean, (void *) &appData.reuseFirst, FALSE, (ArgIniType) TRUE },
466   { "reuse", ArgTrue, (void *) &appData.reuseFirst, FALSE, INVALID },
467   { "xreuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
468   { "-reuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
469   { "reuseChessPrograms", ArgBoolean,
470     (void *) &appData.reuseFirst, FALSE, INVALID }, /* backward compat only */
471   { "reuseSecond", ArgBoolean, (void *) &appData.reuseSecond, FALSE, (ArgIniType) TRUE },
472   { "reuse2", ArgTrue, (void *) &appData.reuseSecond, FALSE, INVALID },
473   { "xreuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
474   { "-reuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
475   { "comPortSettings", ArgCommSettings, (void *) /*&dcb*/ 0, TRUE, INVALID },
476   { "settingsFile", ArgSettingsFilename, (void *) &settingsFileName, FALSE, (ArgIniType) SETTINGS_FILE },
477   { "ini", ArgSettingsFilename, (void *) &settingsFileName, FALSE, INVALID },
478   { "at", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
479   { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
480   { "saveSettingsFile", ArgFilename, (void *) &settingsFileName, FALSE, INVALID },
481   { "saveSettingsOnExit", ArgBoolean, (void *) &saveSettingsOnExit, TRUE, (ArgIniType) TRUE },
482   { "chessProgram", ArgBoolean, (void *) &chessProgram, FALSE, (ArgIniType) FALSE },
483   { "cp", ArgTrue, (void *) &chessProgram, FALSE, INVALID },
484   { "xcp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
485   { "-cp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
486   { "icsMenu", ArgString, (void *) &icsTextMenuString, TRUE, (ArgIniType) ICS_TEXT_MENU_DEFAULT },
487   { "icsNames", ArgString, (void *) &icsNames, TRUE, (ArgIniType) ICS_NAMES },
488   { "singleEngineList", ArgBoolean, (void *) &singleList, !XBOARD, (ArgIniType) FALSE },
489   { "recentEngines", ArgInt, (void *) &appData.recentEngines, TRUE, (ArgIniType) 6 },
490   { "recentEngineList", ArgString, (void *) &appData.recentEngineList, TRUE, (ArgIniType) "" },
491   { "firstChessProgramNames", ArgString, (void *) &firstChessProgramNames,
492     TRUE, (ArgIniType) FCP_NAMES },
493   { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames,
494     !XBOARD, (ArgIniType) SCP_NAMES },
495   { "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" },
496   { "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID },
497   { "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" },
498   { "firstProtocolVersion", ArgInt, (void *) &appData.firstProtocolVersion, FALSE, (ArgIniType) PROTOVER },
499   { "secondProtocolVersion", ArgInt, (void *) &appData.secondProtocolVersion,FALSE, (ArgIniType) PROTOVER },
500   { "showButtonBar", ArgBoolean, (void *) &appData.showButtonBar, TRUE, (ArgIniType) TRUE },
501   { "buttons", ArgTrue, (void *) &appData.showButtonBar, FALSE, INVALID },
502   { "xbuttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
503   { "-buttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
504
505   /* [AS] New features */
506   { "firstScoreAbs", ArgBoolean, (void *) &appData.firstScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
507   { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
508   { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE },
509   { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE },
510   { "liteBackTextureFile", ArgString, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
511   { "darkBackTextureFile", ArgString, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
512   { "liteBackTextureMode", ArgInt, (void *) &appData.liteBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
513   { "darkBackTextureMode", ArgInt, (void *) &appData.darkBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
514   { "renderPiecesWithFont", ArgString, (void *) &appData.renderPiecesWithFont, TRUE, (ArgIniType) "" },
515   { "fontPieceToCharTable", ArgString, (void *) &appData.fontToPieceTable, TRUE, (ArgIniType) "" },
516   { "fontPieceBackColorWhite", ArgColor, (void *) 8, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
517   { "fontPieceForeColorWhite", ArgColor, (void *) 9, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
518   { "fontPieceBackColorBlack", ArgColor, (void *) 10, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
519   { "fontPieceForeColorBlack", ArgColor, (void *) 11, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
520   { "fontPieceSize", ArgInt, (void *) &appData.fontPieceSize, TRUE, (ArgIniType) 80 },
521   { "overrideLineGap", ArgInt, (void *) &appData.overrideLineGap, TRUE, (ArgIniType) 1 },
522   { "adjudicateLossThreshold", ArgInt, (void *) &appData.adjudicateLossThreshold, TRUE, (ArgIniType) 0 },
523   { "delayBeforeQuit", ArgInt, (void *) &appData.delayBeforeQuit, TRUE, (ArgIniType) 0 },
524   { "delayAfterQuit", ArgInt, (void *) &appData.delayAfterQuit, TRUE, (ArgIniType) 0 },
525   { "nameOfDebugFile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, (ArgIniType) DEBUG_FILE },
526   { "debugfile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, INVALID },
527   { "pgnEventHeader", ArgString, (void *) &appData.pgnEventHeader, TRUE, (ArgIniType) "Computer Chess Game" },
528   { "defaultFrcPosition", ArgInt, (void *) &appData.defaultFrcPosition, TRUE, (ArgIniType) -1 },
529   { "shuffleOpenings", ArgTrue, (void *) &shuffleOpenings, FALSE, INVALID },
530   { "gameListTags", ArgString, (void *) &appData.gameListTags, TRUE, (ArgIniType) GLT_DEFAULT_TAGS },
531   { "saveOutOfBookInfo", ArgBoolean, (void *) &appData.saveOutOfBookInfo, TRUE, (ArgIniType) TRUE },
532   { "showEvalInMoveHistory", ArgBoolean, (void *) &appData.showEvalInMoveHistory, TRUE, (ArgIniType) TRUE },
533   { "evalHistColorWhite", ArgColor, (void *) 12, TRUE, (ArgIniType) "#FFFFB0" },
534   { "evalHistColorBlack", ArgColor, (void *) 13, TRUE, (ArgIniType) "#AD5D3D" },
535   { "highlightMoveWithArrow", ArgBoolean, (void *) &appData.highlightMoveWithArrow, TRUE, (ArgIniType) FALSE },
536   { "highlightArrowColor", ArgColor, (void *) 14, TRUE, (ArgIniType) "#FFFF80" },
537   { "stickyWindows", ArgBoolean, (void *) &appData.useStickyWindows, TRUE, (ArgIniType) TRUE },
538   { "adjudicateDrawMoves", ArgInt, (void *) &appData.adjudicateDrawMoves, TRUE, (ArgIniType) 0 },
539   { "autoDisplayComment", ArgBoolean, (void *) &appData.autoDisplayComment, TRUE, (ArgIniType) TRUE },
540   { "autoDisplayTags", ArgBoolean, (void *) &appData.autoDisplayTags, TRUE, (ArgIniType) TRUE },
541   { "firstIsUCI", ArgBoolean, (void *) &appData.firstIsUCI, FALSE, (ArgIniType) FALSE },
542   { "fUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
543   { "firstUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
544   { "secondIsUCI", ArgBoolean, (void *) &appData.secondIsUCI, FALSE, (ArgIniType) FALSE },
545   { "sUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
546   { "fUCCI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
547   { "sUCCI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
548   { "fUSI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
549   { "sUSI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
550   { "secondUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
551   { "firstHasOwnBookUCI", ArgBoolean, (void *) &appData.firstHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
552   { "fNoOwnBookUCI", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
553   { "firstXBook", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
554   { "secondHasOwnBookUCI", ArgBoolean, (void *) &appData.secondHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
555   { "sNoOwnBookUCI", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
556   { "secondXBook", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
557   { "adapterCommand", ArgFilename, (void *) &appData.adapterCommand, TRUE, (ArgIniType) "polyglot -noini -ec \"%fcp\" -ed \"%fd\"" },
558   { "uxiAdapter", ArgFilename, (void *) &appData.ucciAdapter, TRUE, (ArgIniType) "" },
559   { "polyglotDir", ArgFilename, (void *) &appData.polyglotDir, TRUE, (ArgIniType) "" },
560   { "usePolyglotBook", ArgBoolean, (void *) &appData.usePolyglotBook, TRUE, (ArgIniType) FALSE },
561   { "polyglotBook", ArgFilename, (void *) &appData.polyglotBook, TRUE, (ArgIniType) "" },
562   { "bookDepth", ArgInt, (void *) &appData.bookDepth, TRUE, (ArgIniType) 12 },
563   { "bookVariation", ArgInt, (void *) &appData.bookStrength, TRUE, (ArgIniType) 50 },
564   { "discourageOwnBooks", ArgBoolean, (void *) &appData.defNoBook, TRUE, (ArgIniType) FALSE },
565   { "defaultHashSize", ArgInt, (void *) &appData.defaultHashSize, TRUE, (ArgIniType) 64 },
566   { "defaultCacheSizeEGTB", ArgInt, (void *) &appData.defaultCacheSizeEGTB, TRUE, (ArgIniType) 4 },
567   { "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" },
568   { "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
569   { "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
570   { "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
571   { "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
572
573   // [HGM] tournament options
574   { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
575   { "tf", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
576   { "participants", ArgString, (void *) &appData.participants, FALSE, (ArgIniType) "" },
577   { "tourneyType", ArgInt, (void *) &appData.tourneyType, FALSE, (ArgIniType) 0 },
578   { "tt", ArgInt, (void *) &appData.tourneyType, FALSE, INVALID },
579   { "tourneyCycles", ArgInt, (void *) &appData.tourneyCycles, FALSE, (ArgIniType) 1 },
580   { "cy", ArgInt, (void *) &appData.tourneyCycles, FALSE, INVALID },
581   { "results", ArgString, (void *) &appData.results, FALSE, (ArgIniType) "" },
582   { "syncAfterRound", ArgBoolean, (void *) &appData.roundSync, FALSE, (ArgIniType) FALSE },
583   { "syncAfterCycle", ArgBoolean, (void *) &appData.cycleSync, FALSE, (ArgIniType) TRUE },
584   { "seedBase", ArgInt, (void *) &appData.seedBase, FALSE, (ArgIniType) 1 },
585   { "pgnNumberTag", ArgBoolean, (void *) &appData.numberTag, TRUE, (ArgIniType) FALSE },
586   { "afterGame", ArgString, (void *) &appData.afterGame, FALSE, INVALID },
587   { "afterTourney", ArgString, (void *) &appData.afterTourney, FALSE, INVALID },
588
589   /* [HGM] board-size, adjudication and misc. options */
590   { "oneClickMove", ArgBoolean, (void *) &appData.oneClick, TRUE, (ArgIniType) FALSE },
591   { "boardWidth", ArgInt, (void *) &appData.NrFiles, FALSE, (ArgIniType) -1 },
592   { "boardHeight", ArgInt, (void *) &appData.NrRanks, FALSE, (ArgIniType) -1 },
593   { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, FALSE, (ArgIniType) -1 },
594   { "defaultMatchGames", ArgInt, (void *) &appData.defaultMatchGames, TRUE, (ArgIniType) 10 },
595   { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 },
596   { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID },
597   { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID },
598   { "colorNickNames", ArgString, (void *) &appData.colorNickNames, FALSE, INVALID },
599   { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, FALSE, (ArgIniType) FALSE },
600   { "allWhite", ArgBoolean, (void *) &appData.allWhite, FALSE, (ArgIniType) FALSE },
601   { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE },
602   { "firstAlphaRank", ArgBoolean, (void *) &first.alphaRank, FALSE, (ArgIniType) FALSE },
603   { "secondAlphaRank", ArgBoolean, (void *) &second.alphaRank, FALSE, (ArgIniType) FALSE },
604   { "testClaims", ArgBoolean, (void *) &appData.testClaims, TRUE, (ArgIniType) FALSE },
605   { "checkMates", ArgBoolean, (void *) &appData.checkMates, TRUE, (ArgIniType) FALSE },
606   { "materialDraws", ArgBoolean, (void *) &appData.materialDraws, TRUE, (ArgIniType) FALSE },
607   { "trivialDraws", ArgBoolean, (void *) &appData.trivialDraws, TRUE, (ArgIniType) FALSE },
608   { "ruleMoves", ArgInt, (void *) &appData.ruleMoves, TRUE, (ArgIniType) 51 },
609   { "repeatsToDraw", ArgInt, (void *) &appData.drawRepeats, TRUE, (ArgIniType) 6 },
610   { "backgroundObserve", ArgBoolean, (void *) &appData.bgObserve, TRUE, (ArgIniType) FALSE },
611   { "dualBoard", ArgBoolean, (void *) &appData.dualBoard, TRUE, (ArgIniType) FALSE },
612   { "autoKibitz", ArgTrue, (void *) &appData.autoKibitz, FALSE, INVALID },
613   { "engineDebugOutput", ArgInt, (void *) &appData.engineComments, FALSE, (ArgIniType) 1 },
614   { "userName", ArgString, (void *) &appData.userName, FALSE, INVALID },
615   { "rewindIndex", ArgInt, (void *) &appData.rewindIndex, FALSE, INVALID },
616   { "sameColorGames", ArgInt, (void *) &appData.sameColorGames, FALSE, INVALID },
617   { "smpCores", ArgInt, (void *) &appData.smpCores, TRUE, (ArgIniType) 1 },
618   { "egtFormats", ArgString, (void *) &appData.egtFormats, TRUE, (ArgIniType) "" },
619   { "niceEngines", ArgInt, (void *) &appData.niceEngines, TRUE, INVALID },
620   { "firstLogo", ArgFilename, (void *) &appData.firstLogo, FALSE, INVALID },
621   { "secondLogo", ArgFilename, (void *) &appData.secondLogo, FALSE, INVALID },
622   { "autoLogo", ArgBoolean, (void *) &appData.autoLogo, TRUE, INVALID },
623   { "firstOptions", ArgString, (void *) &appData.firstOptions, FALSE, (ArgIniType) "" },
624   { "secondOptions", ArgString, (void *) &appData.secondOptions, FALSE, (ArgIniType) "" },
625   { "firstFeatures", ArgString, (void *) &appData.features[0], FALSE, (ArgIniType) "" },
626   { "secondFeatures", ArgString, (void *) &appData.features[1], FALSE, (ArgIniType) "" },
627   { "featureDefaults", ArgString, (void *) &appData.featureDefaults, TRUE, (ArgIniType) "" },
628   { "firstNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride1, FALSE, (ArgIniType) NULL },
629   { "secondNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride2, FALSE, (ArgIniType) NULL },
630   { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID },
631   { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID },
632   { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID },
633   { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, (ArgIniType) FALSE },
634   { "firstPgnName", ArgString, (void *) &appData.pgnName[0], FALSE, (ArgIniType) "" },
635   { "fn", ArgString, (void *) &appData.pgnName[0], FALSE, INVALID },
636   { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" },
637   { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID },
638   { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE },
639   { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE },
640   { "evalZoom", ArgInt, (void *) &appData.zoom, TRUE, (ArgIniType) 1 },
641   { "evalThreshold", ArgInt, (void *) &appData.evalThreshold, TRUE, (ArgIniType) 25 },
642   { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE },
643   { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE },
644   { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" },
645   { "defaultTourneyName", ArgFilename, (void *) &appData.defName, TRUE, "" },
646   { "eloThresholdAny", ArgInt, (void *) &appData.eloThreshold1, FALSE, (ArgIniType) 0 },
647   { "eloThresholdBoth", ArgInt, (void *) &appData.eloThreshold2, FALSE, (ArgIniType) 0 },
648   { "dateThreshold", ArgInt, (void *) &appData.dateThreshold, FALSE, (ArgIniType) 0 },
649   { "searchMode", ArgInt, (void *) &appData.searchMode, FALSE, (ArgIniType) 1 },
650   { "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 },
651   { "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE },
652   { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE },
653   { "viewer", ArgTrue, (void *) &appData.viewer, FALSE, FALSE },
654   { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" },
655   { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE },
656
657 #if ZIPPY
658   { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
659   { "zt", ArgTrue, (void *) &appData.zippyTalk, FALSE, INVALID },
660   { "xzt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
661   { "-zt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
662   { "zippyPlay", ArgBoolean, (void *) &appData.zippyPlay, FALSE, (ArgIniType) ZIPPY_PLAY },
663   { "zp", ArgTrue, (void *) &appData.zippyPlay, FALSE, INVALID },
664   { "xzp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
665   { "-zp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
666   { "zippyLines", ArgFilename, (void *) &appData.zippyLines, FALSE, (ArgIniType) ZIPPY_LINES },
667   { "zippyPinhead", ArgString, (void *) &appData.zippyPinhead, FALSE, (ArgIniType) ZIPPY_PINHEAD },
668   { "zippyPassword", ArgString, (void *) &appData.zippyPassword, FALSE, (ArgIniType) ZIPPY_PASSWORD },
669   { "zippyPassword2", ArgString, (void *) &appData.zippyPassword2, FALSE, (ArgIniType) ZIPPY_PASSWORD2 },
670   { "zippyWrongPassword", ArgString, (void *) &appData.zippyWrongPassword,
671     FALSE, (ArgIniType) ZIPPY_WRONG_PASSWORD },
672   { "zippyAcceptOnly", ArgString, (void *) &appData.zippyAcceptOnly, FALSE, (ArgIniType) ZIPPY_ACCEPT_ONLY },
673   { "zippyUseI", ArgBoolean, (void *) &appData.zippyUseI, FALSE, (ArgIniType) ZIPPY_USE_I },
674   { "zui", ArgTrue, (void *) &appData.zippyUseI, FALSE, INVALID },
675   { "xzui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
676   { "-zui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
677   { "zippyBughouse", ArgInt, (void *) &appData.zippyBughouse, FALSE, (ArgIniType) ZIPPY_BUGHOUSE },
678   { "zippyNoplayCrafty", ArgBoolean, (void *) &appData.zippyNoplayCrafty,
679     FALSE, (ArgIniType) ZIPPY_NOPLAY_CRAFTY },
680   { "znc", ArgTrue, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
681   { "xznc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
682   { "-znc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
683   { "zippyGameEnd", ArgString, (void *) &appData.zippyGameEnd, FALSE, (ArgIniType) ZIPPY_GAME_END },
684   { "zippyGameStart", ArgString, (void *) &appData.zippyGameStart, FALSE, (ArgIniType) ZIPPY_GAME_START },
685   { "zippyAdjourn", ArgBoolean, (void *) &appData.zippyAdjourn, FALSE, (ArgIniType) ZIPPY_ADJOURN },
686   { "zadj", ArgTrue, (void *) &appData.zippyAdjourn, FALSE, INVALID },
687   { "xzadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
688   { "-zadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
689   { "zippyAbort", ArgBoolean, (void *) &appData.zippyAbort, FALSE, (ArgIniType) ZIPPY_ABORT },
690   { "zab", ArgTrue, (void *) &appData.zippyAbort, FALSE, INVALID },
691   { "xzab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
692   { "-zab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
693   { "zippyVariants", ArgString, (void *) &appData.zippyVariants, FALSE, (ArgIniType) ZIPPY_VARIANTS },
694   { "zippyMaxGames", ArgInt, (void *)&appData.zippyMaxGames, FALSE, (ArgIniType) ZIPPY_MAX_GAMES},
695   { "zippyReplayTimeout", ArgInt, (void *)&appData.zippyReplayTimeout, FALSE, (ArgIniType) ZIPPY_REPLAY_TIMEOUT },
696   { "zippyShortGame", ArgInt, (void *)&appData.zippyShortGame, FALSE, INVALID },
697   /* Kludge to allow winboard.ini files from buggy 4.0.4 to be read: */
698   { "zippyReplyTimeout", ArgInt, (void *)&junk, FALSE, INVALID },
699 #endif
700   /* [HGM] options for broadcasting and time odds */
701   { "chatBoxes", ArgString, (void *) &appData.chatBoxes, !XBOARD, (ArgIniType) NULL },
702   { "serverMoves", ArgString, (void *) &appData.serverMovesName, FALSE, (ArgIniType) NULL },
703   { "serverFile", ArgString, (void *) &appData.serverFileName, FALSE, (ArgIniType) NULL },
704   { "suppressLoadMoves", ArgBoolean, (void *) &appData.suppressLoadMoves, FALSE, (ArgIniType) FALSE },
705   { "serverPause", ArgInt, (void *) &appData.serverPause, FALSE, (ArgIniType) 15 },
706   { "firstTimeOdds", ArgInt, (void *) &appData.firstTimeOdds, FALSE, (ArgIniType) 1 },
707   { "secondTimeOdds", ArgInt, (void *) &appData.secondTimeOdds, FALSE, (ArgIniType) 1 },
708   { "timeOddsMode", ArgInt, (void *) &appData.timeOddsMode, TRUE, INVALID },
709   { "firstAccumulateTC", ArgInt, (void *) &appData.firstAccumulateTC, FALSE, (ArgIniType) 1 },
710   { "secondAccumulateTC", ArgInt, (void *) &appData.secondAccumulateTC, FALSE, (ArgIniType) 1 },
711   { "firstNPS", ArgInt, (void *) &appData.firstNPS, FALSE, (ArgIniType) -1 },
712   { "secondNPS", ArgInt, (void *) &appData.secondNPS, FALSE, (ArgIniType) -1 },
713   { "noGUI", ArgTrue, (void *) &appData.noGUI, FALSE, INVALID },
714   { "keepLineBreaksICS", ArgBoolean, (void *) &appData.noJoin, TRUE, INVALID },
715   { "wrapContinuationSequence", ArgString, (void *) &appData.wrapContSeq, FALSE, INVALID },
716   { "useInternalWrap", ArgTrue, (void *) &appData.useInternalWrap, FALSE, INVALID }, /* noJoin usurps this if set */
717
718   // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others
719   { "minX", ArgZ, (void *) &minX, FALSE, INVALID }, // [HGM] placement: to make sure auxiliary windows can be placed
720   { "minY", ArgZ, (void *) &minY, FALSE, INVALID },
721   { "frameX", ArgInt, (void *) &frameX, XBOARD, (ArgIniType) 2 }, // [HGM] placement: correction for lying X11
722   { "frameY", ArgInt, (void *) &frameY, XBOARD, (ArgIniType) 22 },
723   { "winWidth",  ArgInt, (void *) &wpMain.width,  TRUE, INVALID }, // [HGM] placement: dummies to remember right & bottom
724   { "winHeight", ArgInt, (void *) &wpMain.height, TRUE, INVALID }, //       for attaching auxiliary windows to them
725   { "x", ArgInt, (void *) &wpMain.x, TRUE, (ArgIniType) CW_USEDEFAULT },
726   { "y", ArgInt, (void *) &wpMain.y, TRUE, (ArgIniType) CW_USEDEFAULT },
727   { "icsX", ArgX,   (void *) &wpConsole.x, TRUE, (ArgIniType) CW_USEDEFAULT },
728   { "icsY", ArgY,   (void *) &wpConsole.y, TRUE, (ArgIniType) CW_USEDEFAULT },
729   { "icsW", ArgInt, (void *) &wpConsole.width, TRUE, (ArgIniType) CW_USEDEFAULT },
730   { "icsH", ArgInt, (void *) &wpConsole.height, TRUE, (ArgIniType) CW_USEDEFAULT },
731   { "analysisX", ArgX,   (void *) &junk, FALSE, INVALID }, // [HGM] placement: analysis window no longer exists
732   { "analysisY", ArgY,   (void *) &junk, FALSE, INVALID }, //       provided for compatibility with old ini files
733   { "analysisW", ArgInt, (void *) &junk, FALSE, INVALID },
734   { "analysisH", ArgInt, (void *) &junk, FALSE, INVALID },
735   { "commentX", ArgX,   (void *) &wpComment.x, TRUE, (ArgIniType) CW_USEDEFAULT },
736   { "commentY", ArgY,   (void *) &wpComment.y, TRUE, (ArgIniType) CW_USEDEFAULT },
737   { "commentW", ArgInt, (void *) &wpComment.width, TRUE, (ArgIniType) CW_USEDEFAULT },
738   { "commentH", ArgInt, (void *) &wpComment.height, TRUE, (ArgIniType) CW_USEDEFAULT },
739   { "tagsX", ArgX,   (void *) &wpTags.x, TRUE, (ArgIniType) CW_USEDEFAULT },
740   { "tagsY", ArgY,   (void *) &wpTags.y, TRUE, (ArgIniType) CW_USEDEFAULT },
741   { "tagsW", ArgInt, (void *) &wpTags.width, TRUE, (ArgIniType) CW_USEDEFAULT },
742   { "tagsH", ArgInt, (void *) &wpTags.height, TRUE, (ArgIniType) CW_USEDEFAULT },
743   { "gameListX", ArgX,   (void *) &wpGameList.x, TRUE, (ArgIniType) CW_USEDEFAULT },
744   { "gameListY", ArgY,   (void *) &wpGameList.y, TRUE, (ArgIniType) CW_USEDEFAULT },
745   { "gameListW", ArgInt, (void *) &wpGameList.width, TRUE, (ArgIniType) CW_USEDEFAULT },
746   { "gameListH", ArgInt, (void *) &wpGameList.height, TRUE, (ArgIniType) CW_USEDEFAULT },
747   /* [AS] Layout stuff */
748   { "moveHistoryUp", ArgBoolean, (void *) &wpMoveHistory.visible, TRUE, (ArgIniType) TRUE },
749   { "moveHistoryX", ArgX,   (void *) &wpMoveHistory.x, TRUE, (ArgIniType) CW_USEDEFAULT },
750   { "moveHistoryY", ArgY,   (void *) &wpMoveHistory.y, TRUE, (ArgIniType) CW_USEDEFAULT },
751   { "moveHistoryW", ArgInt, (void *) &wpMoveHistory.width, TRUE, (ArgIniType) CW_USEDEFAULT },
752   { "moveHistoryH", ArgInt, (void *) &wpMoveHistory.height, TRUE, (ArgIniType) CW_USEDEFAULT },
753
754   { "evalGraphUp", ArgBoolean, (void *) &wpEvalGraph.visible, TRUE, (ArgIniType) TRUE },
755   { "evalGraphX", ArgX,   (void *) &wpEvalGraph.x, TRUE, (ArgIniType) CW_USEDEFAULT },
756   { "evalGraphY", ArgY,   (void *) &wpEvalGraph.y, TRUE, (ArgIniType) CW_USEDEFAULT },
757   { "evalGraphW", ArgInt, (void *) &wpEvalGraph.width, TRUE, (ArgIniType) CW_USEDEFAULT },
758   { "evalGraphH", ArgInt, (void *) &wpEvalGraph.height, TRUE, (ArgIniType) CW_USEDEFAULT },
759
760   { "engineOutputUp", ArgBoolean, (void *) &wpEngineOutput.visible, TRUE, (ArgIniType) TRUE },
761   { "engineOutputX", ArgX,   (void *) &wpEngineOutput.x, TRUE, (ArgIniType) CW_USEDEFAULT },
762   { "engineOutputY", ArgY,   (void *) &wpEngineOutput.y, TRUE, (ArgIniType) CW_USEDEFAULT },
763   { "engineOutputW", ArgInt, (void *) &wpEngineOutput.width, TRUE, (ArgIniType) CW_USEDEFAULT },
764   { "engineOutputH", ArgInt, (void *) &wpEngineOutput.height, TRUE, (ArgIniType) CW_USEDEFAULT },
765
766   { NULL, ArgNone, NULL, FALSE, INVALID }
767 };
768
769
770 /* Kludge for indirection files on command line */
771 char* lastIndirectionFilename;
772 ArgDescriptor argDescriptorIndirection =
773 { "", ArgSettingsFilename, (void *) NULL, FALSE };
774
775 void
776 ExitArgError(char *msg, char *badArg, Boolean quit)
777 {
778   char buf[MSG_SIZ];
779   int len;
780
781   len = snprintf(buf, MSG_SIZ, msg, badArg);
782   if( (len >= MSG_SIZ) && appData.debugMode )
783     fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
784
785   if(!quit) { printf(_("%s in settings file\n"), buf); return; } // DisplayError does not work yet at this stage...
786   DisplayFatalError(buf, 0, 2);
787   exit(2);
788 }
789
790 int
791 ValidateInt(char *s)
792 {
793   char *p = s;
794   if(*p == '-' || *p == '+') p++;
795   while(*p) if(!isdigit(*p++)) ExitArgError(_("Bad integer value %s"), s, TRUE);
796   return atoi(s);
797 }
798
799 char
800 StringGet(void *getClosure)
801 {
802   char **p = (char **) getClosure;
803   return *((*p)++);
804 }
805
806 char
807 FileGet(void *getClosure)
808 {
809   int c;
810   FILE* f = (FILE*) getClosure;
811
812   c = getc(f);
813   if (c == '\r') c = getc(f); // work around DOS format files by bypassing the '\r' completely
814   if (c == EOF)
815     return NULLCHAR;
816   else
817     return (char) c;
818 }
819
820 /* Parse settings file named "name". If file found, return the
821    full name in fullname and return TRUE; else return FALSE */
822 Boolean
823 ParseSettingsFile(char *name, char **addr)
824 {
825   FILE *f;
826   int ok,len;
827   char buf[MSG_SIZ], fullname[MSG_SIZ];
828
829
830   ok = MySearchPath(installDir, name, fullname);
831   if(!ok && strchr(name, '.') == NULL)
832     { // append default file-name extension '.ini' when needed
833       len = snprintf(buf,MSG_SIZ, "%s.ini", name);
834       if( (len >= MSG_SIZ) && appData.debugMode )
835         fprintf(debugFP, "ParseSettingsFile: buffer truncated. Input: name=%s \n",name);
836
837       ok = MySearchPath(installDir, buf, fullname);
838     }
839   if (ok) {
840     f = fopen(fullname, "r");
841     if (f != NULL) {
842       if (addr != NULL) {
843             ASSIGN(*addr, fullname);
844       }
845       ParseArgs(FileGet, f);
846       fclose(f);
847       return TRUE;
848     }
849   }
850   return FALSE;
851 }
852
853 void
854 ParseArgs(GetFunc get, void *cl)
855 {
856   char argName[MAX_ARG_LEN];
857   char argValue[MAX_ARG_LEN];
858   ArgDescriptor *ad;
859   char start;
860   char *q;
861   int i, octval;
862   char ch;
863   int posarg = 0;
864
865   ch = get(cl);
866   for (;;) {
867     while (ch == ' ' || ch == '\n' || ch == '\t') ch = get(cl);
868     if (ch == NULLCHAR) break;
869     if (ch == ';') {
870       /* Comment to end of line */
871       ch = get(cl);
872       while (ch != '\n' && ch != NULLCHAR) ch = get(cl);
873       continue;
874     } else if (ch == '/' || ch == '-') {
875       /* Switch */
876       q = argName;
877       while (ch != ' ' && ch != '=' && ch != ':' && ch != NULLCHAR &&
878              ch != '\n' && ch != '\t') {
879         *q++ = ch;
880         ch = get(cl);
881       }
882       *q = NULLCHAR;
883       for (ad = argDescriptors; ad->argName != NULL; ad++)
884         if (strcmp(ad->argName, argName + 1) == 0) break;
885       if (ad->argName == NULL) {
886         ExitArgError(_("Unrecognized argument %s"), argName, get != &FileGet); // [HGM] make unknown argument non-fatal
887         while (ch != '\n' && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on
888         continue; // so that when it is in a settings file, it is the only setting that will be purged from it
889       }
890     } else if (ch == '@') {
891       /* Indirection file */
892       ad = &argDescriptorIndirection;
893       ch = get(cl);
894     } else {
895       /* Positional argument */
896       ad = &argDescriptors[posarg++];
897       strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
898     }
899
900     if (ad->argType == ArgTwo) { // [HGM] kludgey arg type, not suitable for saving
901       *(Boolean *) ad->argLoc = 2;
902       continue;
903     }
904     if (ad->argType == ArgTrue) {
905       *(Boolean *) ad->argLoc = TRUE;
906       continue;
907     }
908     if (ad->argType == ArgFalse) {
909       *(Boolean *) ad->argLoc = FALSE;
910       continue;
911     }
912
913     while (ch == ' ' || ch == '=' || ch == ':' || ch == '\t') ch = get(cl);
914     if (ch == NULLCHAR || ch == '\n') {
915       ExitArgError(_("No value provided for argument %s"), argName, TRUE);
916     }
917     q = argValue;
918     if (ch == '{') {
919       // Quoting with { }.  No characters have to (or can) be escaped.
920       // Thus the string cannot contain a '}' character.
921       start = ch;
922       ch = get(cl);
923       while (start) {
924         switch (ch) {
925         case NULLCHAR:
926           start = NULLCHAR;
927           break;
928
929         case '}':
930           ch = get(cl);
931           start = NULLCHAR;
932           break;
933
934         default:
935           *q++ = ch;
936           ch = get(cl);
937           break;
938         }
939       }
940     } else if (ch == '\'' || ch == '"') {
941       // Quoting with ' ' or " ", with \ as escape character.
942       // Inconvenient for long strings that may contain Windows filenames.
943       start = ch;
944       ch = get(cl);
945       while (start) {
946         switch (ch) {
947         case NULLCHAR:
948           start = NULLCHAR;
949           break;
950
951         default:
952         not_special:
953           *q++ = ch;
954           ch = get(cl);
955           break;
956
957         case '\'':
958         case '\"':
959           if (ch == start) {
960             ch = get(cl);
961             start = NULLCHAR;
962             break;
963           } else {
964             goto not_special;
965           }
966
967         case '\\':
968           if (ad->argType == ArgFilename
969               || ad->argType == ArgSettingsFilename) {
970               goto not_special;
971           }
972           ch = get(cl);
973           switch (ch) {
974           case NULLCHAR:
975             ExitArgError(_("Incomplete \\ escape in value for %s"), argName, TRUE);
976             break;
977           case 'n':
978             *q++ = '\n';
979             ch = get(cl);
980             break;
981           case 'r':
982             *q++ = '\r';
983             ch = get(cl);
984             break;
985           case 't':
986             *q++ = '\t';
987             ch = get(cl);
988             break;
989           case 'b':
990             *q++ = '\b';
991             ch = get(cl);
992             break;
993           case 'f':
994             *q++ = '\f';
995             ch = get(cl);
996             break;
997           default:
998             octval = 0;
999             for (i = 0; i < 3; i++) {
1000               if (ch >= '0' && ch <= '7') {
1001                 octval = octval*8 + (ch - '0');
1002                 ch = get(cl);
1003               } else {
1004                 break;
1005               }
1006             }
1007             if (i > 0) {
1008               *q++ = (char) octval;
1009             } else {
1010               *q++ = ch;
1011               ch = get(cl);
1012             }
1013             break;
1014           }
1015           break;
1016         }
1017       }
1018     } else {
1019       while (ch != ' ' && ch != NULLCHAR && ch != '\t' && ch != '\n') {
1020         *q++ = ch;
1021         ch = get(cl);
1022       }
1023     }
1024     *q = NULLCHAR;
1025
1026     switch (ad->argType) {
1027     case ArgInt:
1028       *(int *) ad->argLoc = ValidateInt(argValue);
1029       break;
1030
1031     case ArgX:
1032       *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute
1033       break;
1034
1035     case ArgY:
1036       *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...)
1037       break;
1038
1039     case ArgZ:
1040       *(int *) ad->argLoc = ValidateInt(argValue);
1041       EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY);
1042       break;
1043
1044     case ArgFloat:
1045       *(float *) ad->argLoc = (float) atof(argValue);
1046       break;
1047
1048     case ArgString:
1049     case ArgFilename:
1050       ASSIGN(*(char **) ad->argLoc, argValue);
1051       break;
1052
1053     case ArgSettingsFilename:
1054       {
1055         if (ParseSettingsFile(argValue, (char**)ad->argLoc)) {
1056         } else {
1057           if (ad->argLoc != NULL) {
1058           } else {
1059             ExitArgError(_("Failed to open indirection file %s"), argValue, TRUE);
1060           }
1061         }
1062       }
1063       break;
1064
1065     case ArgBoolean:
1066       switch (argValue[0]) {
1067       case 't':
1068       case 'T':
1069         *(Boolean *) ad->argLoc = TRUE;
1070         break;
1071       case 'f':
1072       case 'F':
1073         *(Boolean *) ad->argLoc = FALSE;
1074         break;
1075       default:
1076         ExitArgError(_("Unrecognized boolean argument value %s"), argValue, TRUE);
1077         break;
1078       }
1079       break;
1080
1081     case ArgColor:
1082       ParseColor((int)(intptr_t)ad->argLoc, argValue);
1083       break;
1084
1085     case ArgAttribs: {
1086       ColorClass cc = (ColorClass)ad->argLoc;
1087         ParseTextAttribs(cc, argValue); // [HGM] wrapper for platform independency
1088       }
1089       break;
1090
1091     case ArgBoardSize:
1092       ParseBoardSize(ad->argLoc, argValue);
1093       break;
1094
1095     case ArgFont:
1096       ParseFont(argValue, (int)(intptr_t)ad->argLoc);
1097       break;
1098
1099     case ArgCommSettings:
1100       ParseCommPortSettings(argValue);
1101       break;
1102
1103     case ArgNone:
1104       ExitArgError(_("Unrecognized argument %s"), argValue, TRUE);
1105       break;
1106     case ArgTwo:
1107     case ArgTrue:
1108     case ArgFalse: ;
1109     }
1110   }
1111 }
1112
1113 void
1114 ParseArgsFromString(char *p)
1115 {
1116     ParseArgs(StringGet, &p);
1117 }
1118
1119 void
1120 ParseArgsFromFile(FILE *f)
1121 {
1122     ParseArgs(FileGet, f);
1123 }
1124
1125 void
1126 ParseIcsTextMenu(char *icsTextMenuString)
1127 {
1128 //  int flags = 0;
1129   IcsTextMenuEntry *e = icsTextMenuEntry;
1130   char *p = icsTextMenuString;
1131   while (e->item != NULL && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1132     free(e->item);
1133     e->item = NULL;
1134     if (e->command != NULL) {
1135       free(e->command);
1136       e->command = NULL;
1137     }
1138     e++;
1139   }
1140   e = icsTextMenuEntry;
1141   while (*p && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1142     if (*p == ';' || *p == '\n') {
1143       e->item = strdup("-");
1144       e->command = NULL;
1145       p++;
1146     } else if (*p == '-') {
1147       e->item = strdup("-");
1148       e->command = NULL;
1149       p++;
1150       if (*p) p++;
1151     } else {
1152       char *q, *r, *s, *t;
1153       char c;
1154       q = strchr(p, ',');
1155       if (q == NULL) break;
1156       *q = NULLCHAR;
1157       r = strchr(q + 1, ',');
1158       if (r == NULL) break;
1159       *r = NULLCHAR;
1160       s = strchr(r + 1, ',');
1161       if (s == NULL) break;
1162       *s = NULLCHAR;
1163       c = ';';
1164       t = strchr(s + 1, c);
1165       if (t == NULL) {
1166         c = '\n';
1167         t = strchr(s + 1, c);
1168       }
1169       if (t != NULL) *t = NULLCHAR;
1170       e->item = strdup(p);
1171       e->command = strdup(q + 1);
1172       e->getname = *(r + 1) != '0';
1173       e->immediate = *(s + 1) != '0';
1174       *q = ',';
1175       *r = ',';
1176       *s = ',';
1177       if (t == NULL) break;
1178       *t = c;
1179       p = t + 1;
1180     }
1181     e++;
1182   }
1183 }
1184
1185 void
1186 SetDefaultTextAttribs()
1187 {
1188   ColorClass cc;
1189   for (cc = (ColorClass)0; cc < ColorNone; cc++) {
1190     ParseTextAttribs(cc, defaultTextAttribs[cc]);
1191   }
1192 }
1193
1194 void
1195 SetDefaultsFromList()
1196 { // [HGM] ini: take defaults from argDescriptor list
1197   int i;
1198
1199   for(i=0; argDescriptors[i].argName != NULL; i++) {
1200     if(argDescriptors[i].defaultValue != INVALID)
1201       switch(argDescriptors[i].argType) {
1202         case ArgBoolean:
1203         case ArgTwo:
1204         case ArgTrue:
1205         case ArgFalse:
1206           *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1207           break;
1208         case ArgInt:
1209         case ArgX:
1210         case ArgY:
1211         case ArgZ:
1212           *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1213           break;
1214         case ArgString:
1215         case ArgFilename:
1216         case ArgSettingsFilename:
1217           if((char *)argDescriptors[i].defaultValue)
1218           *(char **) argDescriptors[i].argLoc = strdup((char *)argDescriptors[i].defaultValue);
1219           break;
1220         case ArgBoardSize:
1221           *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1222           break;
1223         case ArgColor:
1224           ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue);
1225           break;
1226         case ArgFloat: // floats cannot be casted to int without precision loss
1227         default: ; // some arg types cannot be initialized through table
1228     }
1229   }
1230 }
1231
1232 void
1233 InitAppData(char *lpCmdLine)
1234 {
1235   int i;
1236   char buf[MAX_ARG_LEN], currDir[MSG_SIZ];
1237   char *p;
1238
1239   /* Initialize to defaults */
1240   SetDefaultsFromList(); // this sets most defaults
1241
1242   // some parameters for which there are no options!
1243   appData.Iconic = FALSE; /*unused*/
1244   appData.icsEngineAnalyze = FALSE;
1245
1246   // float: casting to int is not harmless, so default cannot be contained in table
1247   appData.timeDelay = TIME_DELAY;
1248   appData.timeIncrement = TIME_INCREMENT;
1249
1250   // some complex, platform-dependent stuff that could not be handled from table
1251   SetDefaultTextAttribs();
1252   SetFontDefaults();
1253   SetCommPortDefaults();
1254
1255   /* Parse default settings file if any */
1256   ParseSettingsFile(settingsFileName, &settingsFileName);
1257
1258   /* Parse command line */
1259   ParseArgs(StringGet, &lpCmdLine);
1260
1261   if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
1262
1263   /* [HGM] make sure board size is acceptable */
1264   if(appData.NrFiles > BOARD_FILES ||
1265      appData.NrRanks > BOARD_RANKS   )
1266       DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2);
1267
1268   /* [HGM] After parsing the options from the .ini file, and overruling them
1269    * with options from the command line, we now make an even higher priority
1270    * overrule by WB options attached to the engine command line. This so that
1271    * tournament managers can use WB options (such as /timeOdds) that follow
1272    * the engines.
1273    */
1274   if(appData.firstChessProgram != NULL) {
1275       char *p = StrStr(appData.firstChessProgram, "WBopt");
1276       static char *f = "first";
1277       char buf[MSG_SIZ], *q = buf;
1278       int len;
1279
1280       if(p != NULL)
1281         { // engine command line contains WinBoard options
1282           len = snprintf(buf, MSG_SIZ, p+6, f, f, f, f, f, f, f, f, f, f); // replace %s in them by "first"
1283           if( (len >= MSG_SIZ) && appData.debugMode )
1284             fprintf(debugFP, "InitAppData: buffer truncated.\n");
1285
1286           ParseArgs(StringGet, &q);
1287           p[-1] = 0; // cut them offengine command line
1288         }
1289   }
1290   // now do same for second chess program
1291   if(appData.secondChessProgram != NULL) {
1292       char *p = StrStr(appData.secondChessProgram, "WBopt");
1293       static char *s = "second";
1294       char buf[MSG_SIZ], *q = buf;
1295       int len;
1296
1297       if(p != NULL)
1298         { // engine command line contains WinBoard options
1299           len = snprintf(buf,MSG_SIZ, p+6, s, s, s, s, s, s, s, s, s, s); // replace %s in them by "first"
1300           if( (len >= MSG_SIZ) && appData.debugMode )
1301             fprintf(debugFP, "InitAppData: buffer truncated.\n");
1302
1303           ParseArgs(StringGet, &q);
1304           p[-1] = 0; // cut them offengine command line
1305         }
1306   }
1307
1308   /* Propagate options that affect others */
1309   if (appData.matchMode || appData.matchGames) chessProgram = TRUE;
1310   if (appData.icsActive || appData.noChessProgram) {
1311      chessProgram = FALSE;  /* not local chess program mode */
1312   }
1313
1314   /* Open startup dialog if needed */
1315   if ((!appData.noChessProgram && !chessProgram && !appData.icsActive) ||
1316       (appData.icsActive && *appData.icsHost == NULLCHAR) ||
1317       (chessProgram && (*appData.firstChessProgram == NULLCHAR ||
1318                         *appData.secondChessProgram == NULLCHAR)))
1319                 PopUpStartupDialog();
1320
1321   /* Make sure save files land in the right (?) directory */
1322   if (MyGetFullPathName(appData.saveGameFile, buf)) {
1323     appData.saveGameFile = strdup(buf);
1324   }
1325   if (MyGetFullPathName(appData.savePositionFile, buf)) {
1326     appData.savePositionFile = strdup(buf);
1327   }
1328
1329   /* Finish initialization for fonts and sounds */
1330   CreateFonts();
1331
1332   GetCurrentDirectory(MSG_SIZ, currDir);
1333   SetCurrentDirectory(installDir);
1334   LoadAllSounds();
1335   SetCurrentDirectory(currDir);
1336
1337   p = icsTextMenuString;
1338   if (p[0] == '@') {
1339     FILE* f = fopen(p + 1, "r");
1340     if (f == NULL) {
1341       DisplayFatalError(p + 1, errno, 2);
1342       return;
1343     }
1344     i = fread(buf, 1, sizeof(buf)-1, f);
1345     fclose(f);
1346     buf[i] = NULLCHAR;
1347     p = buf;
1348   }
1349   ParseIcsTextMenu(strdup(p));
1350 }
1351
1352 void
1353 SaveSettings(char* name)
1354 {
1355   FILE *f;
1356   ArgDescriptor *ad;
1357   char dir[MSG_SIZ], buf[MSG_SIZ];
1358
1359   if (!MainWindowUp()) return;
1360
1361   GetCurrentDirectory(MSG_SIZ, dir);
1362   if(MySearchPath(installDir, name, buf)) {
1363     f = fopen(buf, "w");
1364   } else {
1365     SetCurrentDirectory(installDir);
1366     f = fopen(name, "w");
1367     SetCurrentDirectory(dir);
1368   }
1369   if (f == NULL) {
1370     DisplayError(name, errno);
1371     return;
1372   }
1373
1374   fprintf(f, ";\n");
1375   fprintf(f, "; %s Save Settings file\n", PACKAGE_STRING);
1376   fprintf(f, ";\n");
1377   fprintf(f, "; You can edit the values of options that are already set in this file,\n");
1378   fprintf(f, "; but if you add other options, the next Save Settings will not save them.\n");
1379   fprintf(f, "; Use a shortcut, an @indirection file, or a .bat file instead.\n");
1380   fprintf(f, ";\n");
1381
1382   GetWindowCoords();
1383
1384   /* [AS] Move history */
1385   wpMoveHistory.visible = MoveHistoryIsUp();
1386
1387   /* [AS] Eval graph */
1388   wpEvalGraph.visible = EvalGraphIsUp();
1389
1390   /* [AS] Engine output */
1391   wpEngineOutput.visible = EngineOutputIsUp();
1392
1393   // [HGM] in WB we have to copy sound names to appData first
1394   ExportSounds();
1395
1396   for (ad = argDescriptors; ad->argName != NULL; ad++) {
1397     if (!ad->save) continue;
1398     switch (ad->argType) {
1399     case ArgString:
1400       {
1401         char *p = *(char **)ad->argLoc;
1402         if(p == NULL) break; // just in case
1403         if ((strchr(p, '\\') || strchr(p, '\n')) && !strchr(p, '}')) {
1404           /* Quote multiline values or \-containing values
1405              with { } if possible */
1406           fprintf(f, OPTCHAR "%s" SEPCHAR "{%s}\n", ad->argName, p);
1407         } else {
1408           /* Else quote with " " */
1409           fprintf(f, OPTCHAR "%s" SEPCHAR "\"", ad->argName);
1410           while (*p) {
1411             if (*p == '\n') fprintf(f, "\n");
1412             else if (*p == '\r') fprintf(f, "\\r");
1413             else if (*p == '\t') fprintf(f, "\\t");
1414             else if (*p == '\b') fprintf(f, "\\b");
1415             else if (*p == '\f') fprintf(f, "\\f");
1416             else if (*p < ' ') fprintf(f, "\\%03o", *p);
1417             else if (*p == '\"') fprintf(f, "\\\"");
1418             else if (*p == '\\') fprintf(f, "\\\\");
1419             else putc(*p, f);
1420             p++;
1421           }
1422           fprintf(f, "\"\n");
1423         }
1424       }
1425       break;
1426     case ArgInt:
1427     case ArgZ:
1428       fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc);
1429       break;
1430     case ArgX:
1431       fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.x); // [HGM] placement: store relative value
1432       break;
1433     case ArgY:
1434       fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.y);
1435       break;
1436     case ArgFloat:
1437       fprintf(f, OPTCHAR "%s" SEPCHAR "%g\n", ad->argName, *(float *)ad->argLoc);
1438       break;
1439     case ArgBoolean:
1440       fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName,
1441         (*(Boolean *)ad->argLoc) ? "true" : "false");
1442       break;
1443     case ArgTrue:
1444       if (*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1445       break;
1446     case ArgFalse:
1447       if (!*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1448       break;
1449     case ArgColor:
1450       SaveColor(f, ad);
1451       break;
1452     case ArgAttribs:
1453       SaveAttribsArg(f, ad);
1454       break;
1455     case ArgFilename:
1456       if(*(char**)ad->argLoc == NULL) break; // just in case
1457       if (strchr(*(char **)ad->argLoc, '\"')) {
1458         fprintf(f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, *(char **)ad->argLoc);
1459       } else {
1460         fprintf(f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, *(char **)ad->argLoc);
1461       }
1462       break;
1463     case ArgBoardSize:
1464       SaveBoardSize(f, ad->argName, ad->argLoc);
1465       break;
1466     case ArgFont:
1467       SaveFontArg(f, ad);
1468       break;
1469     case ArgCommSettings:
1470       PrintCommPortSettings(f, ad->argName);
1471     case ArgTwo:
1472     case ArgNone:
1473     case ArgSettingsFilename: ;
1474     }
1475   }
1476   fclose(f);
1477 }
1478
1479 Boolean
1480 GetArgValue(char *name)
1481 { // retrieve (as text) current value of string or int argument given by name
1482   // (this is used for maing the values available in the adapter command)
1483   ArgDescriptor *ad;
1484   int len;
1485
1486   for (ad = argDescriptors; ad->argName != NULL; ad++)
1487     if (strcmp(ad->argName, name) == 0) break;
1488
1489   if (ad->argName == NULL) return FALSE;
1490
1491   switch(ad->argType) {
1492     case ArgString:
1493     case ArgFilename:
1494       strncpy(name, *(char**) ad->argLoc, MSG_SIZ);
1495
1496       return TRUE;
1497     case ArgInt:
1498       len = snprintf(name, MSG_SIZ, "%d", *(int*) ad->argLoc);
1499       if( (len >= MSG_SIZ) && appData.debugMode )
1500         fprintf(debugFP, "GetArgValue: buffer truncated.\n");
1501
1502       return TRUE;
1503     case ArgBoolean:
1504       len = snprintf(name, MSG_SIZ, "%s", *(Boolean*) ad->argLoc ? "true" : "false");
1505       if( (len >= MSG_SIZ) && appData.debugMode )
1506         fprintf(debugFP, "GetArgValue: buffer truncated.\n");
1507
1508       return TRUE;
1509     default: ;
1510   }
1511
1512   return FALSE;
1513 }