History log of /openbsd/usr.bin/mandoc/man_macro.c (Results 1 – 25 of 111)
Revision Date Author Comments
# 84680f53 13-Nov-2023 schwarze <schwarze@openbsd.org>

Reduce the man(7) default global indentation from 7n, which was an oddity
in groff-1.01 to groff-1.22.4, to 5n for compatibility with Version 7 AT&T
UNIX, 4.3BSD-Reno, groff-1.23.0, and all versions

Reduce the man(7) default global indentation from 7n, which was an oddity
in groff-1.01 to groff-1.22.4, to 5n for compatibility with Version 7 AT&T
UNIX, 4.3BSD-Reno, groff-1.23.0, and all versions of mdoc(7).
OK jmc@ millert@

show more ...


# f6697133 24-Oct-2023 schwarze <schwarze@openbsd.org>

Implement the man(7) .MR macro, a 2023 GNU extension.
The syntax and semantics is almost identical to mdoc(7) .Xr.

This will be needed for reading the groff manual pages once our port
will be update

Implement the man(7) .MR macro, a 2023 GNU extension.
The syntax and semantics is almost identical to mdoc(7) .Xr.

This will be needed for reading the groff manual pages once our port
will be updated to 1.23, and the Linux Manual Pages Project is also
determined to start using it sooner or later. I did not advocate for
this new macro, but since we want to remain able to read all manual
pages found in the wild, there is little choice but to support it.
At least it is easy to do, they basically copied .Xr.

show more ...


# 1ad7d38c 27-Apr-2022 schwarze <schwarze@openbsd.org>

The .AT, .DT, and .UC macros are allowed inside next-line scope
and never produce output at the place of their invocation.

Minibugs found while investigating unrelated afl(1) reports from tb@.


# 6369db70 13-Apr-2022 schwarze <schwarze@openbsd.org>

Do not die on an assertion if an input file contains no section
whatsoever and ends with a broken next-line scope. Obviously, this
cannot happen in a real manual page, but mandoc(1) should not die
e

Do not die on an assertion if an input file contains no section
whatsoever and ends with a broken next-line scope. Obviously, this
cannot happen in a real manual page, but mandoc(1) should not die
even when fed absurd input.

This bug was independently reported by both jsg@ and tb@ who both
found it with afl(1).

show more ...


# 08821f0d 09-Sep-2020 schwarze <schwarze@openbsd.org>

Element next-line scopes can nest. Consequently, even when closing
one element next-line scope, the MAN_ELINE flag must not yet be
cleared if the parent macro is another element macro having next-li

Element next-line scopes can nest. Consequently, even when closing
one element next-line scope, the MAN_ELINE flag must not yet be
cleared if the parent macro is another element macro having next-line
scope, or an assertion failure is caused if all this is wrapped in
another macro that has block next-line scope, for example .TP.
Bug found in an afl run performed by Jan Schreiber <jes at posteo dot de>.

show more ...


# 5c01bbd0 05-Jan-2019 schwarze <schwarze@openbsd.org>

In HTML output, man(7) .RS blocks get formatted as <div class="Bd-indent">,
and i can see no reasonable alternative: they do indeed represent indented
displays. They certainly require flow context a

In HTML output, man(7) .RS blocks get formatted as <div class="Bd-indent">,
and i can see no reasonable alternative: they do indeed represent indented
displays. They certainly require flow context and make no sense in phrasing
context. Consequently, they have to suspend no-fill mode during their head,
in just the same way as other paragraph-type macros do it.

This fixes HTML syntax errors that resulted from .nf followed by .RS.

show more ...


# 94a3c318 05-Jan-2019 schwarze <schwarze@openbsd.org>

Some high-level block macros have an effect similar to temporarily
suspending no-fill mode during their head. Model this with an
additional roff parser state flag ROFF_NONOFILL. That is much
simple

Some high-level block macros have an effect similar to temporarily
suspending no-fill mode during their head. Model this with an
additional roff parser state flag ROFF_NONOFILL. That is much
simpler than it would be to save and restore the ROFF_NOFILL flag
itself, in particular since the latter can be switched (with lasting
effect) by the .nf and .fi requests even while its effect is
temporarily suspended.

This commit does not change formatting yet, but prepares for future
formatting simplifications and improvements.

show more ...


# 542a495f 31-Dec-2018 schwarze <schwarze@openbsd.org>

Cleanup, no functional change:
Since the man(7) and roff(7) validators no longer use the parser
state flag ROFF_NOFILL, we can finally get rid of the function
man_state(), resulting in a better separ

Cleanup, no functional change:
Since the man(7) and roff(7) validators no longer use the parser
state flag ROFF_NOFILL, we can finally get rid of the function
man_state(), resulting in a better separation of parsing and validation.

show more ...


# be32d3bd 31-Dec-2018 schwarze <schwarze@openbsd.org>

For .EX and .EE, set the fill mode parser state directly in the
macro parsing function, in the same way as the roff parser already
does it for the .nf and .fi requests. This is a preparation for
get

For .EX and .EE, set the fill mode parser state directly in the
macro parsing function, in the same way as the roff parser already
does it for the .nf and .fi requests. This is a preparation for
getting rid of the ugly function man_state() later on.

show more ...


# 0438bfdf 31-Dec-2018 schwarze <schwarze@openbsd.org>

