[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [groff] Rate this hack on a scale of 0 to stupid

From: John Gardner
Subject: Re: [groff] Rate this hack on a scale of 0 to stupid
Date: Mon, 7 Jan 2019 21:21:57 +1100

Hi Ingo,

Thanks for taking the time to check! Ugh, I wasn't aware Solaris was using
DocBook/XML... yuck.

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

Yes, I realised that only after I sent the original e-mail, haha. Even
passing a dummy man-page would have been smarter than shelling out to

*> But this gives you only one directory whereever an.tmac or
<> is located.*

Yes, I only need the top-most directory containing the tmac files. Its
contents will be recursively scanned, following symlinks (carefully) when
necessary. It's still hit-and-miss, but it should cover the most important
macros (the core packages, and the ones shipped with Groff which contain
PDF-specific features, used by the <canvas> renderer).

*> In that case, why not probe for the macros directly?*

Well, that would work only for the obvious/known packages (an.tmac,
doc.tmac, etc). But it won't do any good for .tmac files that aren't known
ahead of time to be installed. This could be an issue with future releases
of Groff, or installations with tampered .tmac lists (such as if a naïve
user added custom tmac files in the default directory, instead of a
userland directory).

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

Yup. That's definitely something I'm preparing for. ;-)

On Mon, 7 Jan 2019 at 20:58, Ingo Schwarze <address@hidden> wrote:

> Hi John,
> John Gardner wrote on Mon, Jan 07, 2019 at 08:08:51PM +1100:
> > $ GROFF_TMAC_PATH=`pwd` groff -Tutf8 -z -mtrace-paths -man `man -w man`
> > Now, tell me. How could this trick go wrong...?
>    > uname -a
>   SunOS unstable11s 5.11 11.3 sun4u sparc SUNW,SPARC-Enterprise
>    > man -w man
>   usage:  man [-] [-adFlprt] [-M path] [-T macro-package ]
>                   [ -s section ] name ...
>           man [-M path] [-s section] -k keyword ...
>           man [-M path] -f file ...
>           man [-M path] [-s section] -K keyword ...
>    > GROFF_TMAC_PATH=`pwd` groff -Tutf8 -z -mtrace-paths -man
>                                  /usr/share/man/man1/man.1
>   /usr/share/groff/1.22.2/tmac/an.tmac
>   /usr/share/groff/1.22.2/tmac/troffrc-end
>   /usr/share/man/man1/man.1
>    > uname -a
>   SunOS unstable9s 5.9 Generic_Virtual sun4u sparc
> SUNW,SPARC-Enterprise-T5220
>    > man -w man
>   usage:  man [-] [-adFlrt] [-M path] [-T macro-package ]
>                   [ -s section ] name ...
>           man [-M path] -k keyword ...
>           man [-M path] -f file ...
>    > GROFF_TMAC_PATH=`pwd` groff -Tutf8 -z -mtrace-paths -man
> /usr/man/man1/cc.1
>   /opt/csw/lib/groff/site-tmac/an.tmac
>   /opt/csw/share/groff/1.21/tmac/troffrc-end
>   /usr/man/man1/cc.1
>    > find /usr -name man.1
>   /usr/share/man/sman1/man.1
>    > head -n 2 /usr/man/sman1/man.1
>   <!DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD
>       DocBook V3.0-Based SolBook Subset V2.0//EN" [
>   <!--ArborText, Inc., 1988-1999, v.4002-->
> Yes, that Solaris system provides the man(1) manual as a DocBook
> document only, and it appears man(1) somehow formats that.
> But your hack works, except that man(1) has no -w option.
> Yours,
>   Ingo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]