]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
7 years agoDo not prematurely close .Nd containing a broken child.
Ingo Schwarze [Sat, 11 Feb 2017 14:11:17 +0000 (14:11 +0000)]
Do not prematurely close .Nd containing a broken child.
Fixes tree corruption leading to NULL dereference
in insane cases like .Oo Oo .Nd .Pq Oc .Oc Oc
found by tb@ with afl(1).

7 years agoDo not prematurely mark intermediate blocks as broken while scanning
Ingo Schwarze [Sat, 11 Feb 2017 13:24:12 +0000 (13:24 +0000)]
Do not prematurely mark intermediate blocks as broken while scanning
backwards.  Only do so when a block is found that is actually broken.
Logic error found while investigating crashes reported by tb@.

7 years agoFor child macros of block-end macros, only scan backwards for pending
Ingo Schwarze [Fri, 10 Feb 2017 22:19:18 +0000 (22:19 +0000)]
For child macros of block-end macros, only scan backwards for pending
breakers unless the parent of the block is already closed.  While
the scanning is needed in cases like ".Ac Bo" for broken Ao, it is
useless and crashy in cases like ".Ac Bc" for non-broken Ao.

This fixes a NULL pointer dereference that tb@ found with afl(1).

7 years agoIn the SYNOPSIS, .Nm blocks can get broken if one of their children
Ingo Schwarze [Fri, 10 Feb 2017 16:20:34 +0000 (16:20 +0000)]
In the SYNOPSIS, .Nm blocks can get broken if one of their children
gets broken.  In that case, mark them as BROKEN and ENDED and make
sure they get closed out together with the child.

Fixes tree corruption leeding to a NULL dereference found by tb@
with afl(1) in: .Sh SYNOPSIS .Bl .Oo .Nm .Bk .Oc .It (where .Bk is
the child and .Oo is the breaker).
A simpler form of the same corruption (without crash) is visible in:
.Sh SYNOPSIS .Ao .Nm .Bo .Ac .Bc text
where the text ended up inside the .Nm (child .Bo, breaker .Ao).

7 years agoIn -Ttree output mode, show the BROKEN node flag and
Ingo Schwarze [Fri, 10 Feb 2017 15:45:28 +0000 (15:45 +0000)]
In -Ttree output mode, show the BROKEN node flag and
provide a -Onoval output option to show the unvalidated tree.

