CVS log for mandoc/read.c

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.221 / (download) - annotate - [select for diffs], Thu May 19 14:48:56 2022 UTC (22 months, 1 week ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.220: +7 -2 lines
Diff to previous 1.220 (unified) to selected 1.48 (unified)

improve a comment explaining a particularly nasty hack; no code change

Revision 1.220 / (download) - annotate - [select for diffs], Sun Jun 27 17:57:54 2021 UTC (2 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6
Changes since 1.219: +5 -2 lines
Diff to previous 1.219 (unified) to selected 1.48 (unified)

add a style message about overlong text lines,
trying very hard to avoid false positives,
not at all trying to catch as many cases as possible;

feature originally suggested by tb@,
OK tb@ kn@ jmc@

Revision 1.219 / (download) - annotate - [select for diffs], Fri Apr 24 12:02:33 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.218: +9 -3 lines
Diff to previous 1.218 (unified) to selected 1.48 (unified)

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.218 / (download) - annotate - [select for diffs], Sat Apr 18 20:40:10 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.217: +4 -4 lines
Diff to previous 1.217 (unified) to selected 1.48 (unified)

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.217 / (download) - annotate - [select for diffs], Tue Apr 7 22:56:02 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.216: +2 -1 lines
Diff to previous 1.216 (unified) to selected 1.48 (unified)

Separate the place to put the <a href> permalink (now marked
with NODE_HREF) from the target element of the link (still marked
with NODE_ID).  In many cases, use this to move the target to the
beginning of the paragraph, such that readers don't get dropped
into the middle of a sentence.

Revision 1.216 / (download) - annotate - [select for diffs], Fri Mar 13 16:16:58 2020 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.215: +3 -1 lines
Diff to previous 1.215 (unified) to selected 1.48 (unified)

Properly reset the validation part of the tagging module between files.
This fixes a crash in makewhatis(8) encountered by naddy@.

Revision 1.215 / (download) - annotate - [select for diffs], Fri Mar 13 15:32:28 2020 UTC (4 years ago) by schwarze
Branch: MAIN
Changes since 1.214: +11 -2 lines
Diff to previous 1.214 (unified) to selected 1.48 (unified)

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.214 / (download) - annotate - [select for diffs], Wed Jul 10 19:39:01 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.213: +17 -18 lines
Diff to previous 1.213 (unified) to selected 1.48 (unified)

Some time ago, i simplified mandoc_msg() such that it can be used
everywhere and not only in the parsers.
For more uniform messages, use it at more places instead of err(3),
in particular in the main program.
While here, integrate a few trivial functions called at exactly one
place into the main option parser, and let a few more functions use
the normal convention of returning 0 for success and -1 for error.

Revision 1.213 / (download) - annotate - [select for diffs], Mon Jun 3 19:58:02 2019 UTC (4 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.212: +2 -2 lines
Diff to previous 1.212 (unified) to selected 1.48 (unified)

Initialize the local variable "lastln" in mparse_buf_r().
While there is no bug, it logically makes sense given the meaning
of the variable that lastln is NULL as long as firstln is NULL.

Michal Nowak <mnowak at startmail dot com> reported that gcc 4.4.4
and 7.4.0 on illumos throw -Wuninitialized false positives.

Revision 1.212 / (download) - annotate - [select for diffs], Tue Mar 19 16:26:08 2019 UTC (5 years ago) by schwarze
Branch: MAIN
Changes since 1.211: +3 -1 lines
Diff to previous 1.211 (unified) to selected 1.48 (unified)

When the last line of the input is empty and the previous line reduced
the line input buffer to a length of one byte, do not write one byte
past the end of the line input buffer.  Minimal code to show the bug:
printf ".ds X\n.X\n\n" | MALLOC_OPTIONS=C mandoc
Bug found by bentley@ in the sysutils/rancid par(1) manual page.

Revision 1.211 / (download) - annotate - [select for diffs], Fri Jan 11 17:04:44 2019 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.210: +5 -3 lines
Diff to previous 1.210 (unified) to selected 1.48 (unified)

Improve error reporting when a file given on the command line
cannot be opened:
* Mention the filename.
* Report the errno for the file itself, not the one with .gz appended.

Revision 1.210 / (download) - annotate - [select for diffs], Mon Dec 31 04:55:47 2018 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.209: +2 -1 lines
Diff to previous 1.209 (unified) to selected 1.48 (unified)

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.209 / (download) - annotate - [select for diffs], Sun Dec 30 00:49:55 2018 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.208: +22 -26 lines
Diff to previous 1.208 (unified) to selected 1.48 (unified)

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.208 / (download) - annotate - [select for diffs], Thu Dec 20 21:30:32 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.207: +4 -4 lines
Diff to previous 1.207 (unified) to selected 1.48 (unified)

Move the full responsibility for reporting open(2) errors from
mparse_open() to the caller.  That is better because only the caller
knows its preferred reporting method and format and only the caller
has access to all the data that should be included - like the column
number in .so processing or the current manpath in makewhatis(8).
Moving the mandoc_msg() call out is possible because the caller can
call strerror(3) just as easily as mparse_open() can.

Move mandoc_msg_setinfilename() closer to the parsing of the file
contents, to avoid problems *with* the file (like non-existence,
lack of permissions, etc.) getting misreported as problems *in*
the file.

Fix the column number reported for .so failure:
let it point to the beginning of the filename.

Taken together, this prevents makewhatis(8) from spewing confusing
messages about .so failures to stderr, a bug reported by
Raf Czlonka <rczlonka at gmail dot com> on ports@.

It also prevents mandoc(1) from issuing *two* messages for every
single .so failure.

Revision 1.207 / (download) - annotate - [select for diffs], Fri Dec 14 06:33:14 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.206: +3 -3 lines
Diff to previous 1.206 (unified) to selected 1.48 (unified)

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.206 / (download) - annotate - [select for diffs], Fri Dec 14 05:18:03 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.205: +20 -22 lines
Diff to previous 1.205 (unified) to selected 1.48 (unified)

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.205 / (download) - annotate - [select for diffs], Fri Dec 14 02:16:21 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.204: +41 -40 lines
Diff to previous 1.204 (unified) to selected 1.48 (unified)

Fold mparse_parse_buffer() into mparse_readfd(), making the code
considerably more readable.  This is possible now that i finally
deleted mparse_readmem() from mandoc portable - an unused function
that never existed in OpenBSD.

This cleanup already made me find a minor bug: after a recursive
parse, restoring the line number of the parent file was forgotten.
This is fixed now.

Revision 1.204 / (download) - annotate - [select for diffs], Fri Dec 14 01:24:49 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.203: +1 -14 lines
Diff to previous 1.203 (unified) to selected 1.48 (unified)

Delete the function mparse_readmem() that has been unused for almost a
decade but regularly makes maintenance harder.  Mandoc is not a
general-purpose library, and being as pluggable as possible is not
among the goals of the project.

Revision 1.203 / (download) - annotate - [select for diffs], Fri Dec 14 01:18:26 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.202: +11 -299 lines
Diff to previous 1.202 (unified) to selected 1.48 (unified)

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.202 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:47 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.201: +2 -1 lines
Diff to previous 1.201 (unified) to selected 1.48 (unified)

Cleanup, no functional change:
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.

Revision 1.201 / (download) - annotate - [select for diffs], Thu Dec 13 06:18:20 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.200: +2 -1 lines
Diff to previous 1.200 (unified) to selected 1.48 (unified)

Cleanup, no functional change:
Move the roffhash_*() functions from roff.h to roff_int.h
because they are only intended for use by parsers,
neither by main programs nor by formatters.

Revision 1.200 / (download) - annotate - [select for diffs], Sat Aug 25 16:53:39 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.199: +3 -1 lines
Diff to previous 1.199 (unified) to selected 1.48 (unified)

Rudimentary implementation of the roff(7) .char (output glyph
definition) request, used for example by groff_hdtbl(7).

This simplistic implementation may interact incorrectly
with the .tr (input character translation) request.
But come on, you are not only using .char *and* .tr, but you do so
with respect to the same character in the same manual page?

Revision 1.199 / (download) - annotate - [select for diffs], Fri Aug 24 23:12:33 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.198: +119 -55 lines
Diff to previous 1.198 (unified) to selected 1.48 (unified)

Rudimentary implementation of the roff(7) .while request.
Needed for example by groff_hdtbl(7).

There are two limitations:
It does not support nested .while requests yet,
and each .while loop must start and end in the same scope.

The roff_parseln() return codes are now more flexible
and allow OR'ing options.

Revision 1.198 / (download) - annotate - [select for diffs], Thu Aug 23 19:33:27 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.197: +68 -71 lines
Diff to previous 1.197 (unified) to selected 1.48 (unified)

The upcoming .while request will have to re-execute roff(7) lines
parsed earlier, so they will have to be saved for reuse - but the
read.c preparser does not know yet whether a line contains a .while
request before passing it to the roff parser.  To cope with that,
save all parsed lines for now.  Even shortens the code by 20 lines.

Revision 1.197 / (download) - annotate - [select for diffs], Thu Aug 23 14:29:38 2018 UTC (5 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.196: +32 -12 lines
Diff to previous 1.196 (unified) to selected 1.48 (unified)

Implement the roff(7) .shift and .return requests,
for example used by groff_hdtbl(7) and groff_mom(7).

Also correctly interpolate arguments during nested macro execution
even after .shift and .return, implemented using a stack of argument
arrays.

Note that only read.c, but not roff.c can detect the end of a macro
execution, and the existence of .shift implies that arguments cannot
be interpolated up front, so unfortunately, this includes a partial
revert of roff.c rev. 1.337, moving argument interpolation back into
the function roff_res().

Revision 1.196 / (download) - annotate - [select for diffs], Sat Jul 28 18:34:15 2018 UTC (5 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.195: +3 -2 lines
Diff to previous 1.195 (unified) to selected 1.48 (unified)

Issue a STYLE message when normalizing the date format in .Dd/.TH.
Leah Neukirchen pointed out that mdoclint(1) used to warn about a
leading zero before the day number, so we know that both NetBSD and
Void Linux want the message.  It does no harm on OpenBSD because
Mdocdate always does the right thing anyway.
jmc@ agrees that it makes sense in contexts not using Mdocdate.

Revision 1.195 / (download) - annotate - [select for diffs], Fri Mar 16 15:05:44 2018 UTC (6 years ago) by schwarze
Branch: MAIN
Changes since 1.194: +2 -1 lines
Diff to previous 1.194 (unified) to selected 1.48 (unified)

Style message about bad input encoding of em-dashes as -- instead of \(em.
Suggested by Thomas Klausner <wiz at NetBSD>; discussed with jmc@.

Revision 1.194 / (download) - annotate - [select for diffs], Fri Feb 23 21:35:19 2018 UTC (6 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.193: +32 -7 lines
Diff to previous 1.193 (unified) to selected 1.48 (unified)

After opening a file with gzdopen(3), we have to call gzclose(3) or
we leak memory internally used by zlib to keep compression state.
Bug reported by Wolfgang Mueller <vehk at vehk dot de> who also
provided an incomplete patch, part of which i'm using in this commit.

Revision 1.193 / (download) - annotate - [select for diffs], Fri Nov 10 23:32:40 2017 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.192: +2 -2 lines
Diff to previous 1.192 (unified) to selected 1.48 (unified)

be less assertive when warning about a possible typo;
from jca@, ok jmc@

Revision 1.192 / (download) - annotate - [select for diffs], Thu Jul 20 14:36:36 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.191: +16 -10 lines
Diff to previous 1.191 (unified) to selected 1.48 (unified)

Do not call err(3) from the parser.  Call mandoc_vmsg() and
return failure such that we can continue with the next file.

Revision 1.191 / (download) - annotate - [select for diffs], Sat Jul 8 17:52:50 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.190: +2 -15 lines
Diff to previous 1.190 (unified) to selected 1.48 (unified)

Simplify by creating struct roff_node syntax tree nodes for tbl(7)
right from roff_parseln() rather than delegating to read.c,
similar to what i just did for eqn(7).

The interface function roff_span() becomes obsolete and is deleted,
the former interface function roff_addtbl() becomes static,
the interface functions tbl_read() and tbl_cdata() become void,
and minus twelve linus of code.

No functional change.

Revision 1.190 / (download) - annotate - [select for diffs], Sat Jul 8 14:51:04 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.189: +1 -4 lines
Diff to previous 1.189 (unified) to selected 1.48 (unified)

1. Eliminate struct eqn, instead use the existing members
of struct roff_node which is allocated for each equation anyway.
2. Do not keep a list of equation parsers, one parser is enough.
Minus fifty lines of code, no functional change.

Revision 1.189 / (download) - annotate - [select for diffs], Thu Jul 6 22:59:48 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.188: +9 -9 lines
Diff to previous 1.188 (unified) to selected 1.48 (unified)

Now that we have the -Wstyle message level, downgrade six warnings
that are not syntax mistakes and that do not cause wrong formatting
or content to style suggestions.
Also upgrade two warnings that may cause information loss to errors.

Revision 1.188 / (download) - annotate - [select for diffs], Tue Jul 4 14:40:38 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.187: +2 -2 lines
Diff to previous 1.187 (unified) to selected 1.48 (unified)

Printing "BASE:" in messages about violations of base system conventions
is confusing, simply print "STYLE:", which is intuitive and does not
sound excessively alarming; suggested by jmc@, OK tedu@ jmc@.

Revision 1.187 / (download) - annotate - [select for diffs], Mon Jul 3 17:33:06 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.186: +2 -2 lines
Diff to previous 1.186 (unified) to selected 1.48 (unified)

report trailing delimiters after macros where they are usually a mistake;
the idea came up in a discussion with Thomas Klausner <wiz at NetBSD>

Revision 1.186 / (download) - annotate - [select for diffs], Mon Jul 3 13:40:19 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.185: +2 -1 lines
Diff to previous 1.185 (unified) to selected 1.48 (unified)

warn about time machines; suggested by Thomas Klausner <wiz @ NetBSD>

Revision 1.185 / (download) - annotate - [select for diffs], Sun Jul 2 15:31:59 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.184: +2 -1 lines
Diff to previous 1.184 (unified) to selected 1.48 (unified)

add warning "cross reference to self"; inspired by mdoclint

Revision 1.184 / (download) - annotate - [select for diffs], Sat Jul 1 09:47:30 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.183: +2 -1 lines
Diff to previous 1.183 (unified) to selected 1.48 (unified)

Basic reporting of .Xrs to manual pages that don't exist
in the base system, inspired by mdoclint(1).

We are able to do this because (1) the -mdoc parser, the -Tlint validator,
and the man(1) manual page lookup code are all in the same program
and (2) the mandoc.db(5) database format allows fast lookup.

Feedback from, previous versions tested by, and OK jmc@.

A few features will be added to this in the tree, step by step.

Revision 1.183 / (download) - annotate - [select for diffs], Thu Jun 29 15:22:17 2017 UTC (6 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.182: +3 -1 lines
Diff to previous 1.182 (unified) to selected 1.48 (unified)

warn about some non-portable idioms in .Bl -column;
triggered by a question from Yuri Pankov (illumos)

Revision 1.182 / (download) - annotate - [select for diffs], Sun Jun 25 17:43:45 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.181: +2 -1 lines
Diff to previous 1.181 (unified) to selected 1.48 (unified)

Catch typos in .Sh names; suggested by jmc@.

I'm using a very simple, linear time / zero space fuzzy string
matching heuristic rather than a full Levenshtein metric, to keep
the code both simple and fast.

Revision 1.181 / (download) - annotate - [select for diffs], Sat Jun 24 18:58:33 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.180: +2 -1 lines
Diff to previous 1.180 (unified) to selected 1.48 (unified)

operating system dependent message about unknown architecture;
inspired by mdoclint

Revision 1.180 / (download) - annotate - [select for diffs], Sat Jun 24 15:59:50 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.179: +2 -1 lines
Diff to previous 1.179 (unified) to selected 1.48 (unified)

in the base system, suggest leaving .Os blank; inspired by mdoclint

Revision 1.179 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:33 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.178: +17 -13 lines
Diff to previous 1.178 (unified) to selected 1.48 (unified)

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.178 / (download) - annotate - [select for diffs], Sat Jun 17 23:07:00 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.177: +2 -1 lines
Diff to previous 1.177 (unified) to selected 1.48 (unified)

style message about duplicate RCS ids; inspired by mdoclint

Revision 1.177 / (download) - annotate - [select for diffs], Sat Jun 17 22:43:14 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.176: +2 -1 lines
Diff to previous 1.176 (unified) to selected 1.48 (unified)

style message about missing RCS ids; inspired by mdoclint

Revision 1.176 / (download) - annotate - [select for diffs], Sun Jun 11 19:37:01 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.175: +4 -1 lines
Diff to previous 1.175 (unified) to selected 1.48 (unified)

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.175 / (download) - annotate - [select for diffs], Sun Jun 11 17:16:51 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.174: +2 -1 lines
Diff to previous 1.174 (unified) to selected 1.48 (unified)

style message about missing .Fn markup; inspired by mdoclint

Revision 1.174 / (download) - annotate - [select for diffs], Sat Jun 10 01:48:53 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.173: +2 -1 lines
Diff to previous 1.173 (unified) to selected 1.48 (unified)

style message about missing blank before trailing delimiter;
inspired by mdoclint(1), and jmc@ considers it useful

Revision 1.173 / (download) - annotate - [select for diffs], Thu Jun 8 00:23:30 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.172: +2 -1 lines
Diff to previous 1.172 (unified) to selected 1.48 (unified)

warning about unknown .Lb arguments; inspired by mdoclint(1)

Revision 1.172 / (download) - annotate - [select for diffs], Wed Jun 7 23:29:48 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.171: +3 -1 lines
Diff to previous 1.171 (unified) to selected 1.48 (unified)

style checks related to .Er; inspired by mdoclint(1)

Revision 1.171 / (download) - annotate - [select for diffs], Tue Jun 6 15:01:04 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.170: +2 -1 lines
Diff to previous 1.170 (unified) to selected 1.48 (unified)

Minimal implementation of the roff(7) .ce request (center a number
of input lines without filling).
Contrary to groff, high-level macros abort .ce mode for now.

Revision 1.170 / (download) - annotate - [select for diffs], Sun Jun 4 00:13:15 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.169: +4 -70 lines
Diff to previous 1.169 (unified) to selected 1.48 (unified)

Pure preprocessor implementation of the roff(7) .ec and .eo requests
(escape character control), touching nothing after the preprocessing
stage and keeping even the state variable local to the preprocessor.
Since the escape character is also used for line continuation, this
requires pulling the implementation of line continuation from the
input reader to the preprocessor, which also considerably shortens
the code required for that.

When the escape character is changed, simply let the preprocessor
replace bare by escaped backslashes and instances of the non-standard
escape character with bare backslashes - that's all we need.

Oh, and if anybody dares to use these requests in OpenBSD manuals,
sending a medium-sized pack of axe-murderers after them might be a
worthwhile part of the punishment, but probably insuffient on its own.

Revision 1.169 / (download) - annotate - [select for diffs], Sat Jun 3 15:55:24 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.168: +2 -1 lines
Diff to previous 1.168 (unified) to selected 1.48 (unified)

ignore blank lines in man(7) next line scope;
strange groff edge case behaviour found in multimedia/mjpegtools

Revision 1.168 / (download) - annotate - [select for diffs], Thu Jun 1 15:25:39 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.167: +2 -1 lines
Diff to previous 1.167 (unified) to selected 1.48 (unified)

STYLE message about full stop at the end of .Nd; inspired by mdoclint(1)

Revision 1.167 / (download) - annotate - [select for diffs], Wed May 31 15:31:00 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.166: +2 -1 lines
Diff to previous 1.166 (unified) to selected 1.48 (unified)

STYLE message about missing use of Ox/Nx/Fx/Dx; OK jmc@ wiz@

Revision 1.166 / (download) - annotate - [select for diffs], Tue May 30 19:30:39 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.165: +4 -1 lines
Diff to previous 1.165 (unified) to selected 1.48 (unified)

STYLE message about useless macros we don't want (Bt Tn Ud);
not a WARNING because they don't endanger portability

Revision 1.165 / (download) - annotate - [select for diffs], Tue May 16 19:06:30 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.164: +4 -3 lines
Diff to previous 1.164 (unified) to selected 1.48 (unified)

Introduce a new mandoc(1) message level, -W style, below -W warning.
Switch -W all from meaning -W warning to meaning -W style.
The meaning of -T lint does *not* change, it still implies -W warning.
No messages on the new level yet, but they will come.

Usually, i do not lightly make the user interface larger.
But this has been planned for years, and EXIT STATUS 1
was reserved for it all the time.  The message system
is now stable enough to finally implement it.

jmc@ regarding the concept: "really good idea"

Revision 1.164 / (download) - annotate - [select for diffs], Sat Apr 29 12:45:42 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.163: +12 -7 lines
Diff to previous 1.163 (unified) to selected 1.48 (unified)

Parser unification: use nice ohashes for all three request and macro tables;
no functional change, minus two source files, minus 200 lines of code.

Revision 1.163 / (download) - annotate - [select for diffs], Tue Mar 7 20:00:08 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.162: +13 -9 lines
Diff to previous 1.162 (unified) to selected 1.48 (unified)

If a user-defined macro is aborted because it exceeds the stack
limit, usually due to infinite recursion, discard whatever remains
in all those open stack levels.  Otherwise, insane constructions
like the following could generate macros of enormous size, causing
mandoc(1) to die from memory exhaustion:

.de m  \" original macro definition
.m     \" recursion to blow up the stack
.de m  \" definition to be run during the call of .m marked (*)
very long plain text (some kilobytes)
.m     \" expand the above a thousand times while unwinding the stack
..     \" end of the original definition
.m     \" (*) recursively generate a ridiculously large macro
..     \" end of recursively generated definition
.m     \" execute the giant macro, exhausting memory

Very creative abuse found by tb@ with afl(1).

Revision 1.162 / (download) - annotate - [select for diffs], Mon Mar 6 17:26:05 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.161: +2 -1 lines
Diff to previous 1.161 (unified) to selected 1.48 (unified)

Using .Nd only makes sense in the NAME section.
Warn if that macro occurs elsewhere.
Triggered by a question from Dag-Erling Smoergrav <des @ FreeBSD>.

Revision 1.161 / (download) - annotate - [select for diffs], Sat Feb 18 17:29:28 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1
Changes since 1.160: +2 -4 lines
Diff to previous 1.160 (unified) to selected 1.48 (unified)

resolve trivial differences with OpenBSD:
* we include <sys/types.h> for size_t, so we don't need <stdint.h>
* sort declarations in read_whole_file()

Revision 1.160 / (download) - annotate - [select for diffs], Fri Feb 3 18:18:23 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.159: +7 -7 lines
Diff to previous 1.159 (unified) to selected 1.48 (unified)

Minor cleanup, no functional change:
We always have a roff parser, so mparse_free() does not need to check
for existence before freeing it.
Also arrange code in struct mparse, mparse_reset(), and mparse_free()
in the same order for readability.

Revision 1.159 / (download) - annotate - [select for diffs], Fri Feb 3 17:56:59 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.158: +2 -1 lines
Diff to previous 1.158 (unified) to selected 1.48 (unified)

If an application parses multiple files with mparse_readfd(3) but
without using mparse_open(3) to open the files, and if one of the
files includes a gzip'ed file with .so, then the gzip flag remains
set and the next main file will be expected to be gzip'ed.
Fix this by clearing the gzip flag in mparse_reset(3).

Bug found and patch provided by Michael <Stapelberg at debian dot org>.

Revision 1.158 / (download) - annotate - [select for diffs], Sat Jan 28 23:30:08 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.157: +2 -1 lines
Diff to previous 1.157 (unified) to selected 1.48 (unified)

Add a warning "new sentence, new line".
This does not attempt to pinpoint each and every offender, but
instead tries very hard to avoid false positives: Currently, there
are only two false positives in the whole OpenBSD base system.
Only do this in mdoc(7), not in man(7), because manuals written
in man(7) typically have much worse problems than this.
OK jmc@ on a previous version of the patch

Revision 1.157 / (download) - annotate - [select for diffs], Mon Jan 9 01:37:03 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.156: +8 -1 lines
Diff to previous 1.156 (unified) to selected 1.48 (unified)

Warnings and errors that occur during mdoc_validate()
or during man_validate() have to affect the mandoc(1) EXIT STATUS.
Many thanks to <Yuri dot Pankov at gmail dot com> (illumos developer)
for reporting this regression.

Revision 1.156 / (download) - annotate - [select for diffs], Sun Jan 8 00:11:24 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.155: +4 -3 lines
Diff to previous 1.155 (unified) to selected 1.48 (unified)

Stricter validation of the NAME section, in particular:
- require a comma between names
- reject all other text nodes
- reject all empty Nm below NAME, not only in the leading position
- reject Nm after Nd

Revision 1.155 / (download) - annotate - [select for diffs], Wed Dec 28 17:34:18 2016 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.154: +2 -1 lines
Diff to previous 1.154 (unified) to selected 1.48 (unified)

Make the second, section number argument of .Xr mandatory.
In fact, we have been requiring it for many years.
The only reason to not warn when it was missing
was excessive traditionalism - it was optional in 4.4BSD.

Revision 1.154 / (download) - annotate - [select for diffs], Wed Dec 7 22:59:29 2016 UTC (7 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.153: +4 -2 lines
Diff to previous 1.153 (unified) to selected 1.48 (unified)

When reporting "whitespace at end of input line" on lines ending with
roff(7) comments, let the column number in the message point to the
end of the line rather than to the beginning of the comment.
Improvement suggested by bluhm@.

Revision 1.153 / (download) - annotate - [select for diffs], Thu Nov 10 12:47:50 2016 UTC (7 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.152: +12 -6 lines
Diff to previous 1.152 (unified) to selected 1.48 (unified)

warn about trailing whitespace at the end of comments;
missing feature noticed by jmc@

Revision 1.152 / (download) - annotate - [select for diffs], Sun Oct 9 18:16:56 2016 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.151: +2 -2 lines
Diff to previous 1.151 (unified) to selected 1.48 (unified)

Delete complicated code dealing with .Bl -tag without -width,
and just let it default to -width 6n, which agrees with the
traditional -width Ds that is still in widespread use.

I just pushed a patch upstream to GNU roff that does the same for
groff_mdoc(7).  Before, groff contained code that was even more
complicated than mandoc, but both resulted in quite different
user-visible output.  Now, both agree, and output is nicer for both.

Useless complication noticed by Carsten Kunze (Heirloom roff).

Revision 1.151 / (download) - annotate - [select for diffs], Tue Jul 19 21:31:55 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.150: +1 -7 lines
Diff to previous 1.150 (unified) to selected 1.48 (unified)

Remove the dependency on SQLite without loss of functionality.
Stop supporting systems that don't have mmap(3).
Drop the obsolete names_check() now that we deleted MLINKS.

Revision 1.150 / (download) - annotate - [select for diffs], Tue Jul 19 16:22:52 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Branch point for: VERSION_1_13
Changes since 1.149: +3 -25 lines
Diff to previous 1.149 (unified) to selected 1.48 (unified)

Since the mdoc/man parser unification, the parser is always allocated
in mparse_alloc(), so delete all the curp->man == NULL checks.
Triggered by a patch from Christos Zoulas suggesting to add
yet another such check.

Revision 1.149 / (download) - annotate - [select for diffs], Sun Jul 10 13:34:30 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.148: +2 -2 lines
Diff to previous 1.148 (unified) to selected 1.48 (unified)

Fix a nasty typo that prevented .so links to gziped manuals
from working in the absence of a mandoc.db(5) database.
Found the hard way by Svyatoslav Mishyn on Crux Linux.

Revision 1.148 / (download) - annotate - [select for diffs], Fri Jan 8 02:53:13 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.147: +12 -12 lines
Diff to previous 1.147 (unified) to selected 1.48 (unified)

Simplify the mparse_open() interface.
Just return the file descriptor or -1 on error;
there is just one kind of error anyway.
Suggested by Christos Zoulas (NetBSD).

Revision 1.147 / (download) - annotate - [select for diffs], Fri Jan 8 02:13:39 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.146: +2 -5 lines
Diff to previous 1.146 (unified) to selected 1.48 (unified)

It was very surprising that a function called mparse_readfd()
closed the file descriptor passed to it after completing its work,
in particular considering the fact that it required its callers
to call open(2) or mparse_open() beforehand.

Change mparse_readfd() to not call close(2) and change the callers
to call close(2) afterwards, more or less bringing open and close
to the same level of the code and making review easier.  Note that
man.cgi(8) already did that, even though it was wrong in the past.

Small restructuring suggested by Christos Zoulas (NetBSD).

Revision 1.146 / (download) - annotate - [select for diffs], Sat Nov 7 14:22:29 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.145: +3 -1 lines
Diff to previous 1.145 (unified) to selected 1.48 (unified)

Without HAVE_ERR, don't try to include <err.h>, it probably isn't there.
In that case, the required prototypes are in "config.h".
Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.

Revision 1.145 / (download) - annotate - [select for diffs], Fri Oct 30 19:04:16 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.144: +2 -1 lines
Diff to previous 1.144 (unified) to selected 1.48 (unified)

If a .Bd block has no arguments at all, drop the block and only keep
its contents.  Removing a gratuitious difference to groff output
found after a related bug report from krw@.

Revision 1.144 / (download) - annotate - [select for diffs], Tue Oct 13 22:59:54 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.143: +3 -5 lines
Diff to previous 1.143 (unified) to selected 1.48 (unified)

Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table.
* Make the character table static in the chars.c module:
There is no need to pass a pointer around, we most certainly
never want to use two different character tables concurrently.
* No need to keep the characters in a separate file chars.in;
that merely encourages downstream porters to mess with them.
* Sort the characters to agree with the mandoc_chars(7) manual page.
* Specify Unicode codepoints in hex, not decimal (that's the detail
that originally triggered this patch).
No functional change, minus 100 LOC, and i don't see a performance change.

Revision 1.143 / (download) - annotate - [select for diffs], Sun Oct 11 21:12:55 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.142: +9 -13 lines
Diff to previous 1.142 (unified) to selected 1.48 (unified)

Finally use __progname, err(3) and warn(3).
That's more readable and less error-prone than fumbling around
with argv[0], fprintf(3), strerror(3), perror(3), and exit(3).

It's a bad idea to boycott good interfaces merely because standards
committees ignore them.  Instead, let's provide compatibility modules
for archaic systems (like commercial Solaris) that still don't have
them.  The compat module has an UCB Copyright (c) 1993...

Revision 1.142 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:19 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.141: +14 -14 lines
Diff to previous 1.141 (unified) to selected 1.48 (unified)

modernize style: "return" is not a function

Revision 1.141 / (download) - annotate - [select for diffs], Mon Sep 14 15:36:14 2015 UTC (8 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.140: +1 -2 lines
Diff to previous 1.140 (unified) to selected 1.48 (unified)

Remove the warning about children of .Vt blocks because actually,
.Vt type global_variable No = Dv defined_constant ;
is the best way to specify in the SYNOPSIS how a global variable
is initialized in the rare case where that matters.
Issue noticed by jmc@.

Revision 1.140 / (download) - annotate - [select for diffs], Sun Jul 19 06:05:16 2015 UTC (8 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.139: +33 -83 lines
Diff to previous 1.139 (unified) to selected 1.48 (unified)

Do not fork and exec gunzip(1), just link with libz instead.
As discussed with deraadt@, that's cleaner and will help tame(2).
Something like this was also suggested earlier by bapt at FreeBSD.
Minus 50 lines of code, deleting one interface function (mparse_wait),
no functional change intended.

Revision 1.139 / (download) - annotate - [select for diffs], Sun Apr 19 14:25:41 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.138: +7 -12 lines
Diff to previous 1.138 (unified) to selected 1.48 (unified)

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.138 / (download) - annotate - [select for diffs], Sun Apr 19 14:00:20 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.137: +5 -6 lines
Diff to previous 1.137 (unified) to selected 1.48 (unified)

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.137 / (download) - annotate - [select for diffs], Sat Apr 18 17:28:36 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.136: +25 -39 lines
Diff to previous 1.136 (unified) to selected 1.48 (unified)

Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().
Minus 80 lines of code, no functional change.
Written on the train from Koeln to Wolfsburg returning from p2k15.

Revision 1.136 / (download) - annotate - [select for diffs], Sat Apr 18 17:01:58 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +9 -3 lines
Diff to previous 1.135 (unified) to selected 1.48 (unified)

Move mdoc_hash_init() and man_hash_init() to libmandoc.h
and call them from mparse_alloc() and choose_parser(),
preparing unified allocation of struct roff_man.

Revision 1.135 / (download) - annotate - [select for diffs], Sat Apr 18 16:34:25 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.134: +40 -52 lines
Diff to previous 1.134 (unified) to selected 1.48 (unified)

Profit from the unified struct roff_man and reduce the number of
arguments of mparse_result() by one.  No functional change.
Written on the ICE Bruxelles-Koeln on the way back from p2k15.

Revision 1.134 / (download) - annotate - [select for diffs], Sat Apr 18 16:06:41 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +7 -7 lines
Diff to previous 1.133 (unified) to selected 1.48 (unified)

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.133 / (download) - annotate - [select for diffs], Thu Apr 2 21:36:50 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +6 -5 lines
Diff to previous 1.132 (unified) to selected 1.48 (unified)

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.132 / (download) - annotate - [select for diffs], Tue Mar 17 07:33:07 2015 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.131: +3 -1 lines
Diff to previous 1.131 (unified) to selected 1.48 (unified)

When the user exits the pager before the pager has drained all input
from man(1), man(1) dies from SIGPIPE.  Exiting man(1) is fine in this
case, generating more output would be pointless, but without handling
SIGPIPE, the exit code from man(1) was wrong and csh(1) printed an
ugly message "Broken pipe".  Fix this by handling SIGPIPE explicitly.
Issue noticed by deraadt@.

Revision 1.131 / (download) - annotate - [select for diffs], Wed Mar 11 13:05:20 2015 UTC (9 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (unified) to selected 1.48 (unified)

Fix previous: size_t is often narrower than off_t.
Cluestick applied by joerg at NetBSD.

Revision 1.130 / (download) - annotate - [select for diffs], Tue Mar 10 14:17:52 2015 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (unified) to selected 1.48 (unified)

The st_size member of struct stat is off_t, which is signed,
all required by POSIX.  So don't compare it against against
an unsigned constant.

Revision 1.129 / (download) - annotate - [select for diffs], Mon Mar 2 14:50:17 2015 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.128: +2 -1 lines
Diff to previous 1.128 (unified) to selected 1.48 (unified)

If a non-gz manual is read after a gzipped manual, refrain
from throwing a bogus error "wait: No child processes".
As reported by Baptiste Daroussin <bapt at FreeBSD dot org>,
clearing the state variable curp->child after use was forgotten.

Revision 1.128 / (download) - annotate - [select for diffs], Mon Feb 23 13:31:04 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.127: +5 -2 lines
Diff to previous 1.127 (unified) to selected 1.48 (unified)

improve NAME section diagnostics;
confusing messages reported by Jan Stary <hans at stare dot cz>

Revision 1.127 / (download) - annotate - [select for diffs], Fri Feb 20 22:40:38 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.126: +3 -2 lines
Diff to previous 1.126 (unified) to selected 1.48 (unified)

Completely delete all carriage return characters from the input.
No change to messages about them (ignore them right before line feeds,
report errors elsewhere).
naddy@ found a manual in the wild containing lots of these (ysm(1)),
and i can't imagine a situation where dropping them could be problematic.

Revision 1.126 / (download) - annotate - [select for diffs], Fri Feb 6 16:06:25 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.125: +3 -2 lines
Diff to previous 1.125 (unified) to selected 1.48 (unified)

replace the last legacy generic message type, "argument count wrong",
by more specific messages, improving diagnostics for .cc .tr .Bl -column

Revision 1.125 / (download) - annotate - [select for diffs], Fri Feb 6 11:54:36 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.124: +3 -1 lines
Diff to previous 1.124 (unified) to selected 1.48 (unified)

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

Revision 1.124 / (download) - annotate - [select for diffs], Fri Feb 6 07:13:14 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.123: +2 -2 lines
Diff to previous 1.123 (unified) to selected 1.48 (unified)

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.123 / (download) - annotate - [select for diffs], Fri Feb 6 03:38:45 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.122: +2 -1 lines
Diff to previous 1.122 (unified) to selected 1.48 (unified)

better handle .Fo and .Fd without argument
better handle .Fo with more than one argument

Revision 1.122 / (download) - annotate - [select for diffs], Wed Feb 4 18:03:48 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.121: +2 -1 lines
Diff to previous 1.121 (unified) to selected 1.48 (unified)

discard .Rs head arguments and improve .Rs diagnostics

Revision 1.121 / (download) - annotate - [select for diffs], Wed Feb 4 16:38:56 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.120: +2 -1 lines
Diff to previous 1.120 (unified) to selected 1.48 (unified)

more specific .Nd diagnostics, allowing to get rid of enum check_lvl
and the respective argument of check_count()

Revision 1.120 / (download) - annotate - [select for diffs], Wed Jan 28 21:11:54 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +1 -7 lines
Diff to previous 1.119 (unified) to selected 1.48 (unified)

Clean up eqn(7) error handling:
* When "define" fails, do not drop the whole equation.
* Free memory after "undef".
* Use standard mandoc error types instead of rolling our own.
* Delete obfuscating EQN_MSG() macro.
* Add function prototypes while here.

Revision 1.119 / (download) - annotate - [select for diffs], Wed Jan 28 17:32:07 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.118: +6 -6 lines
Diff to previous 1.118 (unified) to selected 1.48 (unified)

* Polish tbl(7) error reporting.
* Do not print out macro names in tbl(7) data blocks.
* Like with GNU tbl, let empty tables cause a blank line.
* Avoid producing empty tables in -Tman.

Revision 1.118 / (download) - annotate - [select for diffs], Mon Jan 26 18:42:30 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.117: +10 -3 lines
Diff to previous 1.117 (unified) to selected 1.48 (unified)

Rework tbl(7) layout parsing:
* Continue parsing even if part of the input is invalid.
* Do not require whitespace between cell specifications.
* Allow tabs as well as blanks between modifiers.
* Mark the 'm' modifier as unsupported.
* Parse and ignore the 'p' and 'v' modifiers.
* Better warning and error messages.
* Get rid of a static buffer.
Improved functionality but minus 50 lines of code.

Revision 1.117 / (download) - annotate - [select for diffs], Mon Jan 26 13:03:48 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.116: +2 -1 lines
Diff to previous 1.116 (unified) to selected 1.48 (unified)

More improvements regarding tbl(7) options.
* Treat "allbox" as an alias for "box" for now.
* Parse and ignore the GNU tbl "nowarn" option.
* For separation, allow spaces, tabs, and commas only.
* Mark eqn(7) within tbl(7) as unsupported.
* Simplify the option table.
* Improve and sort documentation.

Revision 1.116 / (download) - annotate - [select for diffs], Mon Jan 26 00:57:22 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +5 -3 lines
Diff to previous 1.115 (unified) to selected 1.48 (unified)

Improve (or rather, rewrite) tbl(7) option parsing.
* Allow the layout to start after the semicolon on the options line.
* Ignore leading commas.
* Option arguments cannot contain closing parentheses.
* Avoid needless UNSUPP messages.
* Better ERROR reporting.
* Delete unused "linesize" field in struct tbl_opts.
* No need for static buffers.
* Garbage collect one almost empty wrapper function.
Improved functionality, but minus 40 lines of code.

Revision 1.115 / (download) - annotate - [select for diffs], Sat Jan 24 01:58:33 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +2 -1 lines
Diff to previous 1.114 (unified) to selected 1.48 (unified)

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

Revision 1.114 / (download) - annotate - [select for diffs], Thu Jan 22 21:38:16 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +9 -7 lines
Diff to previous 1.113 (unified) to selected 1.48 (unified)

Traditional roff(7) explicitly allows certain control characters
in the input stream (SOH, STX, ETX, ENQ, ACK, BEL, BS) for specific
purposes (leaders, backspace, delimiters, .tr), but making sure
these don't leak through to the output is tricky, so mark them as
unsupported for now.

Revision 1.113 / (download) - annotate - [select for diffs], Thu Jan 22 19:26:50 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +7 -3 lines
Diff to previous 1.112 (unified) to selected 1.48 (unified)

Don't let a failing mparse_open() clobber the filename pointer;
fixes error message content and a use after free
for .so with non-existent target when -Wall or -Tlint is given.

Revision 1.112 / (download) - annotate - [select for diffs], Tue Jan 20 21:16:51 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +13 -9 lines
Diff to previous 1.111 (unified) to selected 1.48 (unified)

Split the -Werror message level into -Werror (broken manual, probably
using mandoc is better than using groff) and -Wunsupp (manual using
unsupported low-level roff(7) feature, probably using groff is better
than using mandoc).  Once this feature is complete, it is intended
to help porting, making the decision whether to USE_GROFF easier.

As a first step, distinguish four classes of roff(7) requests:
1. Supported (currently 24 requests)
2. Currently ignored because unimportant (120)  ->  no message
3. Ignored for good because insecure (14)  ->  -Werror
4. Currently unsupported (68)  ->  these trigger the new -Wunsupp messages

Revision 1.111 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:40 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +12 -41 lines
Diff to previous 1.110 (unified) to selected 1.48 (unified)

Fatal errors no longer exist.
If a file can be opened, mandoc will produce some output;
at worst, the output may be almost empty.
Simplifies error handling and frees a message type for future use.

Revision 1.110 / (download) - annotate - [select for diffs], Thu Jan 15 02:29:26 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +18 -16 lines
Diff to previous 1.109 (unified) to selected 1.48 (unified)

downgrade .so failure from FATAL to ERROR

Revision 1.109 / (download) - annotate - [select for diffs], Wed Jan 14 22:58:16 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +2 -5 lines
Diff to previous 1.108 (unified) to selected 1.48 (unified)

downgrade ".so with absolute path" from FATAL to ERROR;
allows to get rid of ROFF_ERR

Revision 1.108 / (download) - annotate - [select for diffs], Wed Jan 14 22:02:50 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +15 -32 lines
Diff to previous 1.107 (unified) to selected 1.48 (unified)

To get rid of SYSERR entries in enum mandocerr, downgrade problems with
missing and unreadable files from SYSERR to ERROR.
Needed for upcoming work.
As a bonus, this minimally simplifies code and documentation.

Revision 1.107 / (download) - annotate - [select for diffs], Wed Jan 14 17:49:15 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +16 -35 lines
Diff to previous 1.106 (unified) to selected 1.48 (unified)

Simplify handling of system errors: just exit(3).
We already do the same for malloc(3) failure.
The is no virtue in trying to survive failure of fork(2) and the like.

Revision 1.106 / (download) - annotate - [select for diffs], Sun Dec 28 14:42:27 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.105: +7 -4 lines
Diff to previous 1.105 (unified) to selected 1.48 (unified)

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.105 / (download) - annotate - [select for diffs], Tue Dec 16 23:44:41 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.104: +2 -1 lines
Diff to previous 1.104 (unified) to selected 1.48 (unified)

Ignore mdoc(7) and man(7) macros inside tbl(7) code because they
would abort the table in an unclean way, causing assertion failures
found by jsg@.

Revision 1.104 / (download) - annotate - [select for diffs], Mon Dec 1 04:14:14 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.103: +3 -4 lines
Diff to previous 1.103 (unified) to selected 1.48 (unified)

The file read.c is part of the parser, so it cannot include main.h,
which is not part of the parser.  Besides, the parser *does* modify
the input buffer, so marking it "const" in the mparse_readmem()
interface is an outright lie.  Fix all this by killing the const,
the UNCONST, and the bogus inclusion.

Revision 1.103 / (download) - annotate - [select for diffs], Sun Nov 30 05:29:00 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +2 -1 lines
Diff to previous 1.102 (unified) to selected 1.48 (unified)

Multiple fixes with respect to .Pf:
* The first argument of .Pf is not parsed.
* Normal delimiter handling does not apply to the first argument of .Pf.
* Warn if nothing follows a prefix (inspired by groff_mdoc(7)).
* In that case, do not suppress spacing.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Nov 30 02:36:38 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.101: +2 -1 lines
Diff to previous 1.101 (unified) to selected 1.48 (unified)

warn about attempts to call non-callable macros;
inspired by a similar warning in the groff_mdoc(7) macros

Revision 1.101 / (download) - annotate - [select for diffs], Fri Nov 28 18:09:01 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +1 -2 lines
Diff to previous 1.100 (unified) to selected 1.48 (unified)

Drop useless architecture table.  Validating architecture names
is a job for makewhatis(8)/mandoc.db(5), not for the parser.
Removes 150 lines from source files and 4k (1%) from the binary.
Bloat found by deraadt@.

Revision 1.100 / (download) - annotate - [select for diffs], Fri Nov 28 06:27:05 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +17 -30 lines
Diff to previous 1.99 (unified) to selected 1.48 (unified)

Simplify by making the eqn and tbl steering functions void;
no functional change, minus 15 lines of code.

Revision 1.99 / (download) - annotate - [select for diffs], Thu Nov 27 23:40:19 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (unified) to selected 1.48 (unified)

Downgrade .Bd -file from FATAL to ERROR.
Since this was the last remaining FATAL error in this area,
this change will allow major simplifications in the mdoc(7) parser.

Revision 1.98 / (download) - annotate - [select for diffs], Wed Nov 26 23:42:14 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.97: +43 -23 lines
Diff to previous 1.97 (unified) to selected 1.48 (unified)

Let mparse_readfd() use mparse_open() and mparse_wait()
and let mparse_open() fall back to .gz files
such that .so works even when the target is zipped,
requested by and in part using ideas from <bapt at FreeBSD>.
While here, make sure files are readable before forking,
both for efficiency and for better error reporting.

Revision 1.97 / (download) - annotate - [select for diffs], Wed Nov 26 21:40:17 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +11 -8 lines
Diff to previous 1.96 (unified) to selected 1.48 (unified)

Simplify the mparse_open()/mparse_wait() interface.
Don't bother the user with the PID of the child process,
store it inside the opaque mparse handle.

Revision 1.96 / (download) - annotate - [select for diffs], Sat Nov 1 06:03:13 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +2 -3 lines
Diff to previous 1.95 (unified) to selected 1.48 (unified)

Use struct buf in libroff, it is very natural there
and reduces the number of arguments of many functions.
While here, sprinkle some KNF.
No functional change.

Revision 1.95 / (download) - annotate - [select for diffs], Sat Nov 1 04:08:43 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +32 -38 lines
Diff to previous 1.94 (unified) to selected 1.48 (unified)

Refactor, no functional change: Remove the parse point from struct buf.
Some functions need multiple parse points, some none at all,
and it varies whether any of them need to be passed around.
So better pass them as a separate argument, and only when needed.

Revision 1.94 / (download) - annotate - [select for diffs], Tue Oct 28 17:36:19 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +6 -4 lines
Diff to previous 1.93 (unified) to selected 1.48 (unified)

Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones.
This requires mchars_spec2cp() to report unknown names again.
Fortunately, that doesn't require changing the calling code because
according to groff, invalid character escapes should not produce
output anyway, and now that we warn about them, that's fine.

Revision 1.93 / (download) - annotate - [select for diffs], Sat Oct 25 01:03:52 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +53 -20 lines
Diff to previous 1.92 (unified) to selected 1.48 (unified)

integrate preconv(1) into mandoc(1);
enhances functionality and reduces code and docs by more than 300 lines

Revision 1.92 / (download) - annotate - [select for diffs], Mon Oct 20 19:04:45 2014 UTC (9 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.91: +2 -1 lines
Diff to previous 1.91 (unified) to selected 1.48 (unified)

Protect the roff parser from dividing by zero.  ok schwarze@

Revision 1.91 / (download) - annotate - [select for diffs], Sat Oct 18 15:57:34 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +10 -12 lines
Diff to previous 1.90 (unified) to selected 1.48 (unified)

plug file descriptor leaks on read or write failure;
hinted at by Steffen Nurpmeso <sdaoden at yandex dot com>.

Revision 1.90 / (download) - annotate - [select for diffs], Sun Oct 12 19:31:41 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +2 -2 lines
Diff to previous 1.89 (unified) to selected 1.48 (unified)

Improve error handling in the eqn(7) parser.
Get rid of the first fatal error, MANDOCERR_EQNSYNT.
In eqn(7), there is no need to be bug-compatible with groff, so there
is no need to abondon the whole equation in case of a syntax error.

In particular:
* Skip "back", "delim", "down", "fwd", "gfont", "gsize", "left",
  "right", "size", and "up" without arguments.
* Skip "gsize" and "size" with a non-numeric argument.
* Skip closing delimiters that are not open.
* Skip "above" outside piles.
* For diacritic marks and binary operators without a left operand,
  default to an empty box.
* Let piles and matrices take one argument rather than insisting
  on a braced list.  Let HTML output handle that, too.
* When rewinding, if the root box is guaranteed to match
  the termination condition, no error handling is needed.

Revision 1.89 / (download) - annotate - [select for diffs], Sat Oct 11 21:14:16 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +2 -1 lines
Diff to previous 1.88 (unified) to selected 1.48 (unified)

warn about parentheses in function names after .Fn and .Fo;
particularly useful when converting from other languages to mdoc(7);
feature suggested by bentley@

Revision 1.88 / (download) - annotate - [select for diffs], Fri Sep 12 00:54:10 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +2 -1 lines
Diff to previous 1.87 (unified) to selected 1.48 (unified)

warn about commas in function arguments; inspired by mdoclint(1)

Revision 1.87 / (download) - annotate - [select for diffs], Thu Sep 11 23:53:30 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +3 -1 lines
Diff to previous 1.86 (unified) to selected 1.48 (unified)

warn about botched .Xr ordering and punctuation below SEE ALSO;
inspired by mdoclint(1)

Revision 1.86 / (download) - annotate - [select for diffs], Sun Sep 7 23:25:01 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +2 -1 lines
Diff to previous 1.85 (unified) to selected 1.48 (unified)

warn about AUTHORS sections without .An macros, inspired by mdoclint(1)

Revision 1.85 / (download) - annotate - [select for diffs], Sun Sep 7 02:17:40 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +5 -2 lines
Diff to previous 1.84 (unified) to selected 1.48 (unified)

always use the right buffer, and fix one evil typo

Revision 1.84 / (download) - annotate - [select for diffs], Sat Sep 6 23:24:32 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +5 -16 lines
Diff to previous 1.83 (unified) to selected 1.48 (unified)

Simplify by handling empty request lines at the one logical place
in the roff parser instead of in three other places in other parsers.
No functional change.

Revision 1.83 / (download) - annotate - [select for diffs], Sat Sep 6 22:39:36 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +42 -27 lines
Diff to previous 1.82 (unified) to selected 1.48 (unified)

Move main format autodetection from the parser dispatcher to the
roff parser where .Dd and .TH are already detected, anyway.  This
improves robustness because it correctly handles whitespace or an
alternate control character before Dd.  In the parser dispatcher,
provide a fallback looking ahead in the input buffer instead of
always assuming man(7).  This corrects autodetection when Dd is
preceded by other macros or macro-like handled requests like .ll.

Triggered by reports from Daniel Levai about issues on Slackware Linux.

Revision 1.82 / (download) - annotate - [select for diffs], Wed Sep 3 23:21:47 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +96 -3 lines
Diff to previous 1.81 (unified) to selected 1.48 (unified)

Add *.gz support to apropos(1) -a, man(1), and even mandoc(1).
Implemented by moving the zip code from makewhatis(8) to the parser lib.

Revision 1.81 / (download) - annotate - [select for diffs], Sat Aug 16 19:00:01 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +4 -4 lines
Diff to previous 1.80 (unified) to selected 1.48 (unified)

Improve build system and autodetection.
* Make ./configure standalone, that's what people expect.
* Let people write a ./configure.local from scratch, not edit existing files.
* Autodetect wchar, sqlite3, and manpath and act accordingly.
* Autodetect the need for -L/usr/local/lib and -lutil.
* Get rid of config.h.p{re,ost}, let ./configure only write what's needed.
* Let ./configure write a Makefile.local snippet, that's quite flexible.

Revision 1.80 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_4, VERSION_1_12
Changes since 1.79: +4 -5 lines
Diff to previous 1.79 (unified) to selected 1.48 (unified)

Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.

Revision 1.79 / (download) - annotate - [select for diffs], Wed Aug 6 15:09:05 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.78: +8 -5 lines
Diff to previous 1.78 (unified) to selected 1.48 (unified)

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.78 / (download) - annotate - [select for diffs], Fri Aug 1 17:27:44 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +9 -9 lines
Diff to previous 1.77 (unified) to selected 1.48 (unified)

mention requests and macros in more messages

Revision 1.77 / (download) - annotate - [select for diffs], Fri Aug 1 15:08:46 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +1 -2 lines
Diff to previous 1.76 (unified) to selected 1.48 (unified)

Dynamically allocate the stack of roff(7) .ie condition values
and thus get rid of the last useless fatal error.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Jul 31 09:22:21 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +3 -2 lines
Diff to previous 1.75 (unified) to selected 1.48 (unified)

Split MANDOCERR_IGNARGV into one message for .An and one for .Bl
and report the macro name and argument.

Revision 1.75 / (download) - annotate - [select for diffs], Thu Jul 31 00:41:10 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14
Changes since 1.74: +1 -2 lines
Diff to previous 1.74 (unified) to selected 1.48 (unified)

In .Bl -column, if some of the column width declarations are given
right after the -column argument and some at the very end of the
argument list, after some other arguments like -compact, concatenate
the column lists.
This gets rid of one of the last useless FATAL errors
and actually shortens the code by a few lines.

This fixes an issue introduced more than five years ago, at first
causing an assert() since mdoc_action.c rev. 1.14 (June 17, 2009),
then later a FATAL error since mdoc_validate rev. 1.130 (Nov. 30, 2010),
and marked as "TODO" ever since.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Jul 30 23:38:52 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +1 -2 lines
Diff to previous 1.73 (unified) to selected 1.48 (unified)

Remove the useless FATAL error "argument count wrong, violates syntax".
The last remaining instance was .It in .Bl -column with more than one
excessive .Ta.  However, simply downgrading from FATAL to ERROR, it just
works fine, almost the same way as in groff, without any other changes.

Revision 1.73 / (download) - annotate - [select for diffs], Wed Jul 30 17:06:26 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (unified) to selected 1.48 (unified)

Get rid of the useless FATAL error "child violates parent syntax".
When finding items outside lists, simply skip them and throw an ERROR.
Handle subsections before the first section instead of bailing out.

Revision 1.72 / (download) - annotate - [select for diffs], Wed Jul 30 14:50:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +22 -18 lines
Diff to previous 1.71 (unified) to selected 1.48 (unified)

Remove two useless FATAL errors.
When a file contains neither text nor macros, treat it as an empty document.
When the mdoc(7) document prologue is incomplete, use some default values.

Revision 1.71 / (download) - annotate - [select for diffs], Wed Jul 30 12:58:21 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +4 -4 lines
Diff to previous 1.70 (unified) to selected 1.48 (unified)

better name and wording for the last two non-generic errors

Revision 1.70 / (download) - annotate - [select for diffs], Wed Jul 30 00:19:16 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +3 -2 lines
Diff to previous 1.69 (unified) to selected 1.48 (unified)

Various improvements related to .Ex and .Rv:
* let .Nm fall back to the empty string, not to UNKNOWN
* never let .Rv copy an argument from .Nm
* avoid spurious \fR after empty .Nm in -Tman
* correct handling of .Ex and .Rv in -Tman
* correct the wording of the output for .Rv without arguments
* use non-breaking spaces in .Ex and .Rv output where required
* split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm

Revision 1.69 / (download) - annotate - [select for diffs], Wed Jul 9 11:31:43 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +3 -3 lines
Diff to previous 1.68 (unified) to selected 1.48 (unified)

mark defos as const; nobody needs to change it,
and it is occasionally useful to be able to pass literal strings

Revision 1.68 / (download) - annotate - [select for diffs], Mon Jul 7 21:36:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +9 -6 lines
Diff to previous 1.67 (unified) to selected 1.48 (unified)

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

Revision 1.67 / (download) - annotate - [select for diffs], Mon Jul 7 16:12:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (unified) to selected 1.48 (unified)

no need to delete any content from .Rs blocks,
and downgrade the related message from ERROR to WARNING

Revision 1.66 / (download) - annotate - [select for diffs], Mon Jul 7 15:03:43 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +1 -2 lines
Diff to previous 1.65 (unified) to selected 1.48 (unified)

no need to skip content before first section header

Revision 1.65 / (download) - annotate - [select for diffs], Mon Jul 7 11:35:06 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +1 -2 lines
Diff to previous 1.64 (unified) to selected 1.48 (unified)

implement .dei and .ami

Revision 1.64 / (download) - annotate - [select for diffs], Sun Jul 6 19:09:00 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +7 -6 lines
Diff to previous 1.63 (unified) to selected 1.48 (unified)

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

Revision 1.63 / (download) - annotate - [select for diffs], Sat Jul 5 12:34:17 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +6 -7 lines
Diff to previous 1.62 (unified) to selected 1.48 (unified)

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.62 / (download) - annotate - [select for diffs], Sat Jul 5 01:12:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +2 -1 lines
Diff to previous 1.61 (unified) to selected 1.48 (unified)

Cleanup regarding -offset and -width:
* Bugfix: Last one wins, not first one.
* Fix .Bl -width without argument: it means 0n, so do not ignore it.
* Report macro names, argument names and fallbacks in related messages.
* Simplify: Garbage collect auxiliary variables in pre_bd() and pre_bl().

Revision 1.61 / (download) - annotate - [select for diffs], Fri Jul 4 16:12:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +5 -4 lines
Diff to previous 1.60 (unified) to selected 1.48 (unified)

Clean up messages regarding excess arguments:
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jul 4 01:50:07 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +8 -8 lines
Diff to previous 1.59 (unified) to selected 1.48 (unified)

Clean up messages related to missing arguments.
* Do not warn about empty -column cells, they seem valid to me.
* Downgrade empty item and missing -std from ERROR to WARNING.
* Hierarchical naming.
* Descriptive, not imperative style.
* Mention macro names, argument names, and fallbacks.
* Garbage collect some unreachable code in post_it().

Revision 1.59 / (download) - annotate - [select for diffs], Thu Jul 3 23:24:56 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (unified) to selected 1.48 (unified)

Fix formatting of empty .Bl -inset item heads.
Downgrade empty item heads from ERROR to WARNING.
Show the list type in the error message.
Choose better variable names for nodes in post_it().

Revision 1.58 / (download) - annotate - [select for diffs], Thu Jul 3 21:23:54 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +3 -1 lines
Diff to previous 1.57 (unified) to selected 1.48 (unified)

MANDOCERR_NOARGS reported three completely unrelated classes of problems.
Split the roff(7) parts out of it and report the request names for these cases.

Revision 1.57 / (download) - annotate - [select for diffs], Wed Jul 2 13:10:45 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +4 -2 lines
Diff to previous 1.56 (unified) to selected 1.48 (unified)

Disentangle the MANDOCERR_CHILD message, which reported three
completely different things, into three distinct messages.
Also mention the macro names we are talking about.

Revision 1.56 / (download) - annotate - [select for diffs], Wed Jul 2 11:43:20 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +3 -3 lines
Diff to previous 1.55 (unified) to selected 1.48 (unified)

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.55 / (download) - annotate - [select for diffs], Wed Jul 2 03:48:07 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (unified) to selected 1.48 (unified)

Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,
since this is hardly more complicated than explicitly ignoring them
as we did in the past.  Of course, do not use them!

Revision 1.54 / (download) - annotate - [select for diffs], Tue Jul 1 22:37:15 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +11 -11 lines
Diff to previous 1.53 (unified) to selected 1.48 (unified)

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.53 / (download) - annotate - [select for diffs], Mon Jun 30 23:45:08 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +1 -5 lines
Diff to previous 1.52 (unified) to selected 1.48 (unified)

garbage collect two unused enum mandocerr items
and fix a couple of comments while here

Revision 1.52 / (download) - annotate - [select for diffs], Wed Jun 25 00:20:19 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +7 -2 lines
Diff to previous 1.51 (unified) to selected 1.48 (unified)

Improve messages related to the roff(7) .so request.

In all these messages, show the filename argument that was passed
to the .so request.

In case of failure, show an additional message reporting the file
and the line number where the failing request was found.
The existing message reporting the reason for the failure -
for example, "Permission denied" - is left in place, unchanged.

Inspired by a question asked by Nick@ after he saw the
confusing old messages that used to be emitted in this area.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Jun 21 22:24:01 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (unified) to selected 1.48 (unified)

Reduce the verbosity of error messages caused by open(2) failures.
Suggested by and ok jmc@.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Jun 20 23:02:31 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.49: +4 -3 lines
Diff to previous 1.49 (unified) to selected 1.48 (unified)

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.49 / (download) - annotate - [select for diffs], Fri Jun 20 17:24:00 2014 UTC (9 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (unified)

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.48 / (download) - annotate - [selected], Sun Apr 20 22:04:04 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (unified)

in debug messages, truncating strings of excessive lengths is actually
a good thing, so cast the return value from sprintf to (void);
this concludes the mandoc sprintf audit

Revision 1.47 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:05 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +49 -50 lines
Diff to previous 1.46 (unified) to selected 1.48 (unified)

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

Revision 1.46 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.45: +2 -1 lines
Diff to previous 1.45 (unified) to selected 1.48 (unified)

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.45 / (download) - annotate - [select for diffs], Wed Mar 19 22:20:43 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.44: +20 -3 lines
Diff to previous 1.44 (unified) to selected 1.48 (unified)

Without the MPARSE_SO option, if the file contains nothing but a
single .so request, do not read the file pointed to, but instead
let mparse_result() provide the file name pointed to as a return
value.  To be used by makewhatis(8) in the future.

Revision 1.44 / (download) - annotate - [select for diffs], Wed Mar 19 21:51:20 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.43: +17 -19 lines
Diff to previous 1.43 (unified) to selected 1.48 (unified)

Generalize the mparse_alloc() and roff_alloc() functions by giving
them an "options" argument, replacing the existing "inttype" and
"quick" arguments, preparing for a future MPARSE_SO option.
Store this argument in struct mparse and struct roff, replacing the
existing "inttype", "parsetype", and "quick" members.
No functional change except one tiny cosmetic fix in roff_TH().

Revision 1.43 / (download) - annotate - [select for diffs], Mon Jan 6 21:34:31 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (unified) to selected 1.48 (unified)

Another 25% speedup for mandocdb(8) -Q mode, found with gprof(1).
For /usr/share/man, we only need 56% of the time of makewhatis(8) now.

In groff, user-defined macros clashing with mdoc(7) or man(7)
standard macros are cleared when parsing the .Dd or .TH macro,
respectively.  Of course, we continue doing that in standard mode
to assure full groff bug compatibility.

However, in -Q mode, full groff bug compatibility makes no sense
when it's unreasonably expensive, so skip this step in -Q mode.
Real-world manuals hardly ever redefine standard macros,
that's terrible style, and if they do, it's pointless to do so
before .Dd or .TH because it has no effect.  Even if someone does,
it's extremely unlikely to break mandocdb(8) -Q parsing because we
abort the parse sequence after the NAME section, anyway.

So if you manually redefine .Sh, .Nm, .Nd, or .SH in a way that doesn't
work at all and rely on .Dd or .TH to fix it up for you, your broken
manual will no longer get a perfect apropos(1) entry until you re-run
mandocdb(8) without -Q.  It think that consequence is acceptable
in order to get a 25% speedup for everyone else.

Revision 1.42 / (download) - annotate - [select for diffs], Mon Jan 6 00:53:33 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +2 -1 lines
Diff to previous 1.41 (unified) to selected 1.48 (unified)

Joerg Sonnenberger contributed copyrightable amounts of text to
some files.  To make it clear that he also put his contributions
under the ISC license, with his explicit permission, add his
Copyright notice to the relevant files.  No code change.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Jan 5 20:26:36 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.40: +11 -9 lines
Diff to previous 1.40 (unified) to selected 1.48 (unified)

Add an option -Q (quick) to mandocdb(8)
for accelerated generation of reduced-size databases.

Implement this by allowing the parsers to optionally
abort the parse sequence after the NAME section.

While here, garbage collect the unused void *arg attribute of
struct mparse and mparse_alloc() and fix some errors in mandoc(3).

This reduces the processing time of mandocdb(8) on /usr/share/man
by a factor of 2 and the database size by a factor of 4.
However, it still takes 5 times the time and 6 times the space
of makewhatis(8), so more work is clearly needed.

Revision 1.40 / (download) - annotate - [select for diffs], Thu Jan 2 16:29:55 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.39: +41 -17 lines
Diff to previous 1.39 (unified) to selected 1.48 (unified)

Since the functions in read.c are part of the mandoc(3) library,
do not print to stderr.  Instead, properly use the mmsg callback.
Issue noticed by Abhinav Upadhyay <er dot abhinav dot upadhyay
at gmail dot com> and Thomas Klausner <wiz at NetBSD>.

Revision 1.39 / (download) - annotate - [select for diffs], Mon Sep 16 00:25:07 2013 UTC (10 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3, VERSION_1_12_2
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (unified) to selected 1.48 (unified)

One of the WARNING messages has to use the word "section" twice in two
different meanings, that cannot be helped.  But we can make this less
confusing by stating that the second instance refers to stuff like (2),
(3), and (9), and by adding the sections header the first instance
refers to, for example ERRORS or RETURN VALUES.

Source for confusion noticed by Jan Stary <hans at stare dot cz>,
better wording suggested by jmc@, tweaked by me.

Revision 1.38 / (download) - annotate - [select for diffs], Sat Jul 13 12:52:07 2013 UTC (10 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.37: +2 -1 lines
Diff to previous 1.37 (unified) to selected 1.48 (unified)

Rudimentary implementation of the .it request (input line trap).
As with any low-level roff request involving subtle interactions
with macro internals, this implementation is not exact, but it
does handle the simplest cases.

This request occurs in man(7) code generated from DocBook,
for example mysql(1) and yasm_arch(7).
Thanks to brad@ for reporting the issue back in January 2011.

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jun 2 03:52:21 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.36: +4 -7 lines
Diff to previous 1.36 (unified) to selected 1.48 (unified)

Sync to OpenBSD, no functional change:
* Add the missing mparse_parse_buffer prototype.
* Drop the useless MAP_FILE constant: It's not specified in POSIX,
  so it's not required, it's the default anyway, and it's 0 anyway.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Jun 1 22:57:35 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.35: +18 -19 lines
Diff to previous 1.35 (unified) to selected 1.48 (unified)

This file contains too much complexity.
Remove one layer of indirection by deleting mparse_readfd_r()
and doing its work in the public mparse_readfd().
As a bonus, catch recursive .so.
This is part of the preparations to resync to openbsd.org.

Revision 1.35 / (download) - annotate - [select for diffs], Thu May 30 03:52:59 2013 UTC (10 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.34: +24 -9 lines
Diff to previous 1.34 (unified) to selected 1.48 (unified)

Reject non-printable characters found in the input stream even when
preceded by a backslash; otherwise, the escape sequence would later
be identified as invalid and the non-printable character would be
passed through to the output backends, sometimes triggering assertions.

Reported by Mike Small <smallm at panix dot com> on the mdocml discuss list.

Revision 1.34 / (download) - annotate - [select for diffs], Mon Nov 19 22:30:58 2012 UTC (11 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +3 -2 lines
Diff to previous 1.33 (unified) to selected 1.48 (unified)

Do not crash on stray .Ta macros found outside column lists.
Problem reported by jmc@, thanks.

Revision 1.33 / (download) - annotate - [select for diffs], Mon Nov 19 17:57:23 2012 UTC (11 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (unified) to selected 1.48 (unified)

In groff, trying to redefine standard man(7) macros before .TH has no effect;
after .TH, it works.  Trying to redefine standard mdoc(7) macros before .Dd
works when calling groff with the -mdoc command line option, but does not
when calling groff with -mandoc; after .Dd, it always works.

Arguably, one might call that buggy behaviour in groff, but it is very
unlikely that anybody will change groff in this respect (certainly, i'm
not volunteering).  So let's be bug-compatible.

This fixes the vertical spacing in sox(1).

Merging from OpenBSD libmandoc.h 1.18, read.c 1.8, roff.c 1.47, June 2, 2012.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Nov 16 22:21:05 2012 UTC (11 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (unified) to selected 1.48 (unified)

Warn about unknown volume or arch in Dt macro arguments;
patch written by Nicolas Joly <njoly at pasteur dot fr>.

Revision 1.31 / (download) - annotate - [select for diffs], Wed Jul 18 11:11:12 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.30: +2 -1 lines
Diff to previous 1.30 (unified) to selected 1.48 (unified)

Fix handling of paragraph macros inside lists:
* When they are trailing the last item, move them outside the list.
* When they are trailing any other none-compact item, drop them.

OpenBSD rev. mdoc_validate.c 1.107, mdoc.c 1.91

Revision 1.30 / (download) - annotate - [select for diffs], Thu Jul 12 15:11:14 2012 UTC (11 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (unified) to selected 1.48 (unified)

The post_nm() validation function crashed when the first .Nm child node
was a non-text node.  Fix this by rewriting post_nm() to always set
the meta name to UNKNOWN when the name is missing or unusable.
While here, make MANDOCERR_NONAME an ERROR, as it usually renders
the page content unintelligible.

Bug reported by Maxim <Belooussov at gmail dot com>, thanks.
OpenBSD rev. 1.105

Revision 1.29 / (download) - annotate - [select for diffs], Sun May 27 17:48:57 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.28: +9 -4 lines
Diff to previous 1.28 (unified) to selected 1.48 (unified)

Support -Ios='OpenBSD 5.1' to override uname(3) as the source of the
default value for the mdoc(7) .Os macro.
Needed for man.cgi on the OpenBSD website.

Problem with man.cgi first noticed by deraadt@;
beck@ and deraadt@ agree with the way to solve the issue.

"Please check them in and I'll look into them later!" kristaps@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Feb 16 20:51:31 2012 UTC (12 years, 1 month ago) by joerg
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.27: +54 -42 lines
Diff to previous 1.27 (unified) to selected 1.48 (unified)

Add mparse_readmem, which allows application to run the parser directly
from memory, e.g. after de-compressing a document.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Feb 5 16:46:15 2012 UTC (12 years, 1 month ago) by joerg
Branch: MAIN
Changes since 1.26: +8 -5 lines
Diff to previous 1.26 (unified) to selected 1.48 (unified)

Don't silently skip non-ASCII characters, but replace them with ``?''.
This is less likely to break the syntax of macros.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Nov 7 01:24:40 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (unified) to selected 1.48 (unified)

When the HEAD scope of .TP is broken by another block macro,
do not abort with a FATAL error, but report a report a WARNING,
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.
ok kristaps@

Revision 1.25 / (download) - annotate - [select for diffs], Sat Oct 8 15:42:29 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_0
Changes since 1.24: +3 -2 lines
Diff to previous 1.24 (unified) to selected 1.48 (unified)

Critical fix in the new -Tman lookaside buffer code. Gah..

Revision 1.24 / (download) - annotate - [select for diffs], Thu Oct 6 22:29:12 2011 UTC (12 years, 5 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +50 -1 lines
Diff to previous 1.23 (unified) to selected 1.48 (unified)

If -Tman is specified and input is -man, echo the preprocessed (`so'
replaced by file) input.  This replaces earlier behaviour of doing
nothing, which I found unexpected (mandoc should always output).

This requires a buffer in read.c that saves the input lines before being
parsed, with a special hook if `so' is invoked.  This buffer is just
flushed to output if -mman is the input.

While mucking around doing this, I also alpha-ordered the mandoc.h
functions.

Ok schwarze@, with no screaming when the polished patch was published.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Jul 23 18:41:18 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_7, VERSION_1_11_6, VERSION_1_11_5
Changes since 1.22: +1 -2 lines
Diff to previous 1.22 (unified) to selected 1.48 (unified)

Add support for tdefine and ndefine.  Consolidate some error messages.  Add
somem more version notes (getting there).  Have the equation nanme be captured.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Jul 22 14:55:07 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +1 -2 lines
Diff to previous 1.21 (unified) to selected 1.48 (unified)

Add support for `gsize' eqn token (introduced in second-edition troff).

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jul 21 23:30:39 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +4 -1 lines
Diff to previous 1.20 (unified) to selected 1.48 (unified)

Complete eqn.7 parsing.  Features all productions from the original 1975
CACM paper in an LR(1) parse (1 -> eqn_rewind()).  Right now the code is
a little jungly, but will clear up as I consolidate parse components.
The AST structure will also be cleaned up, as right now it's pretty ad
hoc (this won't change the parse itself).  I added the mandoc_strndup()
function will here.

Revision 1.20 / (download) - annotate - [select for diffs], Thu Jul 21 12:30:44 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +3 -1 lines
Diff to previous 1.19 (unified) to selected 1.48 (unified)

Support nested `{, }' subexpressions in eqn.  Document in code.

Revision 1.19 / (download) - annotate - [select for diffs], Mon Jul 18 14:30:51 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +2 -1 lines
Diff to previous 1.18 (unified) to selected 1.48 (unified)

Forgot to add these bits to the last commit.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jul 18 07:46:41 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +6 -9 lines
Diff to previous 1.17 (unified) to selected 1.48 (unified)

Make `struct roff' be passed into libmdoc and libman upon creation.
This is required for supporting in-line equations.  While here, push
registers properly into roff and add an set/get/mod interface.

Revision 1.17 / (download) - annotate - [select for diffs], Sun Jul 17 14:08:49 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.16: +4 -1 lines
Diff to previous 1.16 (unified) to selected 1.48 (unified)

Provide implementations of `define', `set', and `unset'.
Tie them into the stream of data.
Document these appropriate, bringing in the grammar as defined by the
original eqn manual (Kernighan/Richie).

Revision 1.16 / (download) - annotate - [select for diffs], Sun Jul 17 12:52:54 2011 UTC (12 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +4 -1 lines
Diff to previous 1.15 (unified) to selected 1.48 (unified)

Warn if equation `define' key is quoted (groff-ism).

Revision 1.15 / (download) - annotate - [select for diffs], Thu May 26 20:36:21 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_4, VERSION_1_11_3
Changes since 1.14: +10 -4 lines
Diff to previous 1.14 (unified) to selected 1.48 (unified)

At least in theory, this patch lets us compile on Windows (which does
not have mmap(), from what I can tell).

Revision 1.14 / (download) - annotate - [select for diffs], Sat Apr 30 10:18:24 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_2
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (unified) to selected 1.48 (unified)

No code change: fixing spelling errors.  From a patch by uqs@.  Thanks!

Revision 1.13 / (download) - annotate - [select for diffs], Mon Apr 11 21:59:39 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (unified) to selected 1.48 (unified)

Ignore \# lines alongside \".  From groff(7):

\#     Everything  up  to  and  including  the  next  newline is
       ignored.  This is interpreted in copy mode.  This is like \"
       except that the terminating newline is ignored as well.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Apr 9 15:29:40 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (unified) to selected 1.48 (unified)

Remove a2roffdeco() and mandoc_special() functions and replace them with
a public (mandoc.h) function mandoc_escape(), which merges the
functionality of both prior functions.

Reason: code duplication.  The a2roffdeco() and mandoc_special()
functions were pretty much the same thing and both quite complex.  This
allows one function to receive improvements in (e.g.) subexpression
handling and performance, instead of having to replicate functionality.

As such, the mandoc_escape() function already handles a superset of the
escapes handled in previous versions and has improvements in performance
(using strcspn(), for example) and reliable handling of subexpressions.

This code Works For Me, but may need work to catch any regressions.
Since the benefits are great (leaner code, simpler API), I'd rather have
it in-tree than floating as a patch.

Revision 1.11 / (download) - annotate - [select for diffs], Mon Apr 4 23:04:38 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +5 -1 lines
Diff to previous 1.10 (unified) to selected 1.48 (unified)

Add config.h Glue for OpenIndiana (and older OpenSolaris) to build.
From a patch by Yuri Pankov, thanks!

Revision 1.10 / (download) - annotate - [select for diffs], Sun Apr 3 10:11:25 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_1
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (unified) to selected 1.48 (unified)

If wlevel in mparse_alloc() is greater than MANDOCLEVEL_FATAL, we'll
throw assertions due to per-file-error not being properly set in mmsg().
This is reasonable behaviour (we shouldn't be able to ignore FATAL after
all).  Thus, make sure wlevel is sanitised.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Apr 3 10:05:37 2011 UTC (12 years, 11 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +5 -3 lines
Diff to previous 1.8 (unified) to selected 1.48 (unified)

Allow mparse_result() pointers to be NULL.

Revision 1.8 / (download) - annotate - [select for diffs], Thu Mar 31 10:54:39 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.7: +3 -2 lines
Diff to previous 1.7 (unified) to selected 1.48 (unified)

Allow a NULL mmsg passed to libmandoc.

Revision 1.7 / (download) - annotate - [select for diffs], Mon Mar 28 21:49:42 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.6: +132 -1 lines
Diff to previous 1.6 (unified) to selected 1.48 (unified)

Put mandocerrs and mandoclevels arrays into libmandoc with accessors
mparse_strerror() and mparse_strlevel().

Revision 1.6 / (download) - annotate - [select for diffs], Tue Mar 22 10:35:26 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.5: +3 -8 lines
Diff to previous 1.5 (unified) to selected 1.48 (unified)

Add a FATAL error for when no manual type was assigned (you can repeat
this for yourself by having a file consisting only of comments).

Revision 1.5 / (download) - annotate - [select for diffs], Tue Mar 22 09:50:11 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.4: +1 -2 lines
Diff to previous 1.4 (unified) to selected 1.48 (unified)

Step 2: blow away roff.h, as all of its functions have been moved into
libmandoc.h and there's nothing left.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Mar 20 16:05:21 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.3: +2 -13 lines
Diff to previous 1.3 (unified) to selected 1.48 (unified)

Let read.c worry about the currently-open file instead of having this
information duplicated in main.c.  For the time being, remove evt_close
and evt_open, as the only known mparse interface (main.c) doesn't need
them.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Mar 20 16:02:05 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.2: +62 -27 lines
Diff to previous 1.2 (unified) to selected 1.48 (unified)

Consolidate messages.  Have all parse-time messages (in libmdoc,
libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the
time being in libmandoc.h.  This requires struct mparse to be passed
into the allocation routines instead of mandocmsg and a void pointer.
Then, move some of the functionality of the old mmsg() into read.c's
mparse_mmsg() (check against wlevel and setting of file_status) and use
main.c's mmsg() as simply a printing tool.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Mar 20 11:43:06 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (unified) to selected 1.48 (unified)

Change around include ordering for compilation on OpenBSD.

Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 20 11:41:24 2011 UTC (13 years ago) by kristaps
Branch: MAIN
Diff to selected 1.48 (unified)

Split the document parsing sequence out of main.c and into read.c,
putting the interface into mandoc.h.  This effectively makes the
function of main.c be command-line handling, invoking the parser, and
sending its output to the output handler.  The sequence of parsing
(pfile(), pdesc(), etc.) has changed very little but for clean-up of
some state variables (curp->fd, etc.).

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.




CVSweb