Hi John,

oh, and a few more remarks:

John Gardner wrote on Mon, Jan 07, 2019 at 08:08:51PM +1100:

>    1. I want/need a way to programmatically (and *reliably*) locate the
>    directories containing a Groff installation's .tmac files.

Plural for good reasons.  There is no guarantee all tmac files are in
the same directory.

> $ 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

But this gives you only one directory, whereever an.tmac or tmac.an
is located.

That said, no need for the man -w actually:

   > GROFF_TMAC_PATH=`pwd` groff -Tutf8 -z -mtrace-paths -man /dev/null
  /opt/csw/lib/64/groff/site-tmac/an.tmac
  /opt/csw/share/groff/1.22.2/tmac/troffrc-end

> 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.

In that case, why not probe for the macros directly?
It doesn't matter where they are, or does it?

   > groff -man /dev/null > /dev/null ; echo $?
  0
   > groff -mfoo /dev/null > /dev/null ; echo $?
  gtroff: fatal error: can't find macro file foo
  1

Yours,
  Ingo

Reply via email to