7 years agosame as mandocdb.c rev. 1.196:
Ingo Schwarze [Thu, 9 Feb 2017 20:53:33 +0000 (20:53 +0000)]
same as mandocdb.c rev. 1.196:
for portability, use (char *)NULL in execlp(3) as discussed on tech@
OpenBSD (didn't blow up anywhere yet, but better safe than sorry)

7 years agoIllumos doesn't have O_DIRECTORY. Work around that for now, may
Ingo Schwarze [Thu, 9 Feb 2017 18:46:44 +0000 (18:46 +0000)]
Illumos doesn't have O_DIRECTORY.  Work around that for now, may
fix it better after the 1.14.1 release.  Portability issue reported
by Sevan Janiyan <venture37 at geeklan dot co dot uk>.

7 years agoEscape literal braces in a regular expression.
Ingo Schwarze [Thu, 9 Feb 2017 15:34:28 +0000 (15:34 +0000)]
Escape literal braces in a regular expression.
Deprecated perlre(1) syntax reported by Thomas Klausner and Sevan Janiyan.

7 years agoOn some systems (e.g. Solaris 11) diff(1) does not support -a.
Ingo Schwarze [Wed, 8 Feb 2017 16:56:15 +0000 (16:56 +0000)]
On some systems (e.g. Solaris 11) diff(1) does not support -a.
Make it easier to get rid of it.

7 years agomention that BUILD_CATMAN doesn't work on SunOS 5.9 and 5.10
Ingo Schwarze [Wed, 8 Feb 2017 16:16:08 +0000 (16:16 +0000)]
mention that BUILD_CATMAN doesn't work on SunOS 5.9 and 5.10

7 years agoconfig glue for recvmsg(2) and CMSG_FIRSTHDR(3);
Ingo Schwarze [Wed, 8 Feb 2017 16:11:40 +0000 (16:11 +0000)]
config glue for recvmsg(2) and CMSG_FIRSTHDR(3);
needed for Solaris 11

7 years agosendmsg(3) may block, so retry
Ingo Schwarze [Wed, 8 Feb 2017 14:50:53 +0000 (14:50 +0000)]
sendmsg(3) may block, so retry

7 years agoeven catman needs libmandoc on systems not having fts
Ingo Schwarze [Wed, 8 Feb 2017 13:36:32 +0000 (13:36 +0000)]
even catman needs libmandoc on systems not having fts

7 years agoprotect <err.h> inclusion
Ingo Schwarze [Wed, 8 Feb 2017 13:34:27 +0000 (13:34 +0000)]
protect <err.h> inclusion

7 years agomore 1.14.1 release preparations
Ingo Schwarze [Wed, 8 Feb 2017 12:24:10 +0000 (12:24 +0000)]
more 1.14.1 release preparations

7 years agoreference a relevant mail for one TODO item
Ingo Schwarze [Wed, 8 Feb 2017 12:20:16 +0000 (12:20 +0000)]
reference a relevant mail for one TODO item

7 years agoremove some instances of Mdocdate
Ingo Schwarze [Wed, 8 Feb 2017 12:19:15 +0000 (12:19 +0000)]
remove some instances of Mdocdate

7 years agodisable some tests that expose wcwidth(3) differences among systems
Ingo Schwarze [Wed, 8 Feb 2017 12:18:21 +0000 (12:18 +0000)]
disable some tests that expose wcwidth(3) differences among systems

7 years agoFinally port the OpenBSD regression suite.
Ingo Schwarze [Wed, 8 Feb 2017 03:02:13 +0000 (03:02 +0000)]
Finally port the OpenBSD regression suite.
Both kristaps@ and wiz@ repeated asked for this,
literally for years.

7 years agofirst draft of NEWS for 1.14.1
Ingo Schwarze [Tue, 7 Feb 2017 01:30:26 +0000 (01:30 +0000)]
first draft of NEWS for 1.14.1

7 years agonew manual pages for catman(8) and mandocd(8)
Ingo Schwarze [Mon, 6 Feb 2017 19:04:21 +0000 (19:04 +0000)]
new manual pages for catman(8) and mandocd(8)

7 years agoPolishing:
Ingo Schwarze [Mon, 6 Feb 2017 19:02:37 +0000 (19:02 +0000)]
Polishing:
* support -Ios=
* create missing directories
* fix output file permissions
* error out on comminication failures

I now consider this good enough for a first release.
Bugs and missing features are still likely, though.

7 years agoexplicitly pass -Tascii to mandoc(1), such that LC_CTYPE does not
Ingo Schwarze [Mon, 6 Feb 2017 03:48:33 +0000 (03:48 +0000)]
explicitly pass -Tascii to mandoc(1), such that LC_CTYPE does not
get into the way, and fix the usage() while here

7 years agoThe .Nm macro does not only use the default name when it has no
Ingo Schwarze [Mon, 6 Feb 2017 03:44:58 +0000 (03:44 +0000)]
The .Nm macro does not only use the default name when it has no
argument, but also when the first argument is a child macro.
Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste
Daroussin <bapt at FreeBSD> sent me long ago for a different reason.

While solving this, switch to the new technique of doing text
production in the validator, reducing code duplication in the
formatters, which also makes -Ttree output clearer.

7 years agouint8_t requires <stdint.h>; from Michael Stapelberg
Ingo Schwarze [Sun, 5 Feb 2017 22:51:11 +0000 (22:51 +0000)]
uint8_t requires <stdint.h>; from Michael Stapelberg

7 years agodocument output spacing near delimiters
Ingo Schwarze [Sun, 5 Feb 2017 22:30:29 +0000 (22:30 +0000)]
document output spacing near delimiters

7 years agoremove several things that were taken care of in the past
Ingo Schwarze [Sun, 5 Feb 2017 22:25:39 +0000 (22:25 +0000)]
remove several things that were taken care of in the past

7 years agoadd missing file man.options.1
Ingo Schwarze [Sun, 5 Feb 2017 22:22:46 +0000 (22:22 +0000)]
add missing file man.options.1

7 years agodocument hyphenation
Ingo Schwarze [Sun, 5 Feb 2017 21:41:21 +0000 (21:41 +0000)]
document hyphenation

7 years agoWrap .St content in a <span class="St">.
Ingo Schwarze [Sun, 5 Feb 2017 21:00:43 +0000 (21:00 +0000)]
Wrap .St content in a <span class="St">.
Also add forgotten <span class="Ux"> to .At rendering.

7 years agofix font selection for .Bf without argument
Ingo Schwarze [Sun, 5 Feb 2017 20:34:57 +0000 (20:34 +0000)]
fix font selection for .Bf without argument

7 years agomark up .Ar, .Fa, .Va, .Ft, and .Vt with <var> rather than <i>;
Ingo Schwarze [Sun, 5 Feb 2017 20:22:04 +0000 (20:22 +0000)]
mark up .Ar, .Fa, .Va, .Ft, and .Vt with <var> rather than <i>;
suggested by bentley@ long ago, but needed lots of cleanup first

7 years agofor .Rs, use <cite>
Ingo Schwarze [Sun, 5 Feb 2017 19:29:19 +0000 (19:29 +0000)]
for .Rs, use <cite>

7 years agoImprove <table> syntax:
Ingo Schwarze [Sun, 5 Feb 2017 18:15:39 +0000 (18:15 +0000)]
Improve <table> syntax:
The <col> element can only appear inside <colgroup>, so use <colgroup>.
The <tbody> element is optional and useless, so don't use it.
Even if we would ever need <thead> or <tfoot>, <tbody> would still be
optional and useless; besides, we will likely never need <thead> or <tfoot>,
simply because our languages don't support such functionality.

7 years agoexperimental mandocd(8) and catman(8)
Ingo Schwarze [Sat, 4 Feb 2017 12:03:07 +0000 (12:03 +0000)]
experimental mandocd(8) and catman(8)
for development in the tree, not yet ready for production

7 years agoDo not fix the default indent for all subsequent files; some may use
Ingo Schwarze [Sat, 4 Feb 2017 11:58:09 +0000 (11:58 +0000)]
Do not fix the default indent for all subsequent files; some may use
a different macro language and hence require a different indent.
You can see the effect with "man -a 1 host hostname".

7 years agoMinor cleanup, no functional change:
Ingo Schwarze [Fri, 3 Feb 2017 18:18:23 +0000 (18:18 +0000)]
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.

7 years agomore work found in old mails
Ingo Schwarze [Fri, 3 Feb 2017 17:59:22 +0000 (17:59 +0000)]
more work found in old mails

7 years agoIf an application parses multiple files with mparse_readfd(3) but
Ingo Schwarze [Fri, 3 Feb 2017 17:56:59 +0000 (17:56 +0000)]
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>.

7 years agoeven man-1.6g does *not* have apropos -C,
Ingo Schwarze [Thu, 2 Feb 2017 20:10:51 +0000 (20:10 +0000)]
even man-1.6g does *not* have apropos -C,
maybe it is MacOS X specific, i don't know...

7 years agocorrect information about early groff (up to 1.02)
Ingo Schwarze [Thu, 2 Feb 2017 19:59:15 +0000 (19:59 +0000)]
correct information about early groff (up to 1.02)

7 years agomention groff git, and one minor fix
Ingo Schwarze [Thu, 2 Feb 2017 18:10:16 +0000 (18:10 +0000)]
mention groff git, and one minor fix

7 years agomore info about man-1.6 and man-db
Ingo Schwarze [Thu, 2 Feb 2017 16:58:53 +0000 (16:58 +0000)]
more info about man-1.6 and man-db

7 years agominor fixes
Ingo Schwarze [Thu, 2 Feb 2017 02:30:07 +0000 (02:30 +0000)]
minor fixes

7 years agonew page, not to be installed
Ingo Schwarze [Thu, 2 Feb 2017 02:17:31 +0000 (02:17 +0000)]
new page, not to be installed

7 years agoadd missing HISTORY information
Ingo Schwarze [Tue, 31 Jan 2017 19:44:04 +0000 (19:44 +0000)]
add missing HISTORY information

7 years agoRework fill mode handling for -man -Thtml.
Ingo Schwarze [Mon, 30 Jan 2017 20:24:02 +0000 (20:24 +0000)]
Rework fill mode handling for -man -Thtml.

Basically, open <pre> whenever printing text in no-fill mode and it is
not already open, and close it whenever printing something that cannot
be inside <pre>.

This fixes a crash reported by Michael <Stapelberg at debian dot org>
in the French Linux chroot(2) manual and also improves rendering
for OpenBSD pages like DPMSGetTimeouts(3) and GLwDrawingArea(3).

These changes also permitted retiring struct mhtml.

7 years agoeliminate one useless struct and one level of indirection;
Ingo Schwarze [Sun, 29 Jan 2017 14:02:41 +0000 (14:02 +0000)]
eliminate one useless struct and one level of indirection;
no functional change

7 years agoAdd a warning "new sentence, new line".
Ingo Schwarze [Sat, 28 Jan 2017 23:30:08 +0000 (23:30 +0000)]
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

7 years agoSimplify usage of print_otag() even more:
Ingo Schwarze [Sat, 28 Jan 2017 22:36:38 +0000 (22:36 +0000)]
Simplify usage of print_otag() even more:
accept NULL to skip the attribute or format.

7 years agoMANDOCERR_BADTAB no longer exists,
Ingo Schwarze [Sat, 28 Jan 2017 22:32:51 +0000 (22:32 +0000)]
MANDOCERR_BADTAB no longer exists,
and i checked that MANDOCERR_FI_TAB is used correctly.

7 years ago.Bl -column with zero columns is legal, so don't segfalt on it.
Ingo Schwarze [Sat, 28 Jan 2017 18:43:00 +0000 (18:43 +0000)]
.Bl -column with zero columns is legal, so don't segfalt on it.
Bug introduced in rev. 1.248 triggered for example in gssapi(3),
analyzed and reported by Michael <Stapelberg at debian dot org>.
Simplify the code a bit more while here.

7 years agowarn about invalid output options
Ingo Schwarze [Fri, 27 Jan 2017 13:47:10 +0000 (13:47 +0000)]
warn about invalid output options
and error out if they occur on the command line;
missing feature found in the TODO file

7 years agowarn about missing one-line description;
Ingo Schwarze [Fri, 27 Jan 2017 11:33:26 +0000 (11:33 +0000)]
warn about missing one-line description;
missing feature found in the TODO file

7 years agoParse the section number from the content of preformatted pages
Ingo Schwarze [Fri, 27 Jan 2017 01:14:47 +0000 (01:14 +0000)]
Parse the section number from the content of preformatted pages
and warn if it doesn't match the directory where the file was found.

7 years agoIf parsing a page reveals that it is neither mdoc(7) nor man(7),
Ingo Schwarze [Fri, 27 Jan 2017 01:09:14 +0000 (01:09 +0000)]
If parsing a page reveals that it is neither mdoc(7) nor man(7),
fall back to treating it as preformatted rather than treating
it as man(7) anyway.

7 years agofix base directory detection for makewhatis -t
Ingo Schwarze [Fri, 27 Jan 2017 01:04:25 +0000 (01:04 +0000)]
fix base directory detection for makewhatis -t

7 years agoAlways register names taken from file names in the names ohash.
Ingo Schwarze [Fri, 27 Jan 2017 00:56:32 +0000 (00:56 +0000)]
Always register names taken from file names in the names ohash.
Bug found by makewhatis -p crashing in mlink_check().

7 years agomore info on man(7) .Xr hyperlinking
Ingo Schwarze [Thu, 26 Jan 2017 19:32:46 +0000 (19:32 +0000)]
more info on man(7) .Xr hyperlinking

7 years agoFix -man -Thtml formatting after .nf (which has nothing to do
Ingo Schwarze [Thu, 26 Jan 2017 18:28:18 +0000 (18:28 +0000)]
Fix -man -Thtml formatting after .nf (which has nothing to do
with "literal", by the way, it means "no fill"):

* Use <pre> such that whitespace is preserved.
* Preserve lines breaks.
* For font alternating macros, avoid node recursion which required
scary juggling with the fill state.  Instead, simply print the text
children directly.

Missing feature first noticed by kristaps@ in 2011,
the again reported by afresh1@ in 2016,
and finally reported here: https://github.com/Debian/debiman/issues/21 ,
which i only found because of Shane Kerr's comment here:
https://plus.google.com/110314300533310775053/posts/H1eaw9Yskoc

7 years agoadd arm64 architecture; from deraadt@
Ingo Schwarze [Wed, 25 Jan 2017 03:49:38 +0000 (03:49 +0000)]
add arm64 architecture; from deraadt@

7 years agoImprove HTML formatting of .Bl -tag.
Ingo Schwarze [Wed, 25 Jan 2017 02:14:43 +0000 (02:14 +0000)]
Improve HTML formatting of .Bl -tag.

In particular, when using the style sheet, put the body on the same
line as the head for short heads, or on the next line for long
heads, in a way that preserves both correct indentation and correct
vertical spacing with and without -compact, and with one or more
heads per body (hi, Zaphod) - eight use cases so far - and with and
without -tag, and with and without -offset, 32 use cases grand total.

Using many ideas from zhuk@, from <David dot Dahlberg at fkie dot
fraunhofer dot de>, and from Benny Lofgren <bl dash lists at lofgren
dot biz>, and a few of my own.

This is an excellent demonstration that CSS is an extremely hostile
language, much more trapful and much harder to use than, say, C.
When matthew@ reported this in July 2014 (!), it was already a known
issue, and i no longer remember for how long.  My first serious
attempt at fixing it (in November 2015) failed miserably.  I'd love
to see simplifications of both the generated HTML code and of the
style sheet, but without breaking any of the 32 use cases, please.

7 years agobug was fixed, delete the BUGS section
Ingo Schwarze [Sat, 21 Jan 2017 02:32:39 +0000 (02:32 +0000)]
bug was fixed, delete the BUGS section

7 years agoslightly simplify header and footer styles
Ingo Schwarze [Sat, 21 Jan 2017 02:29:57 +0000 (02:29 +0000)]
slightly simplify header and footer styles

7 years agoAvoid writing constant style attributes over and over again.
Ingo Schwarze [Sat, 21 Jan 2017 02:09:51 +0000 (02:09 +0000)]
Avoid writing constant style attributes over and over again.
Move them to the style sheet.

7 years agoclean up the remaining class attributes
Ingo Schwarze [Sat, 21 Jan 2017 01:20:31 +0000 (01:20 +0000)]
clean up the remaining class attributes

7 years agoStandardize class attributes for semantic macros.
Ingo Schwarze [Fri, 20 Jan 2017 23:51:00 +0000 (23:51 +0000)]
Standardize class attributes for semantic macros.
Correct markup for .Va and iprove markup for .Dv, .Er, .Ev while here.

7 years agostandardize .Rs class attributes
Ingo Schwarze [Fri, 20 Jan 2017 21:37:56 +0000 (21:37 +0000)]
standardize .Rs class attributes

7 years agostandardize .Bl and .It class attributes
Ingo Schwarze [Fri, 20 Jan 2017 19:58:07 +0000 (19:58 +0000)]
standardize .Bl and .It class attributes

7 years agoclean up markup of .Bd, .D1, .Dl, .Li, and .Ql;
Ingo Schwarze [Thu, 19 Jan 2017 16:56:54 +0000 (16:56 +0000)]
clean up markup of .Bd, .D1, .Dl, .Li, and .Ql;
in particular, stop abuse of <blockquote>

7 years agoclean up .Sx and .Xr HTML markup
Ingo Schwarze [Thu, 19 Jan 2017 15:48:39 +0000 (15:48 +0000)]
clean up .Sx and .Xr HTML markup

7 years agoClean up CSS rules for sections and paragraphs.
Ingo Schwarze [Thu, 19 Jan 2017 15:27:34 +0000 (15:27 +0000)]
Clean up CSS rules for sections and paragraphs.
Start using real macro names for CSS classes.

7 years agoClean up and fix rules for header and footer lines.
Ingo Schwarze [Thu, 19 Jan 2017 14:29:53 +0000 (14:29 +0000)]
Clean up and fix rules for header and footer lines.
In particular, horizontal alignment was missing.

7 years agoAdjust indentation of the HTML output to the conventions established
Ingo Schwarze [Thu, 19 Jan 2017 13:55:56 +0000 (13:55 +0000)]
Adjust indentation of the HTML output to the conventions established
by html.c.  No semantic change.

7 years agoStart cleanup: trim useless HTML comments, <div> elements,
Ingo Schwarze [Thu, 19 Jan 2017 13:35:02 +0000 (13:35 +0000)]
Start cleanup: trim useless HTML comments, <div> elements,
and CSS rules on the <html> and <body> levels.

7 years agoImplement line breaking of the generated HTML code at space characters
Ingo Schwarze [Thu, 19 Jan 2017 01:00:14 +0000 (01:00 +0000)]
Implement line breaking of the generated HTML code at space characters
in filled text.  This does not affect HTML semantics, but makes the
HTML code even more humanly readable.

While here,
- collapse multiple consecutive space characters in filled text
- and insert a blank between style entries.

7 years agoMake HTML output more human readable by overhauling line break logic
Ingo Schwarze [Wed, 18 Jan 2017 19:22:21 +0000 (19:22 +0000)]
Make HTML output more human readable by overhauling line break logic
around tags and by introducing some simple indentation.
No change of HTML semantics intended.

8 years agoCompletely delete the buf field of struct html and all the buf*()
Ingo Schwarze [Tue, 17 Jan 2017 15:32:43 +0000 (15:32 +0000)]
Completely delete the buf field of struct html and all the buf*()
interfaces.  Such a static buffer was a bad idea in the first place,
causing unfixable truncation that was only prevented by triggering
an assertion failure.  Instead, let the small number of remaining
users allocate and free their own, temporary dynamic buffers,
or for the case of .Xr and .In, pass the original data to be
assembled in print_otag().

8 years agoSimplify the usage of print_otag() by making it accept a variable
Ingo Schwarze [Tue, 17 Jan 2017 01:47:51 +0000 (01:47 +0000)]
Simplify the usage of print_otag() by making it accept a variable
number of arguments.

Delete struct htmlpair and all the PAIR_*() macros.
Delete enum htmlattr, handle that in print_otag() instead.

Minus 190 lines of code; no functional change except better ordering
of attributes (class before style) in three cases.

8 years agoWhen looking up macro values while the macro tables are being built
Ingo Schwarze [Sun, 15 Jan 2017 15:28:55 +0000 (15:28 +0000)]
When looking up macro values while the macro tables are being built
in makewhatis(8), use ohash rather than linear searches.

This was identified as the main makewhatis(8) performance bottleneck
by Baptiste Daroussin <bapt at FreeBSD>, who also suggested part
of the improved algorithm.

This reduces the run time of "makewhatis /usr/share/man" from eleven
to five seconds on my notebook.  Note that the changed code is not
used in apropos(1), so don't expect speedups there.

While here, sort macro values asciibetically, to improve reproducibility -
which still isn't perfect, but getting better.

8 years agoSkipping all escape sequences at the beginning of strings in deroff()
Ingo Schwarze [Thu, 12 Jan 2017 18:02:20 +0000 (18:02 +0000)]
Skipping all escape sequences at the beginning of strings in deroff()
was too aggressive.  There are strings that legitimately begin with
an escape sequence.  Only skip leading escape sequences representing
whitespace.

Bug reported by martijn@.

8 years agoshow meta data for -Ttree output
Ingo Schwarze [Thu, 12 Jan 2017 17:29:33 +0000 (17:29 +0000)]
show meta data for -Ttree output

8 years agoPut compiler arguments that may contain -l at the end; according to
Ingo Schwarze [Thu, 12 Jan 2017 15:45:05 +0000 (15:45 +0000)]
Put compiler arguments that may contain -l at the end; according to
the people at Alpine Linux, gcc 6 seems to fail when it's at the
beginning.  From Daniel Sabogal via http://git.alpinelinux.org.

8 years agoDo text production for .Bt, .Ex, .Rv, .Ud at the validation stage
Ingo Schwarze [Wed, 11 Jan 2017 17:39:53 +0000 (17:39 +0000)]
Do text production for .Bt, .Ex, .Rv, .Ud at the validation stage
rather than in the formatters.  Use NODE_NOSRC flag for .Lb and
NODE_NOSRC and NODE_NOPRT for .St.  Results in a more rigorous
syntax tree and in 135 lines less code.

This work was triggered by a question from Abhinav Upadhyay <er dot
abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.

8 years agoUse new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.
Ingo Schwarze [Tue, 10 Jan 2017 23:36:34 +0000 (23:36 +0000)]
Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.
More rigorous AST and 40 lines less code.

8 years agoFor the .Ux/.Ox family of macros, do text production at the validation
Ingo Schwarze [Tue, 10 Jan 2017 21:59:47 +0000 (21:59 +0000)]
For the .Ux/.Ox family of macros, do text production at the validation
stage rather than in each and every individual formatter, using the
new NODE_NOSRC flag.  More rigorous and also ten lines less code.

8 years agosimplify; NODE_ENDED does no harm in man(7)
Ingo Schwarze [Tue, 10 Jan 2017 14:09:07 +0000 (14:09 +0000)]
simplify; NODE_ENDED does no harm in man(7)

8 years agounify names of AST node flags; no change of cpp output
Ingo Schwarze [Tue, 10 Jan 2017 13:47:00 +0000 (13:47 +0000)]
unify names of AST node flags; no change of cpp output

8 years agoIntroduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.
Ingo Schwarze [Tue, 10 Jan 2017 12:53:07 +0000 (12:53 +0000)]
Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.
Use them to mark generated nodes and nodes that shall not produce output.
Let -Ttree output mode display these new flags.
Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments.
Use NODE_NOPRT for .Dd, .Dt, and .Os.

These will help to make handling of text production macros more rigorous.

8 years agoUse stdout rather than stdin for controlling the terminal
Ingo Schwarze [Mon, 9 Jan 2017 17:49:57 +0000 (17:49 +0000)]
Use stdout rather than stdin for controlling the terminal
such that "cat foo.mdoc | man -l" works.
Issue reported by Christian Neukirchen <chneukirchen at gmail dot com>
and also tested by him on Void Linux with both glibc and musl.
The patch makes sense to millert@.

8 years agoClarify how tabs after .It work
Ingo Schwarze [Mon, 9 Jan 2017 14:10:53 +0000 (14:10 +0000)]
Clarify how tabs after .It work
because this is a really nasty trap for the unwary.

Triggered by a question from Abhinav Upadhyay <er dot abhinav dot
upadhyay at gmail dot com> (NetBSD) on discuss@.

8 years agoThe .No macro is not supposed to produce fixed-width font, it is not
Ingo Schwarze [Mon, 9 Jan 2017 12:48:58 +0000 (12:48 +0000)]
The .No macro is not supposed to produce fixed-width font, it is not
the same as .Li, so don't use <code>.
Bug reported by <Anton dot Lindqvist at gmail dot com> on tech@.

8 years agoWarnings and errors that occur during mdoc_validate()
Ingo Schwarze [Mon, 9 Jan 2017 01:37:03 +0000 (01:37 +0000)]
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.

8 years agoIndentation must be measured in units of the surrounding text,
Ingo Schwarze [Sun, 8 Jan 2017 22:51:55 +0000 (22:51 +0000)]
Indentation must be measured in units of the surrounding text,
not in units of the contained text.  Consequently, "display"
and "lit" class tags must not be on the same element:  First,
"display" must set up the indentation, still using the outer
units, and only after that, "lit" may change the font.

This fixes .Bd -literal which got the wrong indentation.
Bug reported by tb@.

8 years agoFix an assertion failure caused by \z\[u00FF] with -Tps/-Tpdf.
Ingo Schwarze [Sun, 8 Jan 2017 18:16:58 +0000 (18:16 +0000)]
Fix an assertion failure caused by \z\[u00FF] with -Tps/-Tpdf.
Reported by jsg@ after an afl(1) run long ago.

8 years agofrom Tiago Silva <tiagofilipesilva at icloud dot com> long ago
Ingo Schwarze [Sun, 8 Jan 2017 16:38:26 +0000 (16:38 +0000)]
from Tiago Silva <tiagofilipesilva at icloud dot com> long ago

8 years agoTolerate bare tabs in SYNOPSIS .Cd for now.
Ingo Schwarze [Sun, 8 Jan 2017 02:01:17 +0000 (02:01 +0000)]
Tolerate bare tabs in SYNOPSIS .Cd for now.
It's used in half a dozen pages.
Even though i have been thinking about it for years,
i still can't suggest anything better.
The false positives are annoying.

8 years agoStricter validation of the NAME section, in particular:
Ingo Schwarze [Sun, 8 Jan 2017 00:11:23 +0000 (00:11 +0000)]
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

8 years agosort options list; from jmc@
Ingo Schwarze [Fri, 6 Jan 2017 01:34:57 +0000 (01:34 +0000)]
sort options list; from jmc@

8 years agoescape a macro name that is not intended to be called
Ingo Schwarze [Wed, 28 Dec 2016 22:52:17 +0000 (22:52 +0000)]
escape a macro name that is not intended to be called