OpenBSD CVS

CVS log for src/usr.bin/mandoc/man_macro.c


[BACK] Up to [local] / src / usr.bin / mandoc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.111 / (download) - annotate - [select for diffs], Mon Nov 13 19:13:00 2023 UTC (6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.110: +2 -2 lines
Diff to previous 1.110 (colored)

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@

Revision 1.110 / (download) - annotate - [select for diffs], Tue Oct 24 20:30:49 2023 UTC (6 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.109: +2 -1 lines
Diff to previous 1.109 (colored)

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.

Revision 1.109 / (download) - annotate - [select for diffs], Wed Apr 27 17:04:15 2022 UTC (2 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.108: +4 -4 lines
Diff to previous 1.108 (colored)

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

Revision 1.108 / (download) - annotate - [select for diffs], Wed Apr 13 14:37:34 2022 UTC (2 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.107: +4 -3 lines
Diff to previous 1.107 (colored)

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

Revision 1.107 / (download) - annotate - [select for diffs], Wed Sep 9 16:57:05 2020 UTC (3 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.106: +7 -5 lines
Diff to previous 1.106 (colored)

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

Revision 1.106 / (download) - annotate - [select for diffs], Sat Jan 5 18:59:37 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.105: +5 -2 lines
Diff to previous 1.105 (colored)

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.

Revision 1.105 / (download) - annotate - [select for diffs], Sat Jan 5 00:36:46 2019 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +4 -2 lines
Diff to previous 1.104 (colored)

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.

Revision 1.104 / (download) - annotate - [select for diffs], Mon Dec 31 10:03:38 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.103: +2 -2 lines
Diff to previous 1.103 (colored)

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.

Revision 1.103 / (download) - annotate - [select for diffs], Mon Dec 31 08:03:34 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +6 -1 lines
Diff to previous 1.102 (colored)

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.

Revision 1.102 / (download) - annotate - [select for diffs], Mon Dec 31 07:07:43 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +4 -11 lines
Diff to previous 1.101 (colored)

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.

Revision 1.101 / (download) - annotate - [select for diffs], Mon Dec 31 04:55:42 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +1 -3 lines
Diff to previous 1.100 (colored)

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.

Revision 1.100 / (download) - annotate - [select for diffs], Sun Dec 30 00:48:47 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +2 -2 lines
Diff to previous 1.99 (colored)

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.

Revision 1.99 / (download) - annotate - [select for diffs], Fri Dec 21 16:58:49 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +13 -7 lines
Diff to previous 1.98 (colored)

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.

Revision 1.98 / (download) - annotate - [select for diffs], Fri Dec 14 06:33:03 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

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.

Revision 1.97 / (download) - annotate - [select for diffs], Fri Dec 14 05:17:45 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +15 -17 lines
Diff to previous 1.96 (colored)

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.

Revision 1.96 / (download) - annotate - [select for diffs], Fri Dec 14 01:17:46 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +2 -1 lines
Diff to previous 1.95 (colored)

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.

Revision 1.95 / (download) - annotate - [select for diffs], Sun Aug 26 16:18:38 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.94: +37 -32 lines
Diff to previous 1.94 (colored)

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

Revision 1.94 / (download) - annotate - [select for diffs], Sat Aug 18 20:41:50 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +3 -2 lines
Diff to previous 1.93 (colored)

paragraphs can contain .MT and .UR blocks

Revision 1.93 / (download) - annotate - [select for diffs], Sat Aug 18 17:32:06 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +7 -1 lines
Diff to previous 1.92 (colored)

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

Revision 1.92 / (download) - annotate - [select for diffs], Sat Aug 18 15:12:09 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.91: +3 -1 lines
Diff to previous 1.91 (colored)

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

Revision 1.91 / (download) - annotate - [select for diffs], Sat Aug 18 14:02:52 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +9 -2 lines
Diff to previous 1.90 (colored)

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

Revision 1.90 / (download) - annotate - [select for diffs], Sat Aug 18 02:03:41 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +6 -1 lines
Diff to previous 1.89 (colored)

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

Revision 1.89 / (download) - annotate - [select for diffs], Fri Aug 17 20:31:52 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +16 -10 lines
Diff to previous 1.88 (colored)

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.

Revision 1.88 / (download) - annotate - [select for diffs], Thu Aug 16 23:40:19 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +3 -2 lines
Diff to previous 1.87 (colored)

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

Revision 1.87 / (download) - annotate - [select for diffs], Wed Aug 15 15:36:11 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +2 -2 lines
Diff to previous 1.86 (colored)

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

Revision 1.86 / (download) - annotate - [select for diffs], Tue Aug 14 01:26:12 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +27 -20 lines
Diff to previous 1.85 (colored)

support tail arguments on the .ME and .UE macros,
used for example in the ditroff(7) manual of the groff package

Revision 1.85 / (download) - annotate - [select for diffs], Sun Jun 25 07:23:53 2017 UTC (6 years, 10 months ago) by bentley
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.84: +6 -1 lines
Diff to previous 1.84 (colored)

Add support for the MT and ME mailto macros, used for example in wg(8).

feedback and ok schwarze@

Revision 1.84 / (download) - annotate - [select for diffs], Sat Jun 17 16:47:29 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

if .in is used inside the .TP head, it's always relative

Revision 1.83 / (download) - annotate - [select for diffs], Tue Jun 13 19:33:24 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +15 -2 lines
Diff to previous 1.82 (colored)

Partial support for the \n[an-margin] number register.

Manuals autogenerated from reStructuredText are reckless enough
to peek at this non-portable, implementation-dependent, highly
groff-specific internal register - for no good reason, because the
man(7) language natively provides in a much simpler way what they
are trying to emulate here with much fragility.

A full implementation would be very hard because it would require
access to output-device-specific formatting data at the roff(7)
preprocessor stage, which mandoc doesn't support at all.
So hardcode a few magic numbers as reStructuredText expects them
for terminal output.  For other output modes (like HTML), code using
this register is utterly broken anyway.

Revision 1.82 / (download) - annotate - [select for diffs], Fri May 5 15:16:25 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.81: +2 -4 lines
Diff to previous 1.81 (colored)

Move .sp to the roff modules.  Enough infrastructure is in place
now that this actually saves code: -70 LOC.

Revision 1.81 / (download) - annotate - [select for diffs], Fri May 5 13:17:04 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.80: +1 -2 lines
Diff to previous 1.80 (colored)

move .ll to the roff modules

Revision 1.80 / (download) - annotate - [select for diffs], Fri May 5 02:06:17 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.79: +2 -3 lines
Diff to previous 1.79 (colored)

Move handling of the roff(7) .ft request from the man(7)
modules to the new roff(7) modules.  As a side effect,
mdoc(7) now handles .ft, too.  Of course, do not use that.

Revision 1.79 / (download) - annotate - [select for diffs], Thu May 4 17:48:24 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.78: +2 -4 lines
Diff to previous 1.78 (colored)

Parser reorg:
Generate the first node on the roff level: .br
Fix some column numbers in diagnostic messages while here.

Revision 1.78 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:09 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.77: +15 -18 lines
Diff to previous 1.77 (colored)

Continue parser unification:
* Make enum rofft an internal interface as enum roff_tok in "roff.h".
* Represent mdoc and man macros in enum roff_tok.
* Make TOKEN_NONE a proper enum value and use it throughout.
* Put the prologue macros first in the macro tables.
* Unify mdoc_macroname[] and man_macroname[] into roff_name[].

Revision 1.77 / (download) - annotate - [select for diffs], Tue Jan 10 13:46:53 2017 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.76: +6 -6 lines
Diff to previous 1.76 (colored)

unify names of AST node flags; no change of cpp output

Revision 1.76 / (download) - annotate - [select for diffs], Fri Jan 8 17:48:04 2016 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a
tiny loop - not only making data smaller, but code shorter as well.

This gets rid of an implicit invariant that confused both static
analysis tools and human auditors.  No functional change.

Revision 1.75 / (download) - annotate - [select for diffs], Thu Oct 22 21:53:49 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +5 -19 lines
Diff to previous 1.74 (colored)

move man(7) validation into the dedicated validation phase, too

Revision 1.74 / (download) - annotate - [select for diffs], Tue Oct 6 18:30:43 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +3 -3 lines
Diff to previous 1.73 (colored)

modernize style: "return" is not a function; ok cmp(1)

Revision 1.73 / (download) - annotate - [select for diffs], Sat Sep 26 00:53:15 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +1 -2 lines
Diff to previous 1.72 (colored)

/* NOTREACHED */ after abort() is silly, delete it

Revision 1.72 / (download) - annotate - [select for diffs], Fri Sep 4 21:24:26 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +3 -3 lines
Diff to previous 1.71 (colored)

Fill mode changes don't break next-line scope in all cases,
in particular not for tagged paragraphs.
Issue found by Christian Neukirchen <chneukirchen at gmail dot com>
in the exiv2(1) manual page.

Revision 1.71 / (download) - annotate - [select for diffs], Thu Apr 23 15:35:39 2015 UTC (9 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.70: +2 -3 lines
Diff to previous 1.70 (colored)

Get rid of two empty wrapper functions.  No functional change.

Revision 1.70 / (download) - annotate - [select for diffs], Sun Apr 19 14:57:16 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.69: +4 -5 lines
Diff to previous 1.69 (colored)

Unify trickier node handling functions.
* man_elem_alloc() -> roff_elem_alloc()
* man_block_alloc() -> roff_block_alloc()
The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for
now because they need to do mdoc(7)-specific argument processing.

Revision 1.69 / (download) - annotate - [select for diffs], Sun Apr 19 14:25:05 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.68: +5 -5 lines
Diff to previous 1.68 (colored)

Unify some node handling functions that use TOKEN_NONE.
* mdoc_word_alloc(), man_word_alloc() -> roff_word_alloc()
* mdoc_word_append(), man_word_append() -> roff_word_append()
* mdoc_addspan(), man_addspan() -> roff_addtbl()
* mdoc_addeqn(), man_addeqn() -> roff_addeqn()
Minus 50 lines of code, no functional change.

Revision 1.68 / (download) - annotate - [select for diffs], Sun Apr 19 13:50:10 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.67: +9 -7 lines
Diff to previous 1.67 (colored)

Unify node handling functions:
* node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc()
* node_append() for mdoc and man_node_append() -> roff_node_append()
* mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc()
* mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc()
* mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink()
* mdoc_node_free() and man_node_free() -> roff_node_free()
* mdoc_node_delete() and man_node_delete() -> roff_node_delete()
Minus 130 lines of code, no functional change.

Revision 1.67 / (download) - annotate - [select for diffs], Sat Apr 18 16:04:40 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.66: +9 -9 lines
Diff to previous 1.66 (colored)

Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

Revision 1.66 / (download) - annotate - [select for diffs], Fri Apr 3 23:17:09 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.65: +34 -119 lines
Diff to previous 1.65 (colored)

Vastly simplify man(7) block unwinding, similar to mdoc_macro.c 1.171.
Drop one enum type, two static functions, 70 lines of code.
Also fixes the mpeg_encode(1) manual reported broken by naddy@.

Revision 1.65 / (download) - annotate - [select for diffs], Fri Apr 3 16:59:34 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

It turns out the man(7) parser suffers from unintelligible handling
of block rewinding, just like then mdoc(7) parser did.
First step in getting rid of rew_scope():
Replace the only call where the target block is known.
This commit is analogous to mdoc_macro.c rev. 1.167.
One down, three to go.

Revision 1.64 / (download) - annotate - [select for diffs], Thu Apr 2 22:06:17 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.63: +17 -18 lines
Diff to previous 1.63 (colored)

Second step towards parser unification:
Replace struct mdoc_node and struct man_node by a unified struct roff_node.
To be able to use the tok member for both mdoc(7) and man(7) without
defining all the macros in roff.h, sacrifice a tiny bit of type safety
and make tok an int rather than an enum.
Almost mechanical, no functional change.
Written on the Eurostar from Bruxelles to London on the way to p2k15.

Revision 1.63 / (download) - annotate - [select for diffs], Thu Apr 2 21:03:18 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.62: +30 -29 lines
Diff to previous 1.62 (colored)

First step towards parser unification:
Replace enum mdoc_type and enum man_type by a unified enum roff_type.
Almost mechanical, no functional change.
Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.

Revision 1.62 / (download) - annotate - [select for diffs], Fri Mar 20 14:47:20 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +2 -2 lines
Diff to previous 1.61 (colored)

The .PD macro can occur in next-line scope.  Fixes zshmisc(1).
Issue reported by Christian Neukirchen <chneukirchen at gmail dot com>.

Revision 1.61 / (download) - annotate - [select for diffs], Fri Mar 20 12:53:43 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +18 -16 lines
Diff to previous 1.60 (colored)

Simplify by almost halving the number of macro flags:
1. MAN_EXPLICIT was used iff fp == blk_exp, so just test fp.
2. MAN_FSCOPED was used only for TP, so just test for TP.
3. MAN_NOCLOSE was completely unused.
No functional change.

Revision 1.60 / (download) - annotate - [select for diffs], Fri Feb 6 11:54:03 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.59: +11 -17 lines
Diff to previous 1.59 (colored)

better error reporting regarding .OP .RS .UR .TH arguments

Revision 1.59 / (download) - annotate - [select for diffs], Fri Feb 6 09:38:22 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +8 -1 lines
Diff to previous 1.58 (colored)

better diagnostics about excess arguments to .PD .ft .sp

Revision 1.58 / (download) - annotate - [select for diffs], Fri Feb 6 08:28:03 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +8 -1 lines
Diff to previous 1.57 (colored)

better error reporting for .br .fi .nf with arguments

Revision 1.57 / (download) - annotate - [select for diffs], Sat Jan 24 10:07:58 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +13 -2 lines
Diff to previous 1.56 (colored)

preserve .PP before .RE; effect found in audio/pms(1)

Revision 1.56 / (download) - annotate - [select for diffs], Sat Jan 24 02:41:32 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +1 -2 lines
Diff to previous 1.55 (colored)

Strangely, ignoring the roff(7) .na request was implemented in the man(7)
parser.  Simplify the code by moving it into the roff(7) parser, also
making it work for mdoc(7).

Revision 1.55 / (download) - annotate - [select for diffs], Sat Jan 24 01:59:40 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +23 -3 lines
Diff to previous 1.54 (colored)

Support .RE with an argument; needed for audio/pms(1).

Revision 1.54 / (download) - annotate - [select for diffs], Tue Dec 16 17:24:58 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (colored)

Explicit block closure macros clobber next-line block head scope,
just like explicit block macros themselves.
Fixing an assertion failure jsg@ found with afl.

Revision 1.53 / (download) - annotate - [select for diffs], Fri Nov 28 05:51:29 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +54 -87 lines
Diff to previous 1.52 (colored)

Simplify by making many functions in the man(7) parser void,
and some cleanup; no functional change, minus 70 lines.

Revision 1.52 / (download) - annotate - [select for diffs], Mon Nov 3 23:17:21 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +11 -9 lines
Diff to previous 1.51 (colored)

Allow the five man(7) font macros to concatenate their line arguments,
the same way the mdoc(7) macros marked MDOC_JOIN do it.
In -Thtml, this removes bogus <br/> when the font macros are used
in no-fill mode; issue found by jsg@ in the Xcursor(3) SYNOPSIS.
As a bonus, this slightly reduces the size of the syntax tree.

Revision 1.51 / (download) - annotate - [select for diffs], Mon Aug 18 16:26:13 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +16 -2 lines
Diff to previous 1.50 (colored)

When the first child of the node being validated gets deleted during
validation, man_node_unlink() switches to MAN_NEXT_CHILD.  After
that, we have to switch back to MAN_NEXT_SIBLING after completing
validation, or subsequent parsing would add content into an already
closed node, clobbering potentially existing children, causing
information loss and a memory leak.  Bug found by kristaps@ with
valgrind in groff(7) on Mac OS X.

Note that the switch back must be conditional, for if the node being
validated itself gets deleted, we must *not* go to MAN_NEXT_SIBLING,
which would not only yield wrong results in general but also crash
in malformed manuals having an empty paragraph before the first .SH,
for example OpenBSD c++filt(1).

While here, add the missing <sys/types.h> as required before mandoc.h.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Aug 8 15:35:31 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +30 -8 lines
Diff to previous 1.49 (colored)

Improve handling of next-line scope broken by end of file.
Detect the condition earlier, report in the error message
which block is broken, and delete the broken block.
Consequently, empty section headers can no longer happen.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Aug 8 15:32:17 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +1 -8 lines
Diff to previous 1.48 (colored)

Simplify: replace one global flag by one local variable
and remove three unused global flags.  No functional change.

Revision 1.48 / (download) - annotate - [select for diffs], Wed Jul 9 11:27:20 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.47: +1 -3 lines
Diff to previous 1.47 (colored)

delete forgotten, obsolete rew_warn() prototype

Revision 1.47 / (download) - annotate - [select for diffs], Mon Jul 7 21:35:42 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +4 -3 lines
Diff to previous 1.46 (colored)

Clean up ERROR messages related to document structure and macros:
Hierarchical naming and mention macro names in messages.

Revision 1.46 / (download) - annotate - [select for diffs], Mon Jul 7 19:17:39 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.45: +22 -46 lines
Diff to previous 1.45 (colored)

Simplify man_unscope(), removing 18 lines of code, that is,
removing one function argument, one function definition,
three function invocations and two pointless assert()s.
No functional change.

Revision 1.45 / (download) - annotate - [select for diffs], Sun Apr 20 16:44:44 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.44: +23 -37 lines
Diff to previous 1.44 (colored)

KNF: case (FOO):  ->  case FOO, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting;
no functional change

Revision 1.44 / (download) - annotate - [select for diffs], Sun Mar 30 19:47:32 2014 UTC (10 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.43: +2 -1 lines
Diff to previous 1.43 (colored)

Implement the roff(7) .ll (line length) request.
Found by naddy@ in the textproc/enchant(1) port.
Of course, do not use this in new manuals.

Revision 1.43 / (download) - annotate - [select for diffs], Mon Dec 30 00:52:18 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

Simplify: Remove an unused argument from the mandoc_eos() function.
No functional change.

Revision 1.42 / (download) - annotate - [select for diffs], Wed Dec 25 00:50:03 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +2 -1 lines
Diff to previous 1.41 (colored)

s/[Nn]ull/NUL/ in comments where appropriate;
suggested by Thomas Klausner <wiz @ NetBSD dot org>.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Dec 22 13:24:00 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +10 -1 lines
Diff to previous 1.40 (colored)

Implement end-of-sentence spacing at the end of man(7) macro lines.

Improves cvs(1) pcap-filter(3) readline(3) termcap(5) cvsbug(8)
mkhybrid(8) nsd-zonec(8) in multiple places and c++filt(1) com_err(3)
nsd_conf(5) term(5) nsdc(8) in one place each.
Reduces overall groff-mandoc-differences in base by about 1.5%.

Patch from Franco Fichtner <franco at lastsummer dot de> (DragonFly).

Revision 1.40 / (download) - annotate - [select for diffs], Mon Nov 11 00:35:51 2013 UTC (10 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +7 -5 lines
Diff to previous 1.39 (colored)

In the parser, when closing an explicit block that is not open,
close below-subsection implicit scopes that may still be open.
In the formatter, make sure indentation is reset when leaving a scope,
not only when entering the next one.

Improves the formatting of gpg(1); issue reported by jca on ports.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Oct 17 20:51:30 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +6 -1 lines
Diff to previous 1.38 (colored)

Implement the .UR/.UE block (uniform resource identifier) introduced in the
man-ext macros by Eric S. Raymond, enabled by default in groff_man(7).
Usual disclaimer: You don't write new man(7) code, so you are not going
to use these, either.
Improves e.g. the bzr(1) and etherape(1) manuals.
Thanks to naddy@ for bringing these to my attention.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Nov 17 00:25:20 2012 UTC (11 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.37: +61 -61 lines
Diff to previous 1.37 (colored)

Cleanup naming of local variables to make the code easier on the eye:
Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta"
and avoid the confusing "*m" which was sometimes this, sometimes that.
No functional change.

ok kristaps@ some time ago

Revision 1.37 / (download) - annotate - [select for diffs], Sat Jul 7 17:39:05 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

Fix an assert() raised by `RS' when following `TP' without a tag.
The reason was that `RS' wasn't BSCOPE'd, so the next-line (BLINE) scope
opened by `TP' would still be in the macro HEAD.
This was from joerg@'s archive of failures.
Fix by kristaps@, bsd.lv rev. 1.74.

Revision 1.36 / (download) - annotate - [select for diffs], Sun Jun 3 09:47:26 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +29 -17 lines
Diff to previous 1.35 (colored)

Close a preceding implicit block before opening an explicit block.

To allow doing so, no longer abuse rew_scope() to unwind explicit blocks;
explicitly call man_unscope() instead.

Fixing the indentation of slapd.conf(5) in the OpenLDAP port;
thanks to guenther@ for the report.

Revision 1.35 / (download) - annotate - [select for diffs], Sat Jun 2 20:07:09 2012 UTC (11 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +3 -1 lines
Diff to previous 1.34 (colored)

Minimal implementation of .EX and .EE for GNU compatibility.
Do not use this, it is not portable and only defined in esr's man-ext.
For example, sox(1) wants these macros.

Revision 1.34 / (download) - annotate - [select for diffs], Sun Feb 26 19:41:27 2012 UTC (12 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

Support .OP, one of the extended man macros; from kristaps@.
Do not use this GNU extension, we take it for compatibility only.

Revision 1.33 / (download) - annotate - [select for diffs], Sun Dec 4 00:44:18 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.32: +1 -2 lines
Diff to previous 1.32 (colored)

When a man document contains nothing at all except one or more invalid
macros, do not die on an assertion, but show correct error messages.
Assertions of meta data validity suggested by joerg@.
ok joerg@

Revision 1.32 / (download) - annotate - [select for diffs], Sat Nov 5 16:02:18 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +12 -12 lines
Diff to previous 1.31 (colored)

When the HEAD scope of .TP is broken by another block macro,
do not abort with a FATAL error, but report a regular ERROR,
remove the broken .TP from the syntax tree, and prod on.
Reported repeatedly by ports people, at least by brad@ and jeremy@.
Also fixes rendition(4) in Xenocara.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jul 7 04:08:01 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.30: +7 -7 lines
Diff to previous 1.30 (colored)

Set the default way to append the next node (sibling) before, not after
calling the post handler, such that it doesn't clobber specific decisions
made in the post handler.

Fixes a regression related to vertical spacing in nsd-xfer(8).

Patch from kristaps@.

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jul 5 04:12:41 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +1 -6 lines
Diff to previous 1.29 (colored)

Sync to bsd.lv (all coded by kristaps@):
 - mdoc(7): fix an assertion if the first line after .Bd -column
   starts with a blank, and some simplifications in mdoc_argv.c
 - man(7): literal mode ends at .SH and .SS (bug reported by naddy@)
 - allow .RS/.RE blocks to nest (bug reported by dcoppa@ and gsoares@)
 - improve vertical spacing of man(7) blocks
 - roff(7): clear user-defined strings when starting a new file
 - correct ID tags in -T[x]html

Revision 1.29 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.28: +27 -22 lines
Diff to previous 1.28 (colored)

Merge version 1.11.1:
Again lots of cleanup and maintenance work by kristaps@.
- simplify error reporting: less function pointers, more mandoc_[v]msg
- main: split document parsing out of main.c into read.c
- roff, mdoc, man: improved recognition of control characters
- roff: better handling of if/else stack overflows
- roff: add some predefined strings for backward compatibility
- mdoc, man: empty sections are not errors
- mdoc: move delimiter handling to libmdoc
- some header restructuring and some minor features and fixes
This merge causes two minor regressions
that i will fix in separate commits right afterwards.

Revision 1.28 / (download) - annotate - [select for diffs], Thu Apr 21 22:59:54 2011 UTC (13 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.27: +12 -13 lines
Diff to previous 1.27 (colored)

Merge version 1.10.10:
lots of cleanup and maintenance work by kristaps@.
- move some main.c globals into struct curparse
- move mandoc_*alloc to mandoc.h such that all code can use them
- make mandoc_isdelim available to formatting frontends
- dissolve mdoc_strings.c, move the code where it is used
- make all error reporting functions void, their return values were useless
- and various minor cleanups and fixes

Revision 1.27 / (download) - annotate - [select for diffs], Sun Jan 16 19:27:25 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.26: +13 -5 lines
Diff to previous 1.26 (colored)

Some improvements to error handling from kristaps@:
* Make out-of-context .fi invocations not cause an error, but just a warning.
* Downgrade -man message about ignored empty paragraph to MANDOC_IGNPAR.
* Avoid syntax tree corruption when removing empty block macros.
Triggered by some reports from brad@.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jan 4 22:28:17 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +1 -6 lines
Diff to previous 1.25 (colored)

Merge kristaps@' cleaner tbl integration, removing mine;
there are still a few bugs, but fixing these will be easier in tree.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Dec 19 07:53:12 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.24: +1 -3 lines
Diff to previous 1.24 (colored)

Remove `i' and `r' macro handlers.  These macros, originally part of the
me package, aren't recognised by "groff -mandoc" so we don't need to do
so either.  Besides, they are not used in base or Xenocara, and only at
two or three places in one single port, which are probably typos.
From kristaps@.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Dec 1 23:02:59 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.23: +1 -9 lines
Diff to previous 1.23 (colored)

Merge man_action.c into man_validate.c.
Same as for mdoc_action.c, but much simpler.
Work by kristaps@, re-applying OpenBSD changes on top.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Nov 29 02:26:45 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.22: +1 -4 lines
Diff to previous 1.22 (colored)

Now that we have proper .de support in the roff(7) library,
it is time to remove the .Sp, .Vb, and .Ve kludge
that was added to the man(7) library to build Perl manuals.

Revision 1.22 / (download) - annotate - [select for diffs], Mon Nov 29 00:12:02 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.21: +2 -1 lines
Diff to previous 1.21 (colored)

Implement the roff .ft (change font) request for man(7).
Of course, we don't want to encourage low-level physical markup,
but pod2man(1) writes such requests, so Perl manuals contain them,
and some Xenocara and lots and lots of ports manuals use them as well.
In base and Xenocara, this will reduce mandoc -Tlint ERROR noise;
in ports, it will improve rendering of many manuals.

Revision 1.21 / (download) - annotate - [select for diffs], Fri Oct 15 20:45:03 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.20: +6 -1 lines
Diff to previous 1.20 (colored)

Minimal glue to integrate tbl into the mandoc man(7) parser and formatter.
The output dosn't look nice yet, escape handling is still missing,
but will follow soon.
"move forward aggressively :-)" deraadt@

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jul 25 18:05:54 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.19: +6 -2 lines
Diff to previous 1.19 (colored)

Sync to bsd.lv; in particular, pull in lots of bug fixes.
new features:
* support the .in macro in man(7)
* support minimal PDF output
* support .Sm in mdoc(7) HTML output
* support .Vb and .nf in man(7) HTML output
* complete the mdoc(7) manual
bug fixes:
* do not let mdoc(7) .Pp produce a newline before/after .Sh; reported by jmc@
* avoid double blank lines related to man(7) .sp and .br
* let man(7) .nf and .fi flush the line; reported by jsg@ and naddy@
* let "\ " produce a non-breaking space; reported by deraadt@
* discard \m colour escape sequences; reported by J.C. Roberts
* map undefined 1-character-escapes to the literal character itself
maintenance:
* express mdoc(7) arguments in terms of an enum for additional type-safety
* simplify mandoc_special() and a2roffdeco()
* use strcspn in term_word() in place of a manual loop
* minor optimisations in the -Tps and -Thtml formatting frontends

Revision 1.19 / (download) - annotate - [select for diffs], Sun May 23 22:45:00 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.18: +13 -11 lines
Diff to previous 1.18 (colored)

Unified error and warning message system for all of mandoc,
featuring three message levels, as agreed during the mandoc hackathon:
* FATAL parser failure, cannot produce any output from this input file:
  eventually, we hope to convert most of these to ERRORs.
* ERROR, meaning mandoc cannot cope fully with the input syntax and will
  probably lose information or produce structurally garbled output;
  it will try to produce output anyway but exit non-zero at the end,
  which is eventually intended to make the ports infrastructure happy.
* WARNING, meaning you should clean up the input file, but output
  is probably mostly OK, so this will not cause error-exit at the end.
This commit is mostly just converting the old system to the new one; before
the classification will become really reliable, we must check all messages.

In particular,
* set up a new central message string table in main.c
* drop the old message string tables from man.c and mdoc.c
* get rid of the piece-meal merr enums in libman and libmdoc
* reduce number of error/warning functions from 16 to 6 (still a lot...)

While here, handle a few problems more gracefully:
* allow .Rv and .Ex to work without a prior .Nm
* allow .An to ignore extra arguments
* allow undeclared columns in .Bl -column

Written by kristaps@.

Revision 1.18 / (download) - annotate - [select for diffs], Sun May 23 20:57:16 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.17: +2 -1 lines
Diff to previous 1.17 (colored)

implement .AT and .UC; from Joerg Sonnenberger

Revision 1.17 / (download) - annotate - [select for diffs], Thu May 20 00:58:02 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.16: +1 -93 lines
Diff to previous 1.16 (colored)

Support nested roff instructions:
* allow roff_parseln() to be re-run
* allow roff_parseln() to manipulate the line buffer offset
* support the offset in the man and mdoc libraries
* adapt .if, .ie, .el, .ig, .am* and .de* support
* interpret some instructions even in conditional-negative context
Coded by kristaps during the last day of the mandoc hackathon.

To avoid regressions in the OpenBSD tree, commit this together
with some small local additions:
* detect roff block end "\}" even on macro lines
* actually implement the ".if n" conditional
* ignore .ds, .rm and .tr in libroff

Also back my old .if/.ie/.el-handling out of libman, reverting:
man.h 1.15 man.c 1.25 man_macro.c 1.15 man_validate.c 1.19
man_action.c 1.15 man_term.c 1.28 man_html.c 1.9.

Revision 1.16 / (download) - annotate - [select for diffs], Sun May 16 00:54:03 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.15: +5 -93 lines
Diff to previous 1.15 (colored)

In theory, Kristaps never intended to write a roff parser,
but in practice, most real legacy man(7)uals are using so much
low level roff that we can't really get away without at least
partially handling some roff instructions.

As doing this in man(7) only has become messy and as even some
mdoc(7) pages need it, start a minimal partial roff preprocessor.
As a first step, move handling of .am[i], .de[i] and .ig there.
Do not use the roff preprocessor for new manuals!

Now that we have three main parser libraries - roff, man and mdoc -
each one having its own error handling is becoming messy, too.
Thus, start unifying message handling in one central place,
introducing a new generic function mmsg().

coded by kristaps@

Revision 1.15 / (download) - annotate - [select for diffs], Sun Apr 25 16:32:19 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.14: +93 -1 lines
Diff to previous 1.14 (colored)

Implement roff conditional instructions .if .ie .el, in man(7) only for now;
fixing OpenBSD::PackageName(3p) and friends for espie@.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Apr 2 11:37:07 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.13: +18 -13 lines
Diff to previous 1.13 (colored)

merge 1.9.20, keeping local patches
* prevent roff instructions in man(7) from clobbering scopes and line modes
  (noted by Sascha Wildner)
* handle leading punctuation in mdoc(7) blocks and line macros
  (looks good in principle, but is causing some fallout in OpenBSD,
   so i will disable it locally for now with the next commit)

Revision 1.13 / (download) - annotate - [select for diffs], Mon Mar 29 22:56:52 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.12: +87 -21 lines
Diff to previous 1.12 (colored)

merge 1.9.19, keeping local patches
 * scoping fixes for roff instructions
 * accept apostroph in place of dot as a macro control character
 * accept tabs between the control character and the macro name
 * check that man(7) .TH titles use capital letters

Revision 1.12 / (download) - annotate - [select for diffs], Fri Mar 26 01:22:05 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.11: +127 -30 lines
Diff to previous 1.11 (colored)

merge 1.9.17, keeping local patches

* much improved pod2man support and low-level roff robustness
* have -Tlint imply -Wall and -fstrict
* use fewer macros and more enum in libman
* and various bug fixes

Revision 1.11 / (download) - annotate - [select for diffs], Thu Mar 25 23:23:01 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.10: +21 -6 lines
Diff to previous 1.10 (colored)

merge 1.9.16, keeping local patches

This is mostly cleanup by kristaps@ after my rather hackish patch
to tolerate the non-text macros .na, .sp, .br in next-line scope;
plus some nesting issues fixed by him, all in man(7).
This survived a full  cd /usr/src; make man.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Mar 2 01:00:39 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.9: +8 -1 lines
Diff to previous 1.9 (colored)

Accept the non-standard macros .Sp (similar to .sp)
and .Vb/.Ve (similar to .nf/.fi) in man(7) mode.
These are not intended to be used manually, but they allow us to
properly render man(7) code autogenerated by pod2man(1),
making Perl and OpenSSL happy in our tree.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Oct 27 21:40:07 2009 UTC (14 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.8: +2 -1 lines
Diff to previous 1.8 (colored)

sync to 1.9.11: adapt printing of dates to groff conventions,
NetBSD portability fixes and some minor bugfixes and feature enhancements;
also checked that my hyphenation code still works on top of this

Revision 1.8 / (download) - annotate - [select for diffs], Fri Sep 18 22:46:14 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.7: +2 -1 lines
Diff to previous 1.7 (colored)

sync to 1.9.2: Add .UC libman macro for compatibility, has no effect.
Correct .UC and .DT to not print their arguments.
Document that .UC and .DT should not be used.

Revision 1.7 / (download) - annotate - [select for diffs], Sat Aug 22 23:17:40 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.6: +104 -40 lines
Diff to previous 1.6 (colored)

another large chunk of -man updates,
among others regarding .DT, .HP, .RS, .RE, .SH, .SS, and scoping,
now in sync vith release 1.9.1

Revision 1.6 / (download) - annotate - [select for diffs], Sat Aug 22 20:14:37 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.5: +232 -146 lines
Diff to previous 1.5 (colored)

Kristaps@ significantly overhauled libman.
I'm committing this in one large chunk because in contrast to -mdoc, -man
is mostly untested in OpenBSD anyway, so any fallout can be fixed in-tree.
Among others, improved support for .IP, .HP, and .TP.
Now in sync with release 1.9.0.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Aug 22 15:15:37 2009 UTC (14 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored)

sync to 1.8.4: support .sp in -man

Revision 1.4 / (download) - annotate - [select for diffs], Tue Jun 23 22:05:42 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.3: +6 -8 lines
Diff to previous 1.3 (colored)

sync to 1.7.20: error reporting functions for -man

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 18 23:34:53 2009 UTC (14 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +2 -3 lines
Diff to previous 1.2 (colored)

sync to 1.7.19: improved comment handling

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 14 23:00:57 2009 UTC (14 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.1: +11 -13 lines
Diff to previous 1.1 (colored)

sync to 1.7.16: comments, whitespace and spelling fixes; no functional change

Revision 1.1 / (download) - annotate - [select for diffs], Mon Apr 6 20:30:40 2009 UTC (15 years, 1 month ago) by kristaps
Branch: MAIN

Initial check-in of mandoc for formatting manuals. ok deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.