X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=args.h;h=3e376e57e5ca80ad96ea1d06ff3af16737389982;hb=v4.9.x;hp=8b8fe8e5f032ad465c4fee0028bbad0778d8a245;hpb=ef1f358174b72b25b801eb18e95754a1b8065165;p=xboard.git diff --git a/args.h b/args.h index 8b8fe8e..3e376e5 100644 --- a/args.h +++ b/args.h @@ -112,6 +112,8 @@ char *firstEngineLine; char *secondEngineLine; char *icsNick; char *theme; +char *replace; +char *engineListFile; void EnsureOnScreen(int *x, int *y, int minX, int minY); char StringGet(void *getClosure); @@ -223,7 +225,7 @@ ArgDescriptor argDescriptors[] = { { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE }, { "pieceImageDirectory", ArgFilename, (void *) &appData.pieceDirectory, TRUE, (ArgIniType) "" }, { "pid", ArgFilename, (void *) &appData.pieceDirectory, FALSE, INVALID }, - { "trueColors", ArgBoolean, (void *) &appData.trueColors, TRUE, (ArgIniType) FALSE }, + { "trueColors", ArgBoolean, (void *) &appData.trueColors, XBOARD, (ArgIniType) (2*!XBOARD) }, { "jewelled", ArgInt, (void *) &appData.jewelled, FALSE, (ArgIniType) -1 }, { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" }, { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY }, @@ -517,6 +519,7 @@ ArgDescriptor argDescriptors[] = { { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames, !XBOARD, (ArgIniType) SCP_NAMES }, { "themeNames", ArgString, (void *) &appData.themeNames, TRUE, (ArgIniType) "native -upf false -ub false -ubt false -pid \"\"\n" }, + { "engineList", ArgFilename, (void *) &engineListFile, TRUE, (ArgIniType) "" }, { "addMasterOption", ArgMaster, NULL, FALSE, INVALID }, { "installEngine", ArgInstall, (void *) &firstChessProgramNames, FALSE, (ArgIniType) "" }, { "installTheme", ArgInstall, (void *) &appData.themeNames, FALSE, (ArgIniType) "" }, @@ -535,6 +538,7 @@ ArgDescriptor argDescriptors[] = { { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE }, { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE }, { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE }, + { "pgnTimeLeft", ArgBoolean, (void *) &appData.cumulativeTimePGN, TRUE, (ArgIniType) FALSE }, { "liteBackTextureFile", ArgFilename, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" }, { "lbtf", ArgFilename, (void *) &appData.liteBackTextureFile, FALSE, INVALID }, { "darkBackTextureFile", ArgFilename, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" }, @@ -616,7 +620,12 @@ ArgDescriptor argDescriptors[] = { { "epd", ArgTrue, (void *) &appData.epd, FALSE, INVALID }, { "inscriptions", ArgString, (void *) &appData.inscriptions, FALSE, (ArgIniType) "" }, { "autoInstall", ArgString, (void *) &appData.autoInstall, XBOARD, (ArgIniType) "" }, + { "replace", ArgString, (void *) &replace, FALSE, (ArgIniType) NULL }, { "fixedSize", ArgBoolean, (void *) &appData.fixedSize, TRUE, (ArgIniType) FALSE }, + { "showMoveTime", ArgBoolean, (void *) &appData.moveTime, TRUE, (ArgIniType) FALSE }, + { "bmpSave", ArgInt, (void *) &appData.bmpSave, FALSE, 0 }, + { "defaultEngineInstallDir", ArgFilename, (void *) &appData.defEngDir, FALSE, (ArgIniType) "." }, + { "defaultInstallProtocol", ArgInt, (void *) &appData.defProtocol, TRUE, (ArgIniType) 0 }, // [HGM] tournament options { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" }, @@ -1180,6 +1189,11 @@ ParseArgs(GetFunc get, void *cl) ASSIGN(*(char **) ad->argLoc, buf); break; } + if(replace) { // previous -replace option makes this string option conditional + int differs = strcmp(*(char**) ad->argLoc, (char*) replace); + free(replace); replace = NULL; // but expires in the process + if(differs) break; // only use to replace the given string + } ASSIGN(*(char **) ad->argLoc, argValue); break; @@ -1251,10 +1265,10 @@ ParseArgs(GetFunc get, void *cl) if(r) { // must be put in group r char *p = strstr(q, r); if(p) { // group already exists - p += strlen(r); // determine insertion point (immediately after group header line) + p += strlen(r) - 1; // determine insertion point (immediately after group header line) *(char **) ad->argLoc = malloc(l+2); *p++ = NULLCHAR; // spit old value (q) at insertion point into q and p - snprintf(*(char **) ad->argLoc, l+2, "%s%s\n%s", q, s, p); // insert (with newline) + snprintf(*(char **) ad->argLoc, l+2, "%s\n%s\n%s", q, s, p); // insert (with newline) } else { // group did not exist, create at end l += strlen(r) + 8; *(char **) ad->argLoc = malloc(l); @@ -1426,6 +1440,14 @@ InitAppData(char *lpCmdLine) /* Parse command line */ ParseArgs(StringGet, &lpCmdLine); + /* if separate engine list is used, parse that too */ + if(*engineListFile) { + char buf[MSG_SIZ]; + MySearchPath(installDir, engineListFile, buf); + if(*buf) { ASSIGN(engineListFile, buf); } + ParseSettingsFile(engineListFile, &engineListFile); + } + if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions); if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions); chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);