typedef enum {
ArgString, ArgInt, ArgFloat, ArgBoolean, ArgTrue, ArgFalse, ArgNone,
ArgColor, ArgAttribs, ArgFilename, ArgBoardSize, ArgFont, ArgCommSettings,
- ArgSettingsFilename, ArgTwo,
+ ArgSettingsFilename, ArgBackupSettingsFile, ArgTwo,
ArgX, ArgY, ArgZ // [HGM] placement: for window-placement options stored relative to main window
} ArgType;
{ "at", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
{ "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
{ "saveSettingsFile", ArgFilename, (void *) &settingsFileName, FALSE, INVALID },
+ { "backupSettingsFile", ArgBackupSettingsFile, (void *) &settingsFileName, FALSE, INVALID },
{ "saveSettingsOnExit", ArgBoolean, (void *) &saveSettingsOnExit, TRUE, (ArgIniType) TRUE },
{ "chessProgram", ArgBoolean, (void *) &chessProgram, FALSE, (ArgIniType) FALSE },
{ "cp", ArgTrue, (void *) &chessProgram, FALSE, INVALID },
for (ad = argDescriptors; ad->argName != NULL; ad++)
if (strcmp(ad->argName, argName + 1) == 0) break;
if (ad->argName == NULL) {
+ char endChar = (ch && ch != '\n' && (ch = get(cl)) == '{' ? '}' : '\n');
ExitArgError(_("Unrecognized argument %s"), argName, get != &FileGet); // [HGM] make unknown argument non-fatal
- while (ch != '\n' && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on
+ while (ch != endChar && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on (or until closing '}' )
+ if(ch == '}') ch = get(cl);
continue; // so that when it is in a settings file, it is the only setting that will be purged from it
}
} else if (ch == '@') {
ASSIGN(*(char **) ad->argLoc, argValue);
break;
+ case ArgBackupSettingsFile: // no-op if non-default settings-file already successfully read
+ if(strcmp(*(char**)ad->argLoc, SETTINGS_FILE)) break;
case ArgSettingsFilename:
{
if (ParseSettingsFile(argValue, (char**)ad->argLoc)) {
PrintCommPortSettings(f, ad->argName);
case ArgTwo:
case ArgNone:
+ case ArgBackupSettingsFile:
case ArgSettingsFilename: ;
}
}