summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Drop useless architecture table. Validating architecture namesIngo Schwarze2014-11-288-181/+9
| | | | | | 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@.
* kill a pointless assertIngo Schwarze2014-11-281-3/+0
|
* mop up an #ifdef turd deraadt@ stepped intoIngo Schwarze2014-11-281-8/+2
|
* Be more careful about meta->name. For weird input, it can be NULL.Ingo Schwarze2014-11-281-6/+10
| | | | Fixing a NULL access jsg@ found with afl.
* Simplify by making the eqn and tbl steering functions void;Ingo Schwarze2014-11-284-41/+24
| | | | no functional change, minus 15 lines of code.
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-286-284/+181
| | | | and some cleanup; no functional change, minus 70 lines.
* Simplify by making the mdoc parser callbacks void, and some cleanup;Ingo Schwarze2014-11-283-215/+137
| | | | no functional change, minus 50 lines of code.
* Simplify the code by making various mdoc parser helper functions void.Ingo Schwarze2014-11-284-431/+268
| | | | No functional change, minus 130 lines of code.
* Simplify code by making mdoc validation handlers void.Ingo Schwarze2014-11-284-413/+284
| | | | No functional change, minus 90 lines of code.
* Downgrade .Bd -file from FATAL to ERROR.Ingo Schwarze2014-11-274-14/+14
| | | | | Since this was the last remaining FATAL error in this area, this change will allow major simplifications in the mdoc(7) parser.
* Multiple fixes with respect to .Eo:Ingo Schwarze2014-11-274-22/+58
| | | | | | | | 1. Correctly parse stray .Ec without preceding .Eo, avoiding an assertion violation found by jsg@ with afl. 2. Correctly parse .Ec arguments when breaking another block. 3. Correct spacing around closing delimiter when breaking another block. 4. Sync some related formatting control from -Tascii to -Thtml.
* Fix the obsolete .Db (toggle debug mode) macro to ignore its argumentsIngo Schwarze2014-11-275-39/+33
| | | | | and not trigger an assertion when there is more than one argument; the latter found by jsg@ with afl.
* Make makewhatis(8) understand .so links to .gz pages.Ingo Schwarze2014-11-273-27/+25
| | | | | | | | Drop the FORM_GZ annotation in the mpages table; it is conceptually wrong because it ought to be in the mlinks table: An uncompressed .so link file can point to a compressed manual page file and vice versa. Besides, it is no longer needed because mparse_open() handles it all. Sprinkle some KNF while here.
* fix build when HAVE_MANPATH is set; patch from <bapt at FreeBSD>Ingo Schwarze2014-11-271-1/+1
|
* Let mparse_readfd() use mparse_open() and mparse_wait()Ingo Schwarze2014-11-262-28/+59
| | | | | | | | 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.
* Simplify the mparse_open()/mparse_wait() interface.Ingo Schwarze2014-11-266-32/+20
| | | | | Don't bother the user with the PID of the child process, store it inside the opaque mparse handle.
* remove an unreachable warning about .Sm argumentsIngo Schwarze2014-11-261-2/+0
|
* The .Sm macro accepts at most one argument;Ingo Schwarze2014-11-261-1/+1
| | | | fixing an assertion failure found by jsg@ with afl.
* Make the code sipler and more robust by always assigning a valueIngo Schwarze2014-11-261-11/+5
| | | | to q.manpath and dropping the (incomplete) later NULL checks.
* Allow comma-separated options in tbl(7) tables.Ingo Schwarze2014-11-262-2/+3
| | | | | Provides better groff compatibility. From bentley@.
* Completely rewrite the top level of the layout parser.Ingo Schwarze2014-11-251-56/+41
| | | | | | * Do not allocate lines unless there are cells. * Make the MANDOCERR_TBLNOLAYOUT message actually work. Also get rid of one static function and two goto statements.
* "Aq foo" is not the same as "<foo>". Don't use it to mark up HTML;Ingo Schwarze2014-11-251-10/+2
| | | | from bentley@.
* Do not access a NULL pointer when a section has no body,Ingo Schwarze2014-11-252-7/+12
| | | | | which can for example happen for .Sh Xo .Sh without .Xc. Crash found by jsg@ with afl.
* We repeatedly observed assertion crashes in the low-level terminalIngo Schwarze2014-11-213-36/+30
| | | | | | | | | | | | | | | | | | | | | output handler because the high level terminal formatters could be tricked into setting the left margin further to the right than the right margin. Today, jsg@ found more of these with afl. Change the internal interface between both levels, aiming for simplicity and robustness of the code. Treat both margins as *independent* settings: Now, termp.offset is the requested left margin, and termp.rmargin is the available space. Let the lower level cope with that case of insufficient space. Obviously, high level code that does centering or flush right still has to do careful checks, so i did a full audit of margin settings in the terminal formatters. Fixes crashes caused by excessively long title or date strings in the man(7) footer, operating system or date strings in the mdoc(7) footer, volume strings in the man(7) or mdoc(7) header, and a few cases related to some non-prologue macros.
* Prevent negative arguments to the .ll request from causing integerIngo Schwarze2014-11-202-6/+10
| | | | | | | | | underflow. Found while preparing an audit of termp.rmargin. Overflow can also happen, but i see no sane way to deal with it, so just let it happen. It doesn't happen for any sane input anyway, groff behaviour is undefined, and the resulting values are legal, even though they are useless.
* warn about calling non-callable macrosIngo Schwarze2014-11-201-0/+8
|
* Fix two minibugs reported by Thomas Klausner <wiz at NetBSD>:Ingo Schwarze2014-11-201-1/+4
| | | | | 1. The first argument of .Fn is not supposed to be parsed. 2. The .Fn macro is not supposed to reopen its scope after punctuation.
* Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,Ingo Schwarze2014-11-193-6/+31
| | | | just like groff; minibug noticed by bentley@.
* Three fixes with respect to the names table:Ingo Schwarze2014-11-191-3/+13
| | | | | | 1. Do not mask out NAME_FIRST before its first use. 2. Avoid duplicate NAME_FILE entries. 3. Correctly mask NAME_FILE for .so links.
* Escape sequences terminate high-level macro names, and when doing so,Ingo Schwarze2014-11-192-13/+38
| | | | | | they are ignored, just in the same way as for request names and for low-level macro names. This also cures a warning in the pod2man(1) preamble.
* Support the ".if v" conditional operator (vroff mode, always false)Ingo Schwarze2014-11-192-1/+5
| | | | | | | for groff compatibility because pod2man(1) uses it that way. Weirdly, groff documents it as "for compatibility with other troff versions" but neither Heirloom nor Plan 9 have it. Issue reported by giovanni@ via sthen@.
* Ignore invalid directories in man.conf(5) and MANPATH, even if theirIngo Schwarze2014-11-181-15/+30
| | | | | | parent directories exist, but complain about invalid directories given on the command line. Intended to fix an oddity reported by sthen@.
* In man(1) mode, prefer file name matches over .Dt name matches overIngo Schwarze2014-11-182-10/+16
| | | | | | first .Nm entries over other NAME .Nm entries over SYNOPSIS .Nm entries. For example, this makes sure "man ypbind" does not return yp(8). Re-run "makewhatis" to profit from this change.
* Multiple fixes with respect to in-line macros:Ingo Schwarze2014-11-176-32/+84
| | | | | | | | | | * .No selects the default font; relevant e.g. in .Bf blocks * no need to force empty .Li elements * closing delimiters as leading macro arguments do not suppress space * opening delimiters at the end of a macro line do not suppress space * correctly handle delimiter spacing in -Tman As a side effect, these fixes let mandoc warn about empty .No macros as requested by bentley@.
* When a line (in the sense of term_flushln()) contains white space only,Ingo Schwarze2014-11-161-1/+3
| | | | | | the `vbl' variable includes the left margin, but `vis' does not. Prevent a `vis' underflow that caused a bogus blank line. Bug reported by Carsten Kunze, found in less(1): .Bl -tag ... .It " "
* Delete five standards that are:Ingo Schwarze2014-11-162-24/+0
| | | | | | | | | * not supported by groff * not used in any OpenBSD, NetBSD, DragonFly or FreeBSD base manual * superseded or retracted * and more than ten years old Triggered by a question from Carsten Kunze (Heirloom troff). OK guenther@ jmc@
* Remove needless and harmful byte swapping on big endian architectures.Ingo Schwarze2014-11-141-24/+4
| | | | | | | Problem found and patch provided by Martin Natano at bitrig, thanks! Tested on macppc by natano@ and on i386, amd64, and sparc64 myself. While here, sync with OpenBSD by removing some trailing whitespace.
* In man(1) mode without -a, stop searching after the first manual treeIngo Schwarze2014-11-114-0/+14
| | | | | that contained at least one match in order to not prefer mdoc(1) from ports over mdoc(7). As a bonus, this results in a speedup.
* Let -h imply -c (that is, not use the pager).Ingo Schwarze2014-11-113-2/+5
| | | | | | Usually, -h output is short, so the pager is just a nuisance. Also, traditional man(1) does not use a pager for -h. Triggered by a remark of deraadt@ on ICB.
* implement -h (synopsis only) for preformatted (cat) pages;Ingo Schwarze2014-11-111-14/+54
| | | | requested by tedu@
* add required vertical spacing before lists that beginIngo Schwarze2014-11-101-9/+11
| | | | | | at the beginning of the first item of an enclosing list right at the beginning of a new section or subsection; minibug reported by Steffen Nurpmeso <sdaoden at yandex dot com>
* hyperlinking in -man -ThtmlIngo Schwarze2014-11-091-0/+9
| | | | punctuation in the middle of .Fn
* Let -Tascii \(bu (bullet) output agree with groff;Ingo Schwarze2014-11-062-2/+2
| | | | this is now possible because -Tps now handles backspace overstriking.
* Allow the five man(7) font macros to concatenate their line arguments,Ingo Schwarze2014-11-033-7/+28
| | | | | | | the same way the mdoc(7) macros marked MDOC_JOIN do it. In -Thtml, this removes bogus <br/> when the font macros are used in no-fill mode; issue found by jsg@ in the Xcursor(3) SYNOPSIS. As a bonus, this slightly reduces the size of the syntax tree.
* Use struct buf in libroff, it is very natural thereIngo Schwarze2014-11-013-170/+166
| | | | | | and reduces the number of arguments of many functions. While here, sprinkle some KNF. No functional change.
* Refactor, no functional change: Remove the parse point from struct buf.Ingo Schwarze2014-11-013-50/+45
| | | | | | 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.
* fix a typo causing crashes in Unicode string length measurementIngo Schwarze2014-11-011-1/+1
|
* Major bugsquashing with respect to -offset and -width:Ingo Schwarze2014-10-305-104/+56
| | | | | | | | | 1. Support specifying the .Bd and .Bl -offset as a macro default width; while here, simplify the code handling the same for .Bl -width. 2. Correct handling of .Bl -offset arguments: unlike .Bd -offset, the arguments "left", "indent", and "indent-two" have no special meaning. 3. Fix the scaling of string length -offset and -width arguments in -Thtml. Triggered by an incomplete documentation patch from bentley@.
* add -K to usage() and wrap nicely; from jmc@Ingo Schwarze2014-10-301-2/+2
|
* fix a macro error in previous; from jmc@Ingo Schwarze2014-10-301-1/+1
|