From c4709fa28f09b91b7d36c17cce477b7b9b498e6e Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 11 Mar 2016 23:43:48 +0100 Subject: [PATCH] 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. --- dialogs.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) 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); -- 1.7.0.4