int values[MAX_OPTIONS];
ChessProgramState *currentCps;
+char dataDir[MSG_SIZ] = DATADIR, manDir[MSG_SIZ] = MANDIR;
//----------------------------Generic dialog --------------------------------------------
if (errorExitStatus != -1) ExitEvent(errorExitStatus);
}
-static int
+int
ErrorOK (int n)
{
dialogError = errorUp = False;
void
DisplayHelp (char *name)
{
- char buf[MSG_SIZ];
+ static char *xboardMan;
+ char buf[MSG_SIZ], tidy[MSG_SIZ];
FILE *f;
- if(currentCps) snprintf(buf, MSG_SIZ, "/usr/local/share/man/man6/%s.6", currentCps->program);
- else snprintf(buf, MSG_SIZ, "%s/man6/xboard.6", MANDIR);
+ 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", 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", currentCps->program);
- f= fopen(buf, "r");
+ snprintf(buf, MSG_SIZ, "/usr/share/man/man6/%s.6", tidy);
+ f = fopen(buf, "r");
}
if(f) {
GetHelpText(f, name);