From: H.G.Muller Date: Fri, 11 Mar 2016 22:43:48 +0000 (+0100) Subject: Also try to get help for engine options X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=c4709fa28f09b91b7d36c17cce477b7b9b498e6e;p=xboard.git Also try to get help for engine options Help clicks in the Engine Settings dialogs will try to scan the man page of the corresponding engine for info about the option. This is a bit tricky, as it must assume the name of the engine is the same as that of the engine command and the manual for it is in section 6. In addition it must look in both /usr/share/man and /usr/local/share/man, as it cannot know whether the engine was installed from source or repo. Finally it must hope the man page isn't gzipped. --- diff --git a/dialogs.c b/dialogs.c index 6ecdcaf..d57b576 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2491,8 +2491,14 @@ GetHelpText (FILE *f, char *name) void DisplayHelp (char *name) { - char *manFile = MANDIR "/man6/xboard.6"; - FILE *f = fopen(manFile, "r"); + char buf[MSG_SIZ], *manFile = MANDIR "/man6/xboard.6"; + FILE *f; + if(currentCps) snprintf(manFile = buf, MSG_SIZ, "/usr/share/man/man6/%s.6", currentCps->program); + f = fopen(manFile, "r"); + if(!f && currentCps) { // engine manual could be in two places + snprintf(buf, MSG_SIZ, "/usr/man/man6/%s.6", currentCps->program); + f= fopen(buf, "r"); + } if(f) { GetHelpText(f, name); fclose(f);