XBoard interactive help

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard interactive help

Post by JoshPettus »

Should I put the man file as /usr/local/man/man6/fairymax.6? or will it find fmax.man in the engine directory?
[EDIT]
neither seem to work..hmm..
User avatar
hgm
Posts: 28390
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard interactive help

Post by hgm »

What if you put it in the same directory as the xboard man file?
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard interactive help

Post by JoshPettus »

interesting, it finds it! So the system usr man directory isn't part of the search?
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard interactive help

Post by JoshPettus »

I just realized, that this can't be some random behavior of man, but this all must be by design from gtk. I use a special gtk2 installation meant for use in app bundles. That way gtk can find it's own localization files in the bundle rather then search the system. I bet the gtk man file was suppose to be used in this way as well. This also explains why man -w xboard didn't work when I launched the executable directly, (as oppose to launching the app normally). Directly means that the OS doesn't send whatever signal gtk uses to find these resources, so it fails.

If this is really the case then getting the man page from "man -f executable" is fine because gtk made it so.

As a result though, it won't scan the system for man files anyway, which could be a pain for makefile installed engines. I guess recursively checking the engine folder (in case it's in some sub folder called data or such) is our best option.
User avatar
hgm
Posts: 28390
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard interactive help

Post by hgm »

I think it should work in any case for manuals that are installed in a compliant way.

It seems the man command is a bit more complex than I imagined. It makes use of an 'index database', rather than just searching for files of the given name. This is probably why it can find 'maxqi'. After copying a man page to the appropriate place in the $(mandir) tree, you are supposed to run the 'mandb' command to notice the new page and add it to the database. Fairy-Max' make install does not do that, possibly explaining why it couldnot find the fairymax page.

There also is an environment variable $MANOPT that supplies extra options to 'man'.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard interactive help

Post by JoshPettus »

I think apple may have crippled a few of these commands for their own technologies. locate uses a /var/db/locate.database instead of the index database and is disabled by default and there is no mandb command...
User avatar
hgm
Posts: 28390
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard interactive help

Post by hgm »

Well, that would explain why it needs so much time to do the initial "man -w xboard". Without index database it would have to search the entire man sub tree.

Nevertheless, for standard commands, and for compliantly installed engines, the man command should work from a terminal. If it doesn't work when called from XBoard, it must be because some environment variables (like $MANOPT) overrule the normal search path. But there are option that mahe it ignore such overrules, and XBoard could call it with those to find the same man pages as it would find when run from the command line.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard interactive help

Post by JoshPettus »

oh good, that sounds fine
User avatar
hgm
Posts: 28390
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard interactive help

Post by hgm »

What happens when you replace in the following code in DisplayHelp()

Code: Select all

if(currentCps) { // for engine options we have to look in engine manual
	snprintf(tidy, MSG_SIZ, "man -w ");
	TidyProgramName(currentCps == &first ? appData.firstChessProgram : appData.secondChessProgram, "localhost", tidy+7);
	eng = BufferCommandOutput(tidy, MSG_SIZ);
	safeStrCpy(buf, eng, strlen(eng));
	FREE(eng);
	n = 1;
"man -w " by "man -D -w"? Can it find the engine manuals in the standard place, then? You could put

DisplayNote(eng);
return;

just before the FREE to see what it found.
User avatar
hgm
Posts: 28390
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard interactive help

Post by hgm »

I updated Fairy-Max' man page so that all options have an individual item. And I pushed an XBoard patch that will recognize the item headers in man files produced through pod2man. This should make all help clicks on Fairy-Max' Engine Settings dialog provide sensible info.