Add -scoreWhite option
[xboard.git] / args.h
diff --git a/args.h b/args.h
index d3909b5..fbf2651 100644 (file)
--- a/args.h
+++ b/args.h
@@ -103,7 +103,7 @@ IcsTextMenuEntry icsTextMenuEntry[ICS_TEXT_MENU_SIZE];
 
 int junk;
 Boolean singleList;
-char *homeDir;\r
+char *homeDir;
 
 void EnsureOnScreen(int *x, int *y, int minX, int minY);
 char StringGet(void *getClosure);
@@ -622,6 +622,9 @@ ArgDescriptor argDescriptors[] = {
   { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" },
   { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID },
   { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE },
+  { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE },
+  { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE },
+  { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE },
   { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" },
   { "defaultTourneyName", ArgFilename, (void *) &appData.defName, TRUE, "" },
 
@@ -741,7 +744,7 @@ ArgDescriptor argDescriptorIndirection =
 { "", ArgSettingsFilename, (void *) NULL, FALSE };
 
 void
-ExitArgError(char *msg, char *badArg)
+ExitArgError(char *msg, char *badArg, Boolean quit)
 {
   char buf[MSG_SIZ];
   int len;
@@ -750,6 +753,7 @@ ExitArgError(char *msg, char *badArg)
   if( (len > MSG_SIZ) && appData.debugMode )
     fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
 
+  if(!quit) { printf("%s in settings file\n", buf); return; } // DisplayError does not work yet at this stage...
   DisplayFatalError(buf, 0, 2);
   exit(2);
 }
@@ -759,7 +763,7 @@ ValidateInt(char *s)
 {
   char *p = s;
   if(*p == '-' || *p == '+') p++;
-  while(*p) if(!isdigit(*p++)) ExitArgError("Bad integer value", s);
+  while(*p) if(!isdigit(*p++)) ExitArgError("Bad integer value", s, TRUE);
   return atoi(s);
 }
 
@@ -849,9 +853,11 @@ ParseArgs(GetFunc get, void *cl)
       *q = NULLCHAR;
       for (ad = argDescriptors; ad->argName != NULL; ad++)
        if (strcmp(ad->argName, argName + 1) == 0) break;
-      if (ad->argName == NULL)
-       ExitArgError("Unrecognized argument", argName);
-
+      if (ad->argName == NULL) {
+       ExitArgError("Unrecognized argument", 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
+       continue; // so that when it is in a settings file, it is the only setting that will be purged from it
+      }
     } else if (ch == '@') {
       /* Indirection file */
       ad = &argDescriptorIndirection;
@@ -877,7 +883,7 @@ ParseArgs(GetFunc get, void *cl)
 
     while (ch == ' ' || ch == '=' || ch == ':' || ch == '\t') ch = get(cl);
     if (ch == NULLCHAR || ch == '\n') {
-      ExitArgError("No value provided for argument", argName);
+      ExitArgError("No value provided for argument", argName, TRUE);
     }
     q = argValue;
     if (ch == '{') {
@@ -937,7 +943,7 @@ ParseArgs(GetFunc get, void *cl)
          ch = get(cl);
          switch (ch) {
          case NULLCHAR:
-           ExitArgError("Incomplete \\ escape in value for", argName);
+           ExitArgError("Incomplete \\ escape in value for", argName, TRUE);
            break;
          case 'n':
            *q++ = '\n';
@@ -1021,7 +1027,7 @@ ParseArgs(GetFunc get, void *cl)
        } else {
          if (ad->argLoc != NULL) {
          } else {
-           ExitArgError("Failed to open indirection file", argValue);
+           ExitArgError("Failed to open indirection file", argValue, TRUE);
          }
        }
       }
@@ -1038,7 +1044,7 @@ ParseArgs(GetFunc get, void *cl)
        *(Boolean *) ad->argLoc = FALSE;
        break;
       default:
-       ExitArgError("Unrecognized boolean argument value", argValue);
+       ExitArgError("Unrecognized boolean argument value", argValue, TRUE);
        break;
       }
       break;
@@ -1066,7 +1072,7 @@ ParseArgs(GetFunc get, void *cl)
       break;
 
     case ArgNone:
-      ExitArgError("Unrecognized argument", argValue);
+      ExitArgError("Unrecognized argument", argValue, TRUE);
       break;
     case ArgTwo:
     case ArgTrue: