]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
9 years agoTo make the code more readable, delete 283 /* FALLTHROUGH */ comments
Ingo Schwarze [Mon, 12 Oct 2015 00:08:15 +0000 (00:08 +0000)]
To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

9 years agoDrop tags containing a blank character:
Ingo Schwarze [Sun, 11 Oct 2015 22:00:52 +0000 (22:00 +0000)]
Drop tags containing a blank character:
They don't work, they break other tags in weird ways, and even
if they could be made to work, they would be mostly useless.
Issue reported by naddy@, thanks.

9 years agoFinally use __progname, err(3) and warn(3).
Ingo Schwarze [Sun, 11 Oct 2015 21:12:54 +0000 (21:12 +0000)]
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...

9 years agoMention that the first argument of .Pf does not need escaping.
Ingo Schwarze [Sun, 11 Oct 2015 18:56:51 +0000 (18:56 +0000)]
Mention that the first argument of .Pf does not need escaping.
While here, make the first sentence regarding .Pf more concise.
OK jmc@

9 years agoDecide whether to use_pager as early as possible,
Ingo Schwarze [Sat, 10 Oct 2015 13:21:18 +0000 (13:21 +0000)]
Decide whether to use_pager as early as possible,
in preparation for pledge(2); no functional change intended.

9 years agomodernize style: "return" is not a function
Ingo Schwarze [Tue, 6 Oct 2015 18:32:19 +0000 (18:32 +0000)]
modernize style: "return" is not a function

9 years agoimprove wording and start a new sentence on a new line; from jmc@
Ingo Schwarze [Tue, 6 Oct 2015 15:33:29 +0000 (15:33 +0000)]
improve wording and start a new sentence on a new line; from jmc@

9 years agoTheo found a stray blank in HTML output.
Ingo Schwarze [Tue, 29 Sep 2015 18:45:36 +0000 (18:45 +0000)]
Theo found a stray blank in HTML output.

9 years agobriefly document -T tree output
Ingo Schwarze [Sat, 26 Sep 2015 12:56:04 +0000 (12:56 +0000)]
briefly document -T tree output

9 years agoShow the flags MDOC_DELIMO, MDOC_DELIMC, MDOC_EOS, and MAN_EOS.
Ingo Schwarze [Sat, 26 Sep 2015 12:55:16 +0000 (12:55 +0000)]
Show the flags MDOC_DELIMO, MDOC_DELIMC, MDOC_EOS, and MAN_EOS.
Drop the "block-" prefixes from the node type names.

9 years ago/* NOTREACHED */ after abort() is silly, delete it
Ingo Schwarze [Sat, 26 Sep 2015 00:54:03 +0000 (00:54 +0000)]
/* NOTREACHED */ after abort() is silly, delete it

9 years agoresolve code duplication and do style cleanup in mdoc_nm_pre(),
Ingo Schwarze [Sat, 26 Sep 2015 00:32:35 +0000 (00:32 +0000)]
resolve code duplication and do style cleanup in mdoc_nm_pre(),
no functional change

9 years agoFix multiple aspects of SYNOPSIS .Nm formatting:
Ingo Schwarze [Sat, 26 Sep 2015 00:22:07 +0000 (00:22 +0000)]
Fix multiple aspects of SYNOPSIS .Nm formatting:
* Don't break lines before non-block .Nm elements.
* Use proper <b> markup for the heads of .Nm blocks.
* Make the width measurements work by doing them on the head children.

9 years agotypos; found and fixed by sobrado@
Ingo Schwarze [Thu, 24 Sep 2015 18:41:22 +0000 (18:41 +0000)]
typos; found and fixed by sobrado@

9 years agoTrailing whitespace is significant when determining the width of a tag
Ingo Schwarze [Mon, 21 Sep 2015 13:25:00 +0000 (13:25 +0000)]
Trailing whitespace is significant when determining the width of a tag
in mdoc(7) .Bl -tag and man(7) .TP, but not in man(7) .IP.
Quirk reported by Jan Stary <hans at stare dot cz> on ports@.

