On Wed, 23 Nov 2011 22:42:14 +0100, Glenn Fowler <[email protected]> wrote:


is there a groff undef macro or maybe a directive that
asserts "yes I really want to override"?

not that I know of (undef probably would just be an empty macro definition). but I believe I found the reason for the erroneous formatting: my guess is, the `man' macros are apparently loaded only on encountering the first call to an as yet undefined macro in the input, i.e. only _after_ all local macro definitions are already processed, namely when the `.TH' macro is called. therefore, the original .OP macro definition overrides the local one instead of the other way round.

solution (work around, at least): move the `.TH' macro call to the top of the file (or maybe there is another portable way to enforce loading of the man macros?). if one does this, the correct `nroff' formatting is obtained (which is still slightly different from the output of `myscript --man' but that does'nt matter). does this make sense?


On Wed, 23 Nov 2011 22:32:38 +0100 j. van den hoff wrote:
On Wed, 23 Nov 2011 22:12:31 +0100, Glenn Fowler <[email protected]>
wrote:

>
> looks like a groff version/installation difference
> could be in nroff itself or the -man macros
>
> works ok on redhadt linux and solaris (not groff based)
> fails like your description on suse and ubuntu
>
> at issue is the ast optget --nroff .OP definition
> maybe that conflicts with a -man directive in the installations that
> fail?

I investigated a bit more in the meantime. it looks like all redefinitions
of macros (SH, OP, etc.) which are generated by `myscript --nroff' are
ignored by `[ntg]roff -man': capturing `myscript --nroff' output in a file
and removing all troff macro definitions in this file leads to the same
"erroneous" output as described previously (actually it's not only the
missing paragraph breaks if one looks more closely). it is then especially
clear that the `.OP' macros don't generate paragraph breaks since the
corresponding OP macro in the groff `man' package (residing in
`an-ext.tmac') is, in usual manpages, used in the SYNOPSIS section for
listing all options in a single line.

I actually don't know, _why_ the redefinition is ignored: my understanding
is that the specified groff macro package is loaded first and, thus, the
redefinition in the file should overwrite the original definition. maybe
the groff maintainers should be contacted for clarification. if need be I
could do this (might need a bit time, though).

>
> On Wed, 23 Nov 2011 21:19:21 +0100 j. van den hoff wrote:
>> hi,
>
>> I'm trying to come to terms with the details of `getopts'. I managed to
>> get a correctly formatted manpage via
>
>> myscript --man
>
>> however, using
>
>> myscript --nroff 2>&1 |nroff -man
>
>> does not generate the same formatting. rather, line breaks (or, rather,
>> paragraph breaks) between option descriptions are missing, i.e. the
>> second
>> option description starts somewhere in the middle of a line immediately
>> after the end of the previous option description (I'm using groff
>> version
>> 1.21.).
>
>> I looked at the `--nroff' output generated `getopts', but do not
>> remember
>> enough troff to modfiy the `.OP' macro quickly.
>
>> question: how can I enforce correctly formatted nroff -man output (or
>> troff, for that matter, in order to generate pdf-versions of the
>> manpage)?
>
>> thanks,
>
>> joerg
>
>> --
>> Using Opera's revolutionary email client: http://www.opera.com/mail/
>> _______________________________________________
>> ast-users mailing list
>> [email protected]
>> https://mailman.research.att.com/mailman/listinfo/ast-users
>

--
Using Opera's revolutionary email client: http://www.opera.com/mail/



--
Using Opera's revolutionary email client: http://www.opera.com/mail/
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to