First, the situation: 1. I want/need a way to programmatically (and *reliably*) locate the directories containing a Groff installation's .tmac files. This is happening in JavaScript, without the user's intervention. 2. I don't want to make assumptions about standard tmac locations like /usr/share/groff/tmac, et al. 3. The containing directories are scooped up by Roff.js and scanned for `.tmac` files, which is a preparatory step to determine what macros are available and which aren't.
Second, the idiotic hack I wrote: $ cat trace-paths.tmac 'de P 'nf 'tm \\n(.F 'it 1 P 'nx .. 'it 1 P 'cc ! Third, the aforementioned hack somehow working: $ GROFF_TMAC_PATH=`pwd` groff -Tutf8 -z -mtrace-paths -man `man -w man` /usr/share/groff/1.19.2/tmac/an.tmac /usr/share/groff/1.19.2/tmac/troffrc-end /usr/share/man/man1/man.1 Now, tell me. How could this trick go wrong...? Bear in mind that: - This is a last resort because I couldn't find any obvious/easy way to locate a site's default tmac directories without making assumptions about standard paths, - I'd like this to work on Windows <http://gnuwin32.sourceforge.net/packages/groff.htm> (*without* Cygwin), - It's assumed that a site's `man` installation will always have its own manpage (hence the `man -w man` usage), - It's also similarly assumed that every Groff installation will have `an.tmac` available. Hence why it's being used to pinpoint the containing directory. That's all. You're all welcome to laugh now. =) — John