From: H.G.Muller Date: Tue, 15 Mar 2016 10:29:35 +0000 (+0100) Subject: Obtain name of XBoard's man file from external command X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=239acdb2f77698254f921427bf8b82a9923a3dfe;p=xboard.git 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". --- 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);