From 239acdb2f77698254f921427bf8b82a9923a3dfe Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Tue, 15 Mar 2016 11:29:35 +0100 Subject: [PATCH] Obtain name of XBoard's man file from external command Rather than hard-coding the path to the man file, it is now obtained by running "man -w xboard". --- dialogs.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/dialogs.c b/dialogs.c index 430f179..191061c 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2492,12 +2492,17 @@ GetHelpText (FILE *f, char *name) void DisplayHelp (char *name) { + static char *xboardMan; char buf[MSG_SIZ], tidy[MSG_SIZ]; FILE *f; + if(!xboardMan) { + xboardMan = BufferCommandOutput("man -w xboard", MSG_SIZ); // obtain path to XBoard's man file + if(xboardMan) xboardMan[strlen(xboardMan)-1] = NULLCHAR; // strip off traling linefeed + } if(currentCps) { TidyProgramName(currentCps == &first ? appData.firstChessProgram : appData.secondChessProgram, "localhost", tidy); snprintf(buf, MSG_SIZ, "/usr/local/share/man/man6/%s.6", tidy); - } else snprintf(buf, MSG_SIZ, "%s/man6/xboard.6", manDir); + } else snprintf(buf, MSG_SIZ, "%s", xboardMan); f = fopen(buf, "r"); if(!f && currentCps) { // engine manual could be in two places snprintf(buf, MSG_SIZ, "/usr/share/man/man6/%s.6", tidy); -- 1.7.0.4