Build in limited EPD capability for engine fingerprintig
[xboard.git] / args.h
diff --git a/args.h b/args.h
index f6e755b..01dc439 100644 (file)
--- a/args.h
+++ b/args.h
@@ -60,7 +60,7 @@
 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;
 
@@ -490,6 +490,7 @@ ArgDescriptor argDescriptors[] = {
   { "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 },
@@ -596,6 +597,7 @@ ArgDescriptor argDescriptors[] = {
   { "useBorder", ArgBoolean, (void *) &appData.useBorder, TRUE, (ArgIniType) FALSE },
   { "ub", ArgBoolean, (void *) &appData.useBorder, FALSE, INVALID },
   { "border", ArgFilename, (void *) &appData.border, TRUE, (ArgIniType) "" },
+  { "finger", ArgFilename, (void *) &appData.finger, FALSE, (ArgIniType) "" },
 
   // [HGM] tournament options
   { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
@@ -918,8 +920,10 @@ ParseArgs(GetFunc get, void *cl)
       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 == '@') {
@@ -1105,6 +1109,8 @@ ParseArgs(GetFunc get, void *cl)
       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)) {
@@ -1537,6 +1543,7 @@ SaveSettings(char* name)
       PrintCommPortSettings(f, ad->argName);
     case ArgTwo:
     case ArgNone:
+    case ArgBackupSettingsFile:
     case ArgSettingsFilename: ;
     }
   }