Move parsing of the .nf and .fi (fill mode) requests from the man(7)
parser to the roff(7) parser. As a side effect, .nf and .fi are
now also parsed in mdoc(7) input, though the mdoc(7) formatters
s

Move parsing of the .nf and .fi (fill mode) requests from the man(7)
parser to the roff(7) parser. As a side effect, .nf and .fi are
now also parsed in mdoc(7) input, though the mdoc(7) formatters
still ignore most of their effect.

show more ...


# 83d65a5a 31-Dec-2018 schwarze <schwarze@openbsd.org>

Cleanup, minus 15 LOC, no functional change:
Simplify the way the man(7) and mdoc(7) validators are called.
Reset the parser state with a common function before calling them.
There is no need to agai

Cleanup, minus 15 LOC, no functional change:
Simplify the way the man(7) and mdoc(7) validators are called.
Reset the parser state with a common function before calling them.
There is no need to again reset the parser state afterwards,
the parsers are no longer used after validation.
This allows getting rid of man_node_validate() and mdoc_node_validate()
as separate functions.

show more ...


# 6b86842e 30-Dec-2018 schwarze <schwarze@openbsd.org>

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results. Move the public results to the
parsing result struct roff_meta, whic

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results. Move the public results to the
parsing result struct roff_meta, which is already public. Move the
rest of struct roff_man to the parser-internal header roff_int.h.

Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.

This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.

show more ...


# e94357f9 21-Dec-2018 schwarze <schwarze@openbsd.org>

Rename mandoc_getarg() to roff_getarg() and pass it the roff parser
struct as an argument such that after copy-in, it can call roff_expand()
once again, which used to be called roff_res() before this

Rename mandoc_getarg() to roff_getarg() and pass it the roff parser
struct as an argument such that after copy-in, it can call roff_expand()
once again, which used to be called roff_res() before this. This
fixes a subtle low-level roff(7) parsing bug reported by Fabio
Scotoni <fabio at esse dot ch> in the 4.4BSD-Lite2 mdoc.samples(7)
manual page, because that page used an escaped escape sequence in
a macro argument.

To expand escaped escape sequences in quoted mdoc(7) arguments, too,
stop bypassing the call to roff_getarg() in mdoc_argv.c, function args()
for this case. This does not solve the case of escaped escape sequences
in quoted .Bl -column phrases yet.

Because roff_expand() can make the string longer, roff_getarg() can no
longer operate in-place but needs to malloc(3) the returned string.
In the high-level parsers, free(3) that string after processing it.

show more ...


# 91305757 14-Dec-2018 schwarze <schwarze@openbsd.org>

Cleanup, no functional change:
Now that message handling is properly encapsulated,
remove struct mparse pointers from four structs (roff, roff_man,
tbl_node, eqn_node) and from the argument lists of

Cleanup, no functional change:
Now that message handling is properly encapsulated,
remove struct mparse pointers from four structs (roff, roff_man,
tbl_node, eqn_node) and from the argument lists of five functions
(roff_alloc, roff_man_alloc, mandoc_getarg, tbl_alloc, eqn_alloc).
Except for being passed to the main program as an opaque object,
it now only occurs in read.c, as it should, and not across 15 files
like in the past.

show more ...


# a5a5f808 14-Dec-2018 schwarze <schwarze@openbsd.org>

Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version: There is r

Almost mechanical diff to remove the "struct mparse *" argument
from mandoc_msg(), where it is no longer used.
While here, rename mandoc_vmsg() to mandoc_msg() and retire the
old version: There is really no point in having another function
merely to save "%s" in a few places.
Minus 140 lines of code.

show more ...


# e501e731 14-Dec-2018 schwarze <schwarze@openbsd.org>

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback. It was over-engineered from the start, never used

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback. It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.

show more ...


# 63f82d49 26-Aug-2018 schwarze <schwarze@openbsd.org>

Support nesting of elements with next-line scope.
For example, ksh93(1) needs this for .B\n.SM.


# ce96ce1a 18-Aug-2018 schwarze <schwarze@openbsd.org>

paragraphs can contain .MT and .UR blocks


# bb7bc875 18-Aug-2018 schwarze <schwarze@openbsd.org>

.RE causes a line break even if .RS is not open


# b1e77ba0 18-Aug-2018 schwarze <schwarze@openbsd.org>

end of sentence detection after .ME and .UE, useful for some GNU manuals


# 08d1df32 18-Aug-2018 schwarze <schwarze@openbsd.org>

Two consecutive .SY blocks only get a blank line in between
if the first one is explicitly closed with .YS.


# 5e5a9c61 18-Aug-2018 schwarze <schwarze@openbsd.org>

implement the GNU man-ext .SY/.YS (synopsis block) macro in man,
used in most manual pages of the groff package


# 16fe0cfc 17-Aug-2018 schwarze <schwarze@openbsd.org>

Remove more pointer arithmetic passing via regions outside the array
that is undefined according to the C standard. Robert Elz <kre at
munnari dot oz dot au> pointed out i wasn't quite done yet.


# d991fc2c 16-Aug-2018 schwarze <schwarze@openbsd.org>

implement the GNU man-ext .TQ macro in man(7),
used for example by groff_diff(7)


# 3ae439c0 15-Aug-2018 schwarze <schwarze@openbsd.org>

fix incomplete variable renaming in previous;
found by Thomas Klausner <wiz at NetBSD> via a compiler warning


12345