From: H.G.Muller Date: Thu, 17 Mar 2016 11:04:27 +0000 (+0100) Subject: Also provide help on adapter options X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6fff4162d772695af69d2c7c9486c8f17a5b0b45;p=xboard.git Also provide help on adapter options Adapters often add their own options to thoso of the engine in the Engine Settings dialog. Polyglot, for instance, has many options, their names all starting with "Polyglot ...". We adopt this as a convention, so that XBoard can compare the adapter name (the name of the program actually run, if that is different from the name of the engine binary) with the start of the option name for which help is requested. If there is a match it will conclude we are dealing with an adapter option, and will consult the adapter manual (for an option without the adapter-name prefix) instead of the engine manual. --- diff --git a/dialogs.c b/dialogs.c index 30b2ad5..e9a1718 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2503,7 +2503,7 @@ void DisplayHelp (char *name) { static char *xboardMan, *manText[2], tidy[MSG_SIZ], engMan[MSG_SIZ]; - char buf[MSG_SIZ], *eng; + char buf[MSG_SIZ], adapter[MSG_SIZ], *eng; int n = 0; FILE *f; if(!xboardMan) { @@ -2512,7 +2512,13 @@ DisplayHelp (char *name) } if(currentCps) { // for engine options we have to look in engine manual snprintf(buf, MSG_SIZ, "man -w "); // get (tidied) engine name in buf + TidyProgramName(currentCps->program, "localhost", adapter); // name of binary we are actually running TidyProgramName(currentCps == &first ? appData.firstChessProgram : appData.secondChessProgram, "localhost", buf+7); + if(strcmp(buf+7, adapter) && StrCaseStr(name, adapter) == name) { // option starts with name of apparent proxy for engine + safeStrCpy(buf+7, adapter, MSG_SIZ-7); // use adapter manual + name += strlen(adapter); // strip adapter name of option + while(*name == ' ') name++; + } if(strcmp(buf, tidy)) { // is different engine from last time FREE(manText[1]); manText[1] = NULL; // so any currently held text is worthless safeStrCpy(tidy, buf, MSG_SIZ); // remember current engine