OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.129 / (download) - annotate - [select for diffs], Tue Oct 24 20:30:49 2023 UTC (6 months, 3 weeks ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.128: +31 -2 lines
Diff to previous 1.128 (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.128 / (download) - annotate - [select for diffs], Fri Apr 28 20:14:19 2023 UTC (12 months, 3 weeks ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.127: +8 -27 lines
Diff to previous 1.127 (colored)

Do not rewrite MAN_LP and MAN_P to MAN_PP because doing that causes
confusing warning messages complaining about macros that don't even
appear in the input file.
As a welcome side effect, this also shortens the code...

Fixing a minibug
reported by Alejandro Colomar <alx dot manpages at gmail dot com>.

Revision 1.127 / (download) - annotate - [select for diffs], Tue Aug 2 11:55:51 2022 UTC (21 months, 2 weeks ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.126: +1 -3 lines
Diff to previous 1.126 (colored)

If the body of a man(7) .MT or .UR block is empty, do not emit a warning.
Leaving the body empty is legitimate in this case if the author only
wants to display a mail address or URI without providing a link text.
Output modules already handle this correctly: terminal output shows
just the URI without an accompanying text, HTML output uses the URI
for *both* the href= attribute and as the content of the <a> element.

The documentation was also wrong and claimed that an .MT or .UR block
with an empty body would produce no output.  As explained above,
this isn't true.

Bogus warning reported by
Alejandro Colomar <alx dot manpages at gmail dot com>.

Revision 1.126 / (download) - annotate - [select for diffs], Tue Aug 10 12:36:42 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.125: +4 -2 lines
Diff to previous 1.125 (colored)

Support two-character font names (BI, CW, CR, CB, CI)
in the tbl(7) layout font modifier.

Get rid of the TBL_CELL_BOLD and TBL_CELL_ITALIC flags and use
the usual ESCAPE_FONT* enum mandoc_esc members from mandoc.h instead,
which simplifies and unifies some code.

While here, also support CB and CI in roff(7) \f escape sequences
and in roff(7) .ft requests for all output modes.  Using those is
certainly not recommended because portability is limited even with
groff, but supporting them makes some existing third-party manual
pages look better, in particular in HTML output mode.

Bug-compatible with groff as far as i'm aware, except that i consider
font names starting with the '\n' (ASCII 0x0a line feed) character
so insane that i decided to not support them.

Missing feature reported by nabijaczleweli dot xyz in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992002.
I used none of the code from the initial patch submitted by
nabijaczleweli, but some of their ideas.
Final patch tested by them, too.

Revision 1.125 / (download) - annotate - [select for diffs], Fri Oct 30 13:24:26 2020 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.124: +2 -2 lines
Diff to previous 1.124 (colored)

Promote section headers that can can be used unmodified as fragment
identifiers from TAG_WEAK to TAG_STRONG,
such that for example ...#DESCRIPTION always works.
Suggested by Aman Verma on the discuss@ list.

Revision 1.124 / (download) - annotate - [select for diffs], Fri Apr 24 11:58:02 2020 UTC (4 years ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.123: +8 -3 lines
Diff to previous 1.123 (colored)

provide a STYLE message when mandoc knows the file name and the extension
disagrees with the section number given in the .Dt or .TH macro;
feature suggested and patch tested by jmc@

Revision 1.123 / (download) - annotate - [select for diffs], Sat Apr 18 20:28:46 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.122: +2 -2 lines
Diff to previous 1.122 (colored)

When a .Tg is attached to a paragraph, attach the permalink
to the first word, or the first few words if they are short.

Revision 1.122 / (download) - annotate - [select for diffs], Sat Apr 4 20:23:07 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.121: +25 -2 lines
Diff to previous 1.121 (colored)

automatically tag .SH and .SS in man(7) terminal output
in the same way as it was done for .Sh and .Ss in mdoc(7)

Revision 1.121 / (download) - annotate - [select for diffs], Fri Mar 13 00:31:05 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +103 -5 lines
Diff to previous 1.120 (colored)

Split tagging into a validation part including prioritization
in tag.{h,c} and {mdoc,man}_validate.c
and into a formatting part including command line argument checking
in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c.

Immediate functional benefits include:
* Improved prioritization of automatic tags for .Em and .Sy.
* Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged.
* Explicit tagging of .Er and .Fl now works in HTML output.
* Automatic tagging of .IP and .TP now works in HTML output.
But mainly, this patch provides clean earth to build further improvements on.

Technical changes:
* Main program: Write a tag file for ASCII and UTF-8 output only.
* All formatters: There is no more need to delay writing the tags.
* mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection.
* HTML formatter: If available, use the "string" attribute as the tag.
* HTML formatter: New function to write permalinks, to reduce code duplication.

Style cleanup in the vicinity while here:
* mdoc(7) terminal formatter: To set up bold font for children,
defer to termp_bold_pre() rather than calling term_fontpush() manually.
* mdoc(7) terminal formatter: Garbage collect some duplicate functions.
* mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions.
* Where possible, use switch statements rather than if cascades.
* Get rid of some more Yoda notation.

The necessity for such changes was first discussed with kn@, but i didn't
bother him with a request to review the resulting -673/+782 line patch.

Revision 1.120 / (download) - annotate - [select for diffs], Sun Jan 19 16:16:32 2020 UTC (4 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +6 -11 lines
Diff to previous 1.119 (colored)

Align to the new, sane behaviour of the groff_mdoc(7) .Dd macro:
without an argument, use the empty string, and always concatenate
all arguments, no matter their number.
This allows reducing the number of arguments of mandoc_normdate()
and some other simplifications, at the same time polishing some
error messages by adding the name of the macro in question.

Revision 1.119 / (download) - annotate - [select for diffs], Thu Jun 27 15:05:14 2019 UTC (4 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.118: +13 -15 lines
Diff to previous 1.118 (colored)

Fix mandoc_normdate() and the way it is used.
In the past, it could return NULL but the calling code wasn't prepared
to handle that.  Make sure it always returns an allocated string.
While here, simplify the code by handling the "quick" attribute
inside mandoc_normdate() rather than at multiple callsites.

Triggered by deraadt@ pointing out
that snprintf(3) error handling was incomplete in time2a().

Revision 1.118 / (download) - annotate - [select for diffs], Wed Mar 13 18:29:26 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.117: +3 -3 lines
Diff to previous 1.117 (colored)

Contrary to what the NetBSD attribute(3) manual page suggests,
using __dead instead of __attribute__((__noreturn__)) actually
hinders portability rather than helping it.

Given that mandoc already uses __attribute__ in several files
and that in the portable version, ./configure already contains
rudimentary support for ignoring it on platforms that do not
support it, use __attribute__ directly.

This is expected to fix build failures that Stephen Gregoratto
<dev at sgregoratto dot me> reported from Arch and Debian Linux.

Revision 1.117 / (download) - annotate - [select for diffs], Mon Mar 11 13:19:03 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.116: +3 -3 lines
Diff to previous 1.116 (colored)

mark check_abort() and post_abort() as __dead;
based on a patch by Christos@ Zoulas at NetBSD

Revision 1.116 / (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.115: +2 -3 lines
Diff to previous 1.115 (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.115 / (download) - annotate - [select for diffs], Mon Dec 31 08:38:17 2018 UTC (5 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +20 -4 lines
Diff to previous 1.114 (colored)

Use the new flag NODE_NOFILL in the validators, which is sometimes
simpler and always more robust.  In particular, move the nesting
warnings for .EX and .EE from man_state(), where they were misplaced,
to the man(7) validator.

Revision 1.114 / (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.113: +3 -4 lines
Diff to previous 1.113 (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.113 / (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.112: +3 -3 lines
Diff to previous 1.112 (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.112 / (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.111: +27 -35 lines
Diff to previous 1.111 (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.111 / (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.110: +2 -1 lines
Diff to previous 1.110 (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.110 / (download) - annotate - [select for diffs], Tue Dec 4 02:53:45 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +49 -40 lines
Diff to previous 1.109 (colored)

Clean up the validation of .Pp, .PP, .sp, and .br.  Make sure all
combinations are handled, and are handled in a systematic manner.
This resolves some erratic duplicate handling, handles a number of
missing cases, and improves diagnostics in various respects.

Move validation of .br and .sp to the roff validation module
rather than doing that twice in the mdoc and man validation modules.
Move the node relinking function to the roff library where it belongs.

In validation functions, only look at the node itself, at previous
nodes, and at descendants, not at following nodes or ancestors,
such that only nodes are inspected which are already validated.

Revision 1.109 / (download) - annotate - [select for diffs], Mon Dec 3 21:00:06 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +32 -5 lines
Diff to previous 1.108 (colored)

In the validators, translate obsolete macro aliases (Lp, Ot, LP, P)
to the standard forms (Pp, Ft, PP) up front, such that later code
does not need to look for the obsolete versions.
This reduces the risk of incomplete handling.

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

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

Revision 1.107 / (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.106: +2 -1 lines
Diff to previous 1.106 (colored)

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

Revision 1.106 / (download) - annotate - [select for diffs], Thu Aug 16 15:04:45 2018 UTC (5 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +3 -4 lines
Diff to previous 1.105 (colored)

Do not calculate a pointer to a memory location before the beginning of
a static array.  Christos Zoulas, Robert Elz, and Andreas Gustafsson
point out that is undefined behaviour by the C standard even if we
never access the pointer.

Revision 1.105 / (download) - annotate - [select for diffs], Wed Apr 11 17:10:35 2018 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.104: +4 -4 lines
Diff to previous 1.104 (colored)

preserve comments before .Dd when converting mdoc(7) to man(7)
with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>

Revision 1.104 / (download) - annotate - [select for diffs], Wed Jul 26 10:33:02 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.103: +2 -3 lines
Diff to previous 1.103 (colored)

Fix a typo that caused a non-constant string
to be passed as a format string; no functional change;
reported by Michael <Stapelberg at debian>.

Revision 1.103 / (download) - annotate - [select for diffs], Sun Jun 25 07:23:53 2017 UTC (6 years, 10 months ago) by bentley
Branch: MAIN
Changes since 1.102: +4 -2 lines
Diff to previous 1.102 (colored)

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

feedback and ok schwarze@

Revision 1.102 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:27 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +12 -8 lines
Diff to previous 1.101 (colored)

Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-Wopenbsd and -Wnetbsd to check conventions for the base system of
a specific operating system.  Mark operating system specific messages
with "(OpenBSD)" at the end.

Please use just "-Tlint" to check base system manuals (defaulting
to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the
manuals of portable software projects you maintain that are not
part of OpenBSD base, to avoid bogus recommendations about base
system conventions that do not apply.

Issue originally reported by semarie@, solution using
an idea from tedu@, discussed with jmc@ and jca@.

Revision 1.101 / (download) - annotate - [select for diffs], Sat Jun 17 22:40:27 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +9 -1 lines
Diff to previous 1.100 (colored)

style message about missing RCS ids; inspired by mdoclint

Revision 1.100 / (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.99: +20 -3 lines
Diff to previous 1.99 (colored)

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

Revision 1.99 / (download) - annotate - [select for diffs], Sun Jun 11 19:36:31 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +3 -4 lines
Diff to previous 1.98 (colored)

Style message about legacy man(7) date format in mdoc(7) documents
and operating system dependent messages about missing or unexpected
Mdocdate; inspired by mdoclint(1).

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

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

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

move .ll to the roff modules

Revision 1.96 / (download) - annotate - [select for diffs], Fri May 5 02:06:17 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.95: +3 -45 lines
Diff to previous 1.95 (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.95 / (download) - annotate - [select for diffs], Thu May 4 17:48:24 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.94: +12 -2 lines
Diff to previous 1.94 (colored)

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

Revision 1.94 / (download) - annotate - [select for diffs], Mon Apr 24 23:06:09 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.93: +13 -13 lines
Diff to previous 1.93 (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.93 / (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_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.92: +11 -11 lines
Diff to previous 1.92 (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.92 / (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.91: +18 -33 lines
Diff to previous 1.91 (colored)

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

Revision 1.91 / (download) - annotate - [select for diffs], Mon Oct 12 00:07:27 2015 UTC (8 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +1 -9 lines
Diff to previous 1.90 (colored)

To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

Revision 1.90 / (download) - annotate - [select for diffs], Sun Apr 19 13:59:37 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.89: +2 -2 lines
Diff to previous 1.89 (colored)

Decouple the token code for "no request or macro" from the individual
high-level parsers to allow further unification of functions that
only need to recognize this code, but that don't care about different
high-level macrosets beyond that.

Revision 1.89 / (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.88: +6 -5 lines
Diff to previous 1.88 (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.88 / (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.87: +3 -3 lines
Diff to previous 1.87 (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.87 / (download) - annotate - [select for diffs], Thu Apr 2 23:47:43 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.86: +14 -14 lines
Diff to previous 1.86 (colored)

Third step towards parser unification:
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta.
Written of the train from London to Exeter on the way to p2k15.

Revision 1.86 / (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.85: +5 -5 lines
Diff to previous 1.85 (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.85 / (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.84: +23 -20 lines
Diff to previous 1.84 (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.84 / (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.83: +23 -22 lines
Diff to previous 1.83 (colored)

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

Revision 1.83 / (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.82: +2 -11 lines
Diff to previous 1.82 (colored)

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

Revision 1.82 / (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.81: +3 -11 lines
Diff to previous 1.81 (colored)

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

Revision 1.81 / (download) - annotate - [select for diffs], Fri Feb 6 07:12:34 2015 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +4 -4 lines
Diff to previous 1.80 (colored)

Delete the legacy generic warning type MANDOCERR_ARGCWARN,
replacing the last instances by more specific warnings.
Improved functionality, minus 50 lines of code.

Revision 1.80 / (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.79: +1 -2 lines
Diff to previous 1.79 (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.79 / (download) - annotate - [select for diffs], Sun Dec 28 14:39:08 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +3 -1 lines
Diff to previous 1.78 (colored)

mdoc(7) already uses the mandoc(1) -Ios argument in the footer line
when .Os has no argument, so do the same for man(7) when .TH has less
than four arguments; there is no reason to treat both differently.
Issue found following a question from Thomas Klausner <wiz at NetBSD>.

Revision 1.78 / (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.77: +49 -64 lines
Diff to previous 1.77 (colored)

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

Revision 1.77 / (download) - annotate - [select for diffs], Fri Aug 8 16:17:09 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +12 -9 lines
Diff to previous 1.76 (colored)

Bring the handling of defective prologues even closer to groff,
in particular relaxing the distinction between prologue and body
and further improving messages.
* The last .Dd wins and the last .Os wins, even in the body.
* The last .Dt before the first body macro wins.
* Missing title in .Dt defaults to UNTITLED.  Warn about it.
* Missing section in .Dt does not default to 1.  But warn about it.
* Do not warn multiple times about the same mdoc(7) prologue macro.
* Warn about missing .Os.
* Incomplete .TH defaults to empty strings.  Warn about it.

Revision 1.76 / (download) - annotate - [select for diffs], Fri Aug 8 16:05:42 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +69 -120 lines
Diff to previous 1.75 (colored)

Simplify man(7) validation:
Drop pre-handlers, they were almost unused.
Drop the needless complexity of allowing more than one post-handler.

This saves one internal interface function, one static function, one
private struct definition, sixteen static arrays, and 45 lines of code.
No functional change.

Revision 1.75 / (download) - annotate - [select for diffs], Fri Aug 8 15:57:05 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +5 -3 lines
Diff to previous 1.74 (colored)

demacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()

Revision 1.74 / (download) - annotate - [select for diffs], Fri Aug 8 15:54:10 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +10 -6 lines
Diff to previous 1.73 (colored)

mention requests and macros in more messages

Revision 1.73 / (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.72: +4 -22 lines
Diff to previous 1.72 (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.72 / (download) - annotate - [select for diffs], Mon Jul 7 21:35:42 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.71: +4 -5 lines
Diff to previous 1.71 (colored)

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

Revision 1.71 / (download) - annotate - [select for diffs], Sun Jul 6 19:08:56 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +3 -2 lines
Diff to previous 1.70 (colored)

Clean up messages related to plain text and to escape sequences.
* Mention invalid escape sequences and string names, and fallbacks.
* Hierarchical naming.

Revision 1.70 / (download) - annotate - [select for diffs], Sat Jul 5 12:33:54 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +3 -3 lines
Diff to previous 1.69 (colored)

Cleanup with respect to bad macro arguments.
* Fix .Sm with invalid arg: move arg out and toggle mode.
* Promote "unknown standard" from WARNING to ERROR, it loses information.
* Delete MANDOCERR_BADWIDTH, it would only indicate a mandoc(1) bug.
* Do not report MANDOCERR_BL_LATETYPE when there is no type at all.
* Mention macro names, arguments and fallbacks.

Revision 1.69 / (download) - annotate - [select for diffs], Fri Jul 4 16:11:41 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +6 -2 lines
Diff to previous 1.68 (colored)

Clean up messages regarding excess arguments:
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.
Also fix the handling of excess .It head arguments in -Tman.

Revision 1.68 / (download) - annotate - [select for diffs], Wed Jul 2 11:42:56 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +3 -3 lines
Diff to previous 1.67 (colored)

Clean up warnings related to macros and nesting.
* Hierarchical naming of enum mandocerr items.
* Improve the wording to make it comprehensible.
* Mention the offending macro.
* Garbage collect one chunk of ancient, long unreachable code.

Revision 1.67 / (download) - annotate - [select for diffs], Wed Jul 2 05:51:49 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +10 -4 lines
Diff to previous 1.66 (colored)

Improve "skipping paragraph macro" messages,
showing which macro was skipped and before or after what.

Revision 1.66 / (download) - annotate - [select for diffs], Tue Jul 1 22:36:35 2014 UTC (9 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +5 -2 lines
Diff to previous 1.65 (colored)

Clean up the warnings related to document structure.
* Hierarchical naming of the related enum mandocerr items.
* Mention the offending macro, section title, or string.
While here, improve some wordings:
* Descriptive instead of imperative style.
* Uniform style for "missing" and "skipping".
* Where applicable, mention the fallback used.

Revision 1.65 / (download) - annotate - [select for diffs], Fri Jun 20 22:58:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +7 -5 lines
Diff to previous 1.64 (colored)

As suggested by jmc@, only include line and column numbers into messages
when they are meaningful, to avoid confusing stuff like this:
$ mandoc /dev/null
mandoc: /dev/null:0:1: FATAL: not a manual
Instead, just say:
mandoc: /dev/null: FATAL: not a manual

Another example this applies to is documents having a prologue,
but lacking a body.  Do not throw a FATAL error for these; instead,
issue a warning and show the empty document, in the man(7) case with
the same amount of blank lines as groff does.  Also downgrade mdoc(7)
documents having content before the first .Sh from FATAL to WARNING.

Revision 1.64 / (download) - annotate - [select for diffs], Fri Jun 20 17:23:09 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +9 -4 lines
Diff to previous 1.63 (colored)

Start systematic improvements of error reporting.
So far, this covers all WARNINGs related to the prologue.

1) hierarchical naming of MANDOCERR_* constants
2) mention the macro name in messages where that adds clarity
3) add one missing MANDOCERR_DATE_MISSING msg
4) fix the wording of one message related to the man(7) prologue

Started on the plane back from Ottawa.

Revision 1.63 / (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.62: +42 -48 lines
Diff to previous 1.62 (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.62 / (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.61: +2 -1 lines
Diff to previous 1.61 (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.61 / (download) - annotate - [select for diffs], Fri Mar 21 22:17:01 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +2 -1 lines
Diff to previous 1.60 (colored)

The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions.  Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.

Revision 1.60 / (download) - annotate - [select for diffs], Mon Jan 6 22:39:19 2014 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.59: +8 -6 lines
Diff to previous 1.59 (colored)

Another 18% speedup for mandocdb(8) -Q, found by gprof(1).
In -Q mode, refrain form validating and normalizing the format
of the date given in .Dd or .TH, as it won't be used anyway.

For /usr/share/man, mandocdb -Q now takes 45% of the time of makewhatis(8).

Revision 1.59 / (download) - annotate - [select for diffs], Tue Dec 31 18:07:06 2013 UTC (10 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +2 -6 lines
Diff to previous 1.58 (colored)

remove assignments that will be overwritten right afterwards,
and remove pointless local variables;
found in a clang output from Ulrich Spoerlein <uqs at FreeBSD>

Revision 1.58 / (download) - annotate - [select for diffs], Thu Oct 17 20:51:31 2013 UTC (10 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +17 -2 lines
Diff to previous 1.57 (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.57 / (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.56: +72 -81 lines
Diff to previous 1.56 (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.56 / (download) - annotate - [select for diffs], Sun Jul 29 12:35:05 2012 UTC (11 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +3 -2 lines
Diff to previous 1.55 (colored)

Implement .PD for -Tascii.
Reminded about the missing feature by millert@.
This reduces mandoc/groff differences in base by 25%.
ok millert@

Revision 1.55 / (download) - annotate - [select for diffs], Wed Jul 18 16:51:50 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.54: +22 -2 lines
Diff to previous 1.54 (colored)

Drop empty .IP such that is does not cause additional vertical spacing.
Issue first reported by naddy@ in rsync(1).

Revision 1.54 / (download) - annotate - [select for diffs], Wed Jul 18 16:40:50 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +20 -7 lines
Diff to previous 1.53 (colored)

Drop .sp and .br right after .SH and .SS.

Fixes vertical spacing after "OPTIONS" in gcc(1).
Issue first reported by naddy@ in rsync(1).

Revision 1.53 / (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.52: +3 -1 lines
Diff to previous 1.52 (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.52 / (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.51: +7 -3 lines
Diff to previous 1.51 (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.51 / (download) - annotate - [select for diffs], Fri Dec 2 01:45:43 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.50: +5 -1 lines
Diff to previous 1.50 (colored)

In man(7), when no explicit volume name is given, use the default
volume name for the respective manual section, just like in mdoc(7).
This gives us nicer page headers for cvs(1), lynx(1), tic(1),
mkhybrid(8), and many curses(3) manuals.

ok kristaps@

To not break compatibility, i wrote a corresponding patch for GNU troff
which Werner Lemberg accepted upstream at rev. 1.65 of:
http://cvs.savannah.gnu.org/viewvc/groff/tmac/an-old.tmac?root=groff

Revision 1.50 / (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.49: +11 -26 lines
Diff to previous 1.49 (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.49 / (download) - annotate - [select for diffs], Thu Nov 3 20:46:40 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +6 -4 lines
Diff to previous 1.48 (colored)

When .TH sets no data, leave the date field in the page footer blank,
do not use the current date.  This removes a gratuitous output difference
with respect to groff.
ok kristaps@

Revision 1.48 / (download) - annotate - [select for diffs], Sun Oct 16 12:18:32 2011 UTC (12 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +6 -7 lines
Diff to previous 1.47 (colored)

Remove a bunch of useless assignments,
and assert that print_bvspace cannot be called on NULL pointers.
No change in behaviour, none of these were bugs,
but the code becomes easier to understand.
Based on a clang report posted by joerg@; ok kristaps@.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Sep 18 15:54:48 2011 UTC (12 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +29 -48 lines
Diff to previous 1.46 (colored)

sync to version 1.11.7 from kristaps@
main new feature: support the roff(7) .tr request
plus various bugfixes and some refactoring

regressions are so minor that it's better to get this in
and fix them in the tree

Revision 1.46 / (download) - annotate - [select for diffs], Thu Jul 7 20:07:38 2011 UTC (12 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.45: +20 -5 lines
Diff to previous 1.45 (colored)

Fix a bogus "unknown macro" error reported in the pod2man(1) preamble:
- Actually let roff_parse() recognize ".\}" as a cond block end request.
- Do not rewrite "\}" to the zero-width space "\&" because that prevents
recognition of immediately preceding macros; use normal blanks instead.
- To avoid a vertical spacing regression in pod2man(1) manuals,
drop one vertical spacing request just before NAME.
From kristaps@.

Revision 1.45 / (download) - annotate - [select for diffs], Sun May 29 21:22:18 2011 UTC (12 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.44: +31 -25 lines
Diff to previous 1.44 (colored)

Merge release 1.11.3, almost all code by kristaps@:
* Unicode output support (no Unicode input yet, though).
* Refactoring: completely handle predefined strings in roff.c.
- New function mandoc_escape() replaces a2roffdeco() and mandoc_special().
- Start using mandoc_getarg() in mdoc_argv.c.
- Clean up parsing of delimiters in mdoc(7).
* And many minor fixes and lots of cleanup.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Apr 24 16:22:02 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.43: +20 -17 lines
Diff to previous 1.43 (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.43 / (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.42: +3 -4 lines
Diff to previous 1.42 (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.42 / (download) - annotate - [select for diffs], Sun Mar 20 23:36:42 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +5 -1 lines
Diff to previous 1.41 (colored)

Import the foundation for eqn(7) support.
Written by kristaps@.

For now, i'm adding one line to each of the four frontends
to just pass the input text through to the output,
not yet interpreting any of then eqn keywords.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Mar 7 01:35:33 2011 UTC (13 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +13 -22 lines
Diff to previous 1.40 (colored)

Clean up date handling,
as a first step to get rid of the frequent petty warnings in this area:
 - always store dates as strings, not as seconds since the Epoch
 - for input, try the three most common formats everywhere
 - for unrecognized format, just pass the date though verbatim
 - when there is no date at all, still use the current date
Originally triggered by a one-line patch from Tim van der Molen,
<tbvdm at xs4all dot nl>, which is included here.
Feedback and OK on manual parts from jmc@.
"please check this in" kristaps@

Revision 1.40 / (download) - annotate - [select for diffs], Mon Jan 17 00:15:19 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.39: +24 -34 lines
Diff to previous 1.39 (colored)

Refrain from throwing fatal errors for
* .br .sp .nf .fi .na with arguments - just skip the arguments
* .TH lacking arguments - use empty strings instead like groff
* .TH with excessive arguments - skip those
Reminded by Joerg Sonnenberger, ok kristaps@.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jan 16 19:27:25 2011 UTC (13 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.38: +21 -32 lines
Diff to previous 1.38 (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.38 / (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.37: +13 -23 lines
Diff to previous 1.37 (colored)

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

Revision 1.37 / (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.36: +1 -3 lines
Diff to previous 1.36 (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.36 / (download) - annotate - [select for diffs], Tue Dec 7 00:08:52 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +57 -57 lines
Diff to previous 1.35 (colored)

Complete the merge of bsd.lv version 1.10.7:
No more functional changes, just sync ordering, comments and white space.

Revision 1.35 / (download) - annotate - [select for diffs], Mon Dec 6 23:03:56 2010 UTC (13 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +21 -19 lines
Diff to previous 1.34 (colored)

Do not report the same problems multiple times,
and do not bother checking the return values of calls
that always return 1.
From kristaps@.

Revision 1.34 / (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.33: +206 -8 lines
Diff to previous 1.33 (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.33 / (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.32: +1 -4 lines
Diff to previous 1.32 (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.32 / (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.31: +58 -1 lines
Diff to previous 1.31 (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.31 / (download) - annotate - [select for diffs], Wed Oct 27 10:17:45 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +2 -4 lines
Diff to previous 1.30 (colored)

The man(7) macros .HP .IP .RS .TP accept *optional* arguments,
so do not throw an ERROR when there are none.
Formatting is already correct:
With no arguments, use default widths and no tag.
Problem reported by naddy@, thanks.

Revision 1.30 / (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.29: +3 -1 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Fri Aug 20 00:53:35 2010 UTC (13 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +3 -7 lines
Diff to previous 1.28 (colored)

Implement a simple, consistent user interface for error handling.
We now have sufficient practical experience to know what we want,
so this is intended to be final:
- provide -Wlevel (warning, error or fatal) to select what you care about
- provide -Wstop to stop after parsing a file with warnings you care about
- provide consistent exit status codes for those warnings you care about
- fully document what warnings, errors and fatal errors mean
- remove all other cruft from the user interface, less is more:
- remove all -f knobs along with the whole -f option
- remove the old -Werror because calling warnings "fatal" is silly
- always finish parsing each file, unless fatal errors prevent that
This commit also includes a couple of related simplifications behind
the scenes regarding error handling.
Feedback and OK  kristaps@;  Joerg Sonnenberger (NetBSD) and
Sascha Wildner (DragonFly BSD) agree with the general direction.

Revision 1.28 / (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.27: +33 -21 lines
Diff to previous 1.27 (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.27 / (download) - annotate - [select for diffs], Sat Jun 26 17:56:43 2010 UTC (13 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.26: +5 -5 lines
Diff to previous 1.26 (colored)

merge release 1.10.2
* bug fixes:
- interaction of ASCII_HYPH with special chars (found by Ulrich Spoerlein)
- handling of roff conditionals (found by Ulrich Spoerlein)
- .Bd -offset will no more default to 6n
* maintenance:
- more caching of .Bd and .Bl arguments for efficiency
- deconstify man(7) validation routines
- add FreeBSD library names (provided by Ulrich Spoerlein)
* start PostScript font-switching

Revision 1.26 / (download) - annotate - [select for diffs], Wed May 26 02:39:58 2010 UTC (13 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

When a word does not fully fit onto the output line, but it contains
at least one hyphen, we already had support for breaking the line a the
last fitting hyphen.  This patch improves this functionality by only
breaking at hyphens in free-form text, and by not breaking at hyphens
* at the beginning or end of a word   or
* immediately preceded or followed by another hyphen   or
* escaped by a preceding backslash.

Before this patch, differences in break-at-hyphen support were one
of the major sources of noise in automatic comparisons to mdoc(7)
groff output.  Now, the remaining differences are hard to find among
the noise coming from other sources.

Where there are still differences, what we do seems to be better than
what groff does, see e.g. the chio(1) exchange and position commands
for one of the now rare examples.

idea and coding by kristaps@

Besides, this was the last substantial code difference left
between bsd.lv and openbsd.org.  We are now in full sync.

Revision 1.25 / (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.24: +39 -30 lines
Diff to previous 1.24 (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.24 / (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.23: +2 -1 lines
Diff to previous 1.23 (colored)

implement .AT and .UC; from Joerg Sonnenberger

Revision 1.23 / (download) - annotate - [select for diffs], Thu May 20 00:58:02 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.22: +1 -4 lines
Diff to previous 1.22 (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.22 / (download) - annotate - [select for diffs], Sun May 16 00:54:03 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.21: +1 -26 lines
Diff to previous 1.21 (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.21 / (download) - annotate - [select for diffs], Sat May 15 18:06:03 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

removed restriction on integer manual sections in -man;
by kristaps@

Revision 1.20 / (download) - annotate - [select for diffs], Thu May 13 20:34:29 2010 UTC (14 years ago) by schwarze
Branch: MAIN
Changes since 1.19: +2 -4 lines
Diff to previous 1.19 (colored)

Remove the command line option -fno-ign-chars.
This option was not useful, you never want mandoc to die
just because there is an invalid character in the input file,
neither in production nor when linting: a warning is sufficient.
This was particularly annoying because it was part of -fstrict
and could not be switched off.
"less is more" kristaps@

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

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

Revision 1.18 / (download) - annotate - [select for diffs], Wed Apr 7 23:15:05 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.17: +9 -1 lines
Diff to previous 1.17 (colored)

Merge the good parts of 1.9.23,
avoid the bad parts of 1.9.23, and keep local patches.

Input in general:
 * Basic handling of roff-style font escapes \f, \F.
 * Quoted punctuation does not count as punctuation.

mdoc(7) parser:
 * Make .Pf callable; noted by Claus Assmann.
 * Let .Bd and .Bl ignore unknown arguments; noted by deraadt@.
 * Do not warn when .Er is used outside certain sections.
 * Replace mdoc_node_free[list] by mdoc_node_delete.
 * Replace #define by enum for rew*() return values.

man(7) parser:
 * When .TH is missing, use default section and date.

Output in general:
 * Curly braces do not count as punctuation.
 * No space after .Fl w/o args when a macro follows on the same line.

HTML output:
 * Unify PAIR_*_INIT macros, introduce new PAIR_ID_INIT().
 * Print whitespace after, not before .Vt .Fn .Ft .Fo.

Checked that all manuals in base still build.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Apr 3 16:33:01 2010 UTC (14 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.16: +6 -3 lines
Diff to previous 1.16 (colored)

When we have no title in man(7), just use "unknown".  No need to bail.

ok deraadt@

Revision 1.16 / (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.15: +2 -2 lines
Diff to previous 1.15 (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.15 / (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.14: +22 -3 lines
Diff to previous 1.14 (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.14 / (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.13: +28 -2 lines
Diff to previous 1.13 (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.13 / (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.12: +6 -3 lines
Diff to previous 1.12 (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.12 / (download) - annotate - [select for diffs], Fri Feb 26 12:42:29 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.11: +4 -4 lines
Diff to previous 1.11 (colored)

The groff_man(7) manual says "the first line of text following" .TP is
used as a label, not "the first line following", so allow (some kinds of)
intervening macros - some people actually put macros in between.

On the other hand, when there is no text line before the next block macro,
that is, when the .TP block ends without any text line, then something *is*
broken, so still error out in that case.

Revision 1.11 / (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.10: +2 -1 lines
Diff to previous 1.10 (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.10 / (download) - annotate - [select for diffs], Wed Oct 21 19:13:50 2009 UTC (14 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.9: +4 -35 lines
Diff to previous 1.9 (colored)

sync to 1.9.9, featuring:
 * -Thtml output mode
 * roff scaling units
 * and some minor fixes
for full changelogs, see http://bsd.lv/cgi-bin/cvsweb.cgi/

Revision 1.9 / (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.8: +2 -1 lines
Diff to previous 1.8 (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.8 / (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.7: +27 -24 lines
Diff to previous 1.7 (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.7 / (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.6: +162 -59 lines
Diff to previous 1.6 (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.6 / (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.5: +40 -5 lines
Diff to previous 1.5 (colored)

sync to 1.8.4: support .sp in -man

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jul 8 00:04:10 2009 UTC (14 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.4: +18 -3 lines
Diff to previous 1.4 (colored)

sync to 1.7.21: unified escape sequence validation for mdoc and man
checking is still incomplete, but a bit better, in particular for man
now in sync with 1.7.22: the only 1.7.22 diff was already in

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

sync to 1.7.20: root and text validation 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.