> 6) Settings file
If we decide that the format of the options in the settings file should be the same as that of winboard.ini, then we can simply use the existing WinBoard code to parse the file. The only extra complication in XBoard is that that same code cannot be used to parse the command-line options, because the file format looks as the options look before the shell cops up the command line, removing outer-most quoting where applicable. So an obvious and quite trivial idea would be to take the argv[] list, put back the outer quotes, and string them together as a single line, so that it can be processed by the Winboard ParseArgs. Now this naive idea does not work very well, because putting the quotes back is a pain: not everything was quoted or is allowed to be quoted, and there are different kind of quotes that you have to use depending on if the object to be quoted already contains quotes. But perhaps it is not so difficult as I fear. Wouldn't the following work? If an argv[i] string does not contain a space, just copy it. If it does contain a space, put it between double quotes. But then replace every " in it by \", and every \ by \\, every NULLCHAR by \0 and every LINEFEED by \n. Then there is the subtle difference between the lists that define the options: in WinBoard they contain a Boolean to indicate if they should be saved in the ini file, but no default value, while in XBoard they contain a default value, and no save indicator. I guess to have the default value in the table is a good idea, there is a lot of code in WB now to set the defaults. But of course we could simply copy that code too. (InitAppData().) Hmm, put this way, it sounds simple enough to do it in minutes...