9 years agono more _subdir; Jan Stary <hans at stare dot cz>
Ingo Schwarze [Mon, 21 Sep 2015 09:59:02 +0000 (09:59 +0000)]
no more _subdir; Jan Stary <hans at stare dot cz>

9 years agofor portability, use (char *)NULL in execlp(3) as discussed on tech@ OpenBSD
Ingo Schwarze [Wed, 16 Sep 2015 09:50:29 +0000 (09:50 +0000)]
for portability, use (char *)NULL in execlp(3) as discussed on tech@ OpenBSD
(didn't blow up anywhere yet, but better safe than sorry)

9 years agoAvoid .Ns right after .Pf, it's pointless.
Ingo Schwarze [Mon, 14 Sep 2015 20:10:19 +0000 (20:10 +0000)]
Avoid .Ns right after .Pf, it's pointless.

9 years agoRemove the warning about children of .Vt blocks because actually,
Ingo Schwarze [Mon, 14 Sep 2015 15:36:14 +0000 (15:36 +0000)]
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@.

9 years agoThe .Dv macro actually forces normal font.
Ingo Schwarze [Mon, 14 Sep 2015 12:57:47 +0000 (12:57 +0000)]
The .Dv macro actually forces normal font.

9 years agoFill mode changes don't break next-line scope in all cases,
Ingo Schwarze [Fri, 4 Sep 2015 21:25:00 +0000 (21:25 +0000)]
Fill mode changes don't break next-line scope in all cases,
in particular not for tagged paragraphs.
Issue found by Christian Neukirchen <chneukirchen at gmail dot com>
in the exiv2(1) manual page.

9 years agoRecommend an unambiguous escape for minus signs instead of \-.
Ingo Schwarze [Wed, 2 Sep 2015 15:38:35 +0000 (15:38 +0000)]
Recommend an unambiguous escape for minus signs instead of \-.

Historically, \- was used in troff for three cases: flags/pathnames,
en dashes, and minus signs. mandoc_char(7) currently recommends it
for minus signs, recommends \(en for en dashes, and doesn't mention
flags/pathnames.

In the old days, nroff rendered \- as ASCII '-', and troff rendered
it as en dash/minus (which were visually indistinguishable).

In Unicode, en dashes and minus signs are semantically distinct and
encoded differently (U+2013 for en dash, U+2212 for minus), and
often rendered differently too. Meanwhile ASCII '-' has been renamed
"hyphen-minus" and fonts typically render it closest to a hyphen, not
a minus.

There is very little consistency across roff implementations and output
formats for what Unicode character \- corresponds to. So at least for
minus signs, change the recommendation to the unambiguous \(mi escape.

from bentley@, ok jmc@ (after reams of discussion)

9 years agoDrop leading, internal, and trailing blank characters in \o (overstrike)
Ingo Schwarze [Sun, 30 Aug 2015 21:10:56 +0000 (21:10 +0000)]
Drop leading, internal, and trailing blank characters in \o (overstrike)
escape sequences; that's cleaner for all output modes, and it's required
to prevent the PostScript/PDF formatter from dying on assertions.
Bug found by jsg@ with afl.

9 years agoIf an .Fo macro lacks its mandatory argument, don't die on an assertion.
Ingo Schwarze [Sun, 30 Aug 2015 19:00:14 +0000 (19:00 +0000)]
If an .Fo macro lacks its mandatory argument, don't die on an assertion.
Bug found by jsg@ with afl.

9 years agoIf we have to reparse the text line because we spring an input line trap,
Ingo Schwarze [Sat, 29 Aug 2015 23:56:01 +0000 (23:56 +0000)]
If we have to reparse the text line because we spring an input line trap,
we must not escape breakable hyphens yet, or mparse_buf_r() in read.c
will complain and replace the escaped hyphens with question marks.
Bug found in ocserv(8) following a report from Kurt Jaeger <pi at FreeBSD>.

9 years agoParse and ignore the escape sequences \, and \/ (italic corrections).
Ingo Schwarze [Sat, 29 Aug 2015 22:40:05 +0000 (22:40 +0000)]
Parse and ignore the escape sequences \, and \/ (italic corrections).
Actually using these is very stupid because they are groff extensions
and other roff(7) implementations typically print unintended characters
at the places where they are used.
Nevertheless, some manuals contain them, for example ocserv(8).
Problem reported by Kurt Jaeger <pi at FreeBSD>.

9 years agoImplement the escape sequence \\$*, expanding to all arguments
Ingo Schwarze [Sat, 29 Aug 2015 21:37:20 +0000 (21:37 +0000)]
Implement the escape sequence \\$*, expanding to all arguments
of the current user-defined macro.
This is another missing feature required for ocserv(8).
Problem reported by Kurt Jaeger <pi at FreeBSD>.

9 years agoMinimal implementation of the read-only number register \n(.$
Ingo Schwarze [Sat, 29 Aug 2015 20:26:04 +0000 (20:26 +0000)]
Minimal implementation of the read-only number register \n(.$
which returns the number of arguments of the current macro.
This is one of the missing features required for ocserv(8).
Problem reported by Kurt Jaeger <pi at FreeBSD>.

9 years agoIncluding <ohash.h> requires including <stdint.h> before,
Ingo Schwarze [Sat, 29 Aug 2015 15:28:13 +0000 (15:28 +0000)]
Including <ohash.h> requires including <stdint.h> before,
and "config.h" was missing as well.
Patch from Svyatoslav Mishyn <juef and openmailbox dot org>, Crux Linux.

9 years agotedu@ reports tbl(7) issues in synaptics(4)
Ingo Schwarze [Sat, 29 Aug 2015 15:10:28 +0000 (15:10 +0000)]
tedu@ reports tbl(7) issues in synaptics(4)

9 years agoRemove the hack of scrolling forward and backward with +G1G that
Ingo Schwarze [Tue, 28 Jul 2015 18:38:55 +0000 (18:38 +0000)]
Remove the hack of scrolling forward and backward with +G1G that
many (jmc@, millert@, espie@, deraadt@) considered revolting.
Instead, when using a pager, since we are using a temporary file
for tags anyway, use another temporary file for the formatted
page(s), as suggested by millert@ and similar to what the traditional
BSD man(1) did, except that we use only one single temporary output
file rather than one for each formatted manual page, such that
searching (both with / and :t) works across all the displayed files.

9 years agoSimplify and make tag_put() more efficient by integrating tag_get()
Ingo Schwarze [Sat, 25 Jul 2015 14:28:59 +0000 (14:28 +0000)]
Simplify and make tag_put() more efficient by integrating tag_get()
into it and by only handling NUL-terminated strings.
Minus 25 lines of code, no functional change.

9 years agoimplement tagging for .Er
Ingo Schwarze [Sat, 25 Jul 2015 14:23:08 +0000 (14:23 +0000)]
implement tagging for .Er

9 years agobasic tag support for function names; written at YYC
Ingo Schwarze [Sat, 25 Jul 2015 14:18:04 +0000 (14:18 +0000)]
basic tag support for function names; written at YYC

9 years agobasic support for tag priorities; written at YYC
Ingo Schwarze [Sat, 25 Jul 2015 14:02:06 +0000 (14:02 +0000)]
basic support for tag priorities; written at YYC

9 years agoWhen creation of the temporary tags file fails, call the pager
Ingo Schwarze [Tue, 21 Jul 2015 03:26:21 +0000 (03:26 +0000)]
When creation of the temporary tags file fails, call the pager
without the -T option, because otherwise the pager won't even start.
Fixing a bug reported by jca@.

While here, shorten the code by two lines
and delete one internal interface function.

9 years agoDo not fork and exec gunzip(1), just link with libz instead.
Ingo Schwarze [Sun, 19 Jul 2015 06:05:16 +0000 (06:05 +0000)]
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.

9 years agoIf we aren't on a tty, clear the pager flag up front.
Ingo Schwarze [Sun, 19 Jul 2015 00:07:42 +0000 (00:07 +0000)]
If we aren't on a tty, clear the pager flag up front.
Just to clean up code structure, no functional change.

9 years agoInsist that manual page file name extensions must begin with a digit,
Ingo Schwarze [Sat, 18 Jul 2015 05:47:32 +0000 (05:47 +0000)]
Insist that manual page file name extensions must begin with a digit,
lest pkg.conf(5) be shown when pkg(5) is asked for;
issue reported by Michael Reed <m dot reed at mykolab dot com>.

9 years agoanother portability todo
Ingo Schwarze [Sat, 18 Jul 2015 03:43:51 +0000 (03:43 +0000)]
another portability todo

9 years agoclean up the temporary file when the process dies from a signal
Ingo Schwarze [Sat, 18 Jul 2015 03:41:37 +0000 (03:41 +0000)]
clean up the temporary file when the process dies from a signal

9 years agoInitial, still somewhat experimental implementation to leverage
Ingo Schwarze [Fri, 17 Jul 2015 22:38:29 +0000 (22:38 +0000)]
Initial, still somewhat experimental implementation to leverage
less(1) -T and :t ctags(1)-like functionality to jump to the
definitions of various terms inside manual pages.
To be polished in the tree, so bear with me and report issues.

Technically, if less(1) is used as a pager, information is collected
by the mdoc(7) terminal formatter, first stored using the ohash
library, then ultimately written to a temporary file which is passed
to less via -T.  No change intended for other output formatters or
when running without a pager.

Based on an idea from Kristaps using feedback from many, in particular
phessler@ nicm@ millert@ halex@ doug@ kspillner@ deraadt@.

9 years agoFix the "depend" target and regenerate Makefile.depend:
Ingo Schwarze [Tue, 14 Jul 2015 23:16:29 +0000 (23:16 +0000)]
Fix the "depend" target and regenerate Makefile.depend:
* do not process the test-*.c files, they are not built via make
* add the missing compat_stringlist.c and soelim.c
* read.c now uses roff_int.h
* roff.c no longer uses libmdoc.h

9 years agoheaders should not contain macros
Ingo Schwarze [Tue, 14 Jul 2015 19:40:05 +0000 (19:40 +0000)]
headers should not contain macros

9 years agoIgnore blank characters at the beginning of a conditional block,
Ingo Schwarze [Sat, 27 Jun 2015 13:29:14 +0000 (13:29 +0000)]
Ignore blank characters at the beginning of a conditional block,
that is, after "\{".
Issue found by Markus <Waldeck at gmx dot de> in bash(1).

9 years agodelete some TODO entries that were already fixed
Ingo Schwarze [Fri, 26 Jun 2015 16:56:18 +0000 (16:56 +0000)]
delete some TODO entries that were already fixed

9 years agonice idea for eqn(7) from CDBUG.
Ingo Schwarze [Thu, 18 Jun 2015 01:02:16 +0000 (01:02 +0000)]
nice idea for eqn(7) from CDBUG.

9 years agotwo new tasks i heard about at BSDCan
Ingo Schwarze [Wed, 10 Jun 2015 22:26:19 +0000 (22:26 +0000)]
two new tasks i heard about at BSDCan

9 years agoAvoid warning "defined but not used" when compiling with HAVE_MANPATH.
Ingo Schwarze [Wed, 10 Jun 2015 19:26:13 +0000 (19:26 +0000)]
Avoid warning "defined but not used" when compiling with HAVE_MANPATH.
Issue found on Debian by Markus <Waldeck at gmx dot de>.

9 years agoAvoid warning "unused variable" when compiling without HAVE_WCHAR.
Ingo Schwarze [Wed, 10 Jun 2015 19:17:15 +0000 (19:17 +0000)]
Avoid warning "unused variable" when compiling without HAVE_WCHAR.
Issue found on Debian by Markus <Waldeck at gmx dot de>.

9 years agoImplement the roff(7) `r' (register exists) conditional.
Ingo Schwarze [Sun, 31 May 2015 23:13:22 +0000 (23:13 +0000)]
Implement the roff(7) `r' (register exists) conditional.
Missing feature found by Markus <Waldeck at gmx dot de>
in Debian's bash(1) manual page.

9 years agoThis one needs config.h too, if only for __BEGIN_DECLS.
Ingo Schwarze [Thu, 21 May 2015 00:18:52 +0000 (00:18 +0000)]
This one needs config.h too, if only for __BEGIN_DECLS.
Found on Solaris 11 in the OpenCSW cluster.

9 years agoadd forgotten glue
Ingo Schwarze [Thu, 21 May 2015 00:13:43 +0000 (00:13 +0000)]
add forgotten glue

9 years agoLink compat_reallocarray.o into soelim; needed on
Ingo Schwarze [Thu, 21 May 2015 00:04:38 +0000 (00:04 +0000)]
Link compat_reallocarray.o into soelim; needed on
platforms having neither stringlist nor compat_reallocarray.

9 years agoRemove clauses 3 and 4 from Christos Zoulas' BSD license.
Ingo Schwarze [Wed, 20 May 2015 23:43:03 +0000 (23:43 +0000)]
Remove clauses 3 and 4 from Christos Zoulas' BSD license.
This is safe because Christos did that himself in NetBSD in 2008.
No code change.

9 years agofix integer overflows by using reallocarray(3)
Ingo Schwarze [Wed, 20 May 2015 23:00:43 +0000 (23:00 +0000)]
fix integer overflows by using reallocarray(3)

9 years ago* fix roff terminology in .Nd
Ingo Schwarze [Wed, 20 May 2015 22:59:12 +0000 (22:59 +0000)]
* fix roff terminology in .Nd
* remove .Xr to self
* add AUTHORS section

9 years agoUse PATH_MAX rather than the non-standard MAXPATHLEN.
Ingo Schwarze [Wed, 20 May 2015 22:57:22 +0000 (22:57 +0000)]
Use PATH_MAX rather than the non-standard MAXPATHLEN.

9 years ago* remove FreeBSDisms
Ingo Schwarze [Wed, 20 May 2015 22:22:59 +0000 (22:22 +0000)]
* remove FreeBSDisms
* purge and sort headers
* add build and compat glue
* and LICENSE information
for soelim(1)

9 years agoInitial revision
Ingo Schwarze [Wed, 20 May 2015 20:55:04 +0000 (20:55 +0000)]
Initial revision

9 years agoDo not let the -m option or MANPATH with leading, trailing, or double
Ingo Schwarze [Thu, 7 May 2015 12:08:13 +0000 (12:08 +0000)]
Do not let the -m option or MANPATH with leading, trailing, or double
colon override the default manpath, let them add to the default manpath.
Only override the default manpath by the -M option, by MANPATH without
leading, trailing, or double colon, or by "manpath" in man.conf(5).

Problem reported by Jan Stary <hans at stare dot cz>.
Patch OK'ed by millert@.

9 years agomdoc_valid_post() may indirectly call roff_node_unlink() which may
Ingo Schwarze [Fri, 1 May 2015 16:58:33 +0000 (16:58 +0000)]
mdoc_valid_post() may indirectly call roff_node_unlink() which may
set ROFF_NEXT_CHILD, which is desirable for the final call to
mdoc_valid_post() - in case the target itself gets deleted, the
parse point may need this adjustment - but not for the intermediate
calls - if intermediate nodes get deleted, that mustn't clobber the
parse point.  So move setting ROFF_NEXT_SIBLING to the proper place
in rew_last().

This fixes the assertion failure in jsg@'s afl test case 108/Apr27.

9 years agoSetting the "last" member of struct roff_node was done at an extremely
Ingo Schwarze [Fri, 1 May 2015 16:02:47 +0000 (16:02 +0000)]
Setting the "last" member of struct roff_node was done at an extremely
weird place.  Move it to the obviously correct place.
Surprisingly, this didn't cause any misformatting in the test suite
or in any base system manuals, but i cannot believe the code was
really correct for all conceivable input, and it would be very hard
to verify.  At the very least, it cannot have worked for man(7).

9 years agoMinor bug fix: When .Pp rewinds .Nm, rewind the whole block,
Ingo Schwarze [Fri, 1 May 2015 15:27:54 +0000 (15:27 +0000)]
Minor bug fix:  When .Pp rewinds .Nm, rewind the whole block,
not just the body.  In some unusual edge cases, this caused
the .Pp to become a sibling of the .Nm body inside the .Nm block.

9 years agoIf a block body gets broken, that's no good reason to extend the
Ingo Schwarze [Wed, 29 Apr 2015 21:58:32 +0000 (21:58 +0000)]
If a block body gets broken, that's no good reason to extend the
scope of the end macro.  Instead, only keep the tail scope open if
the end macro macro calls an explicit macro and actually breaks
that.  This corrects syntax tree structure and fixes an assertion
found by jsg@ with afl (test case 098/Apr27).

9 years agoReplace the kludge for the \z escape sequence by an actual
Ingo Schwarze [Wed, 29 Apr 2015 18:35:00 +0000 (18:35 +0000)]
Replace the kludge for the \z escape sequence by an actual
implementation.  As a side effect, minus ten lines of code.

As another side effect, this also fixes the assertion failure that
used to be triggered by "\z\o'ab'c" at the beginning of an output
line, found by jsg@ with afl (test case 022/Apr27).

9 years agoDo not mark a block with the MDOC_BROKEN flag if it merely contains
Ingo Schwarze [Wed, 29 Apr 2015 14:48:53 +0000 (14:48 +0000)]
Do not mark a block with the MDOC_BROKEN flag if it merely contains
a mismatching explicit end macro without actually being broken.
Avoids a subsequent upward search for the non-existent breaker
ending up in a NULL pointer access; afl test case 005/Apr27 from jsg@.

9 years agoWhen the last line of a table layout turns out to be empty, it is deleted.
Ingo Schwarze [Wed, 29 Apr 2015 12:44:58 +0000 (12:44 +0000)]
When the last line of a table layout turns out to be empty, it is deleted.
Do not just free the struct tbl_row but also make sure that no pointer
to it remains.  Fixing a use after free found by jsg@ with afl.

9 years agoImprove the error message in case somebody has configured an invalid PAGER.
Ingo Schwarze [Wed, 29 Apr 2015 11:04:17 +0000 (11:04 +0000)]
Improve the error message in case somebody has configured an invalid PAGER.
Suggested by Lorenzo Beretta <lory dot fulgi at infinito dot it>.

9 years agoFix the HAVE_MANPATH case, got broken in rev. 1.23.
Ingo Schwarze [Tue, 28 Apr 2015 16:13:45 +0000 (16:13 +0000)]
Fix the HAVE_MANPATH case, got broken in rev. 1.23.
Patch from Steffen Nurpmeso <sdaoden at yandex dot com>, thanks.

9 years agoUnify mdoc_deroff() and man_deroff() into a common function deroff().
Ingo Schwarze [Thu, 23 Apr 2015 16:17:44 +0000 (16:17 +0000)]
Unify mdoc_deroff() and man_deroff() into a common function deroff().
No functional change except that for mdoc(7), it now skips leading
escape sequences just like it already did for man(7).
Escape sequences rarely occur in mdoc(7) code and if they do,
skipping them is an improvement in this context.
Minus 30 lines of code.

9 years agoGet rid of two empty wrapper functions. No functional change.
Ingo Schwarze [Thu, 23 Apr 2015 15:35:59 +0000 (15:35 +0000)]
Get rid of two empty wrapper functions.  No functional change.

9 years agoAvoid a use after free when the target node is deleted during validation.
Ingo Schwarze [Tue, 21 Apr 2015 16:14:25 +0000 (16:14 +0000)]
Avoid a use after free when the target node is deleted during validation.
Bug reported by jsg@.

9 years agoFix previous: Don't let man(1) warn twice about non-existant names.
Ingo Schwarze [Mon, 20 Apr 2015 09:54:48 +0000 (09:54 +0000)]
Fix previous:  Don't let man(1) warn twice about non-existant names.
Again noticed by deraadt@.

9 years agoAvoid out-of-bounds read access before the beginning of the
Ingo Schwarze [Mon, 20 Apr 2015 09:48:53 +0000 (09:48 +0000)]
Avoid out-of-bounds read access before the beginning of the
mdoc_macros[] array.  This sometimes prevented proper warnings
about text nodes preceding the first section header.

9 years agoMore than one data field may follow T} on the same input line.
Ingo Schwarze [Sun, 19 Apr 2015 20:35:20 +0000 (20:35 +0000)]
More than one data field may follow T} on the same input line.
Issue found by Christian Neukirchen <chneukirchen at gmail dot com>
in the socket(2) manual on Linux.
Also fixes major rendering bugs (including partial loss of content)
in XkbChangeControls(3), XkbFreeClientMap(3), XkbGetMap(3),
XkbKeyNumGroups(3), and XkbSetMap(3).

9 years agoIf an explicit line break request (.br or .sp) occurs within an .HP block,
Ingo Schwarze [Sun, 19 Apr 2015 19:44:21 +0000 (19:44 +0000)]
If an explicit line break request (.br or .sp) occurs within an .HP block,
the next line doesn't hang, but is simply indented.
Issue found by Christian Neukirchen <chneukirchen at gmail dot com>
in the dmsetup(8) manual on Linux.
This patch also improves the indentation of XDGA(3) and XrmGetResource(3).

9 years agoIf apropos(1) finds no match, print "nothing appropriate" to stderr
Ingo Schwarze [Sun, 19 Apr 2015 15:10:46 +0000 (15:10 +0000)]
If apropos(1) finds no match, print "nothing appropriate" to stderr
similar to what the old apropos did.
Requested by and OK deraadt@.

9 years agoUnify trickier node handling functions.
Ingo Schwarze [Sun, 19 Apr 2015 14:57:38 +0000 (14:57 +0000)]
Unify trickier node handling functions.
* man_elem_alloc() -> roff_elem_alloc()
* man_block_alloc() -> roff_block_alloc()
The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for
now because they need to do mdoc(7)-specific argument processing.

9 years agoUnify some node handling functions that use TOKEN_NONE.
Ingo Schwarze [Sun, 19 Apr 2015 14:25:41 +0000 (14:25 +0000)]
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.

9 years agoDecouple the token code for "no request or macro" from the individual
Ingo Schwarze [Sun, 19 Apr 2015 14:00:19 +0000 (14:00 +0000)]
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.

9 years agoUnify node handling functions:
Ingo Schwarze [Sun, 19 Apr 2015 13:50:25 +0000 (13:50 +0000)]
Unify node handling functions:
* node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc()
* node_append() for mdoc and man_node_append() -> roff_node_append()
* mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc()
* mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc()
* mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink()
* mdoc_node_free() and man_node_free() -> roff_node_free()
* mdoc_node_delete() and man_node_delete() -> roff_node_delete()
Minus 130 lines of code, no functional change.

9 years agoDelete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),
Ingo Schwarze [Sat, 18 Apr 2015 17:53:21 +0000 (17:53 +0000)]
Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),
man_node() from the mandoc(3) semi-public interface and the internal
wrapper functions print_mdoc() and print_man() from the HTML formatters.
Minus 60 lines of code, no functional change.

9 years agoUnify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().
Ingo Schwarze [Sat, 18 Apr 2015 17:28:36 +0000 (17:28 +0000)]
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.

9 years agoMove mdoc_hash_init() and man_hash_init() to libmandoc.h
Ingo Schwarze [Sat, 18 Apr 2015 17:01:58 +0000 (17:01 +0000)]
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.

9 years agoProfit from the unified struct roff_man and reduce the number of
Ingo Schwarze [Sat, 18 Apr 2015 16:34:25 +0000 (16:34 +0000)]
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.

9 years agoReplace the structs mdoc and man by a unified struct roff_man.
Ingo Schwarze [Sat, 18 Apr 2015 16:06:39 +0000 (16:06 +0000)]
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.

9 years agolook at COHERENT troff
Ingo Schwarze [Sat, 18 Apr 2015 16:05:45 +0000 (16:05 +0000)]
look at COHERENT troff

9 years agoflorian want <img> tags for https://tlakh.xyz/p2k15.7.html
Ingo Schwarze [Thu, 16 Apr 2015 20:36:04 +0000 (20:36 +0000)]
florian want <img> tags for https://tlakh.xyz/p2k15.7.html

9 years agoRestore the page headers and page footers that accidentally got lost
Ingo Schwarze [Thu, 16 Apr 2015 20:22:27 +0000 (20:22 +0000)]
Restore the page headers and page footers that accidentally got lost
in rev. 1.225.  Regression reported by florian@.

9 years agoshorten "outdated mandoc.db" warning message; requested by deraadt@
Ingo Schwarze [Thu, 16 Apr 2015 16:36:21 +0000 (16:36 +0000)]
shorten "outdated mandoc.db" warning message; requested by deraadt@

9 years agoDo not mistreat empty arguments to font alternating macros
Ingo Schwarze [Mon, 6 Apr 2015 22:06:23 +0000 (22:06 +0000)]
Do not mistreat empty arguments to font alternating macros
as vertical spacing requests.  Bug found with xmahjongg(6).

9 years agoOn a new RS nesting level, the saved width starts from the default
Ingo Schwarze [Mon, 6 Apr 2015 14:59:21 +0000 (14:59 +0000)]
On a new RS nesting level, the saved width starts from the default
width, not from the saved width of the previous level.
Improves xterm(1) and XSetEventQueueOwner(3); found in transcode_filter(1).

9 years agoUse the default width for .RS without arguments.
Ingo Schwarze [Mon, 6 Apr 2015 13:35:08 +0000 (13:35 +0000)]
Use the default width for .RS without arguments.
Reduces groff-mandoc differences in base and Xenocara by about 4%.
Found while looking at wpa_supplicant(8).

9 years agoIf a partial explicit block extending to the next input line follows
Ingo Schwarze [Sun, 5 Apr 2015 23:04:41 +0000 (23:04 +0000)]
If a partial explicit block extending to the next input line follows
the end macro of a broken block, put all of it into the breaking block.
Needed for example by mutella(1).

9 years agoReduce code duplication, no functional change:
Ingo Schwarze [Sun, 5 Apr 2015 22:44:20 +0000 (22:44 +0000)]
Reduce code duplication, no functional change:
Both partial and full implicit blocks can break explicit blocks.
Put the code to handle both cases into a common function.

9 years agoArguments to end macros of broken partial explicit blocks
Ingo Schwarze [Sun, 5 Apr 2015 14:43:36 +0000 (14:43 +0000)]
Arguments to end macros of broken partial explicit blocks
must go inside the breaking block.  For example, in
.It Ic cmd Oo
.Ar optional_arg Oc Ar mandatory_arg
the mandatory_arg is still inside the .It block.
Used for example by mutella(1).

9 years agoallow using an alternate mandoc binary
Ingo Schwarze [Sun, 5 Apr 2015 09:30:24 +0000 (09:30 +0000)]
allow using an alternate mandoc binary

9 years agoGive man(7) section and subsection headers hanging indentation.
Ingo Schwarze [Sat, 4 Apr 2015 18:52:51 +0000 (18:52 +0000)]
Give man(7) section and subsection headers hanging indentation.
Reduces groff-mandoc differences in base by about 2.5% due to
various Perl manuals having long section titles.
Quirk found in argtable2(3).

9 years agoRounding rules for horizontal scaling widths are more complicated.
Ingo Schwarze [Sat, 4 Apr 2015 17:47:18 +0000 (17:47 +0000)]
Rounding rules for horizontal scaling widths are more complicated.
There is a first rounding to basic units on the input side.
After that, rounding rules differ between requests and macros.
Requests round to the nearest possible character position.
Macros round to the next character position to the left.

Implement that by changing the return value of term_hspan()
to basic units and leaving the second scaling and rounding stage
to the formatters instead of doing it in the terminal handler.

Improves for example argtable2(3).