aboutsummaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAgeFilesLines
...
* Be more careful about meta->name. For weird input, it can be NULL.Ingo Schwarze2014-11-281-7/+11
| | | | Fixing a NULL access jsg@ found with afl.
* Simplify by making the eqn and tbl steering functions void;Ingo Schwarze2014-11-284-45/+28
| | | | no functional change, minus 15 lines of code.
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-286-289/+186
| | | | and some cleanup; no functional change, minus 70 lines.
* Simplify by making the mdoc parser callbacks void, and some cleanup;Ingo Schwarze2014-11-283-218/+140
| | | | no functional change, minus 50 lines of code.
* Simplify the code by making various mdoc parser helper functions void.Ingo Schwarze2014-11-284-434/+271
| | | | No functional change, minus 130 lines of code.
* Simplify code by making mdoc validation handlers void.Ingo Schwarze2014-11-284-417/+288
| | | | No functional change, minus 90 lines of code.
* Downgrade .Bd -file from FATAL to ERROR.Ingo Schwarze2014-11-274-19/+19
| | | | | 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-26/+62
| | | | | | | | 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-45/+39
| | | | | 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-30/+28
| | | | | | | | 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-2/+2
|
* Let mparse_readfd() use mparse_open() and mparse_wait()Ingo Schwarze2014-11-262-30/+61
| | | | | | | | 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-39/+27
| | | | | 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-3/+1
|
* The .Sm macro accepts at most one argument;Ingo Schwarze2014-11-261-2/+2
| | | | fixing an assertion failure found by jsg@ with afl.
* Make the code sipler and more robust by always assigning a valueIngo Schwarze2014-11-261-12/+6
| | | | to q.manpath and dropping the (incomplete) later NULL checks.
* Allow comma-separated options in tbl(7) tables.Ingo Schwarze2014-11-262-5/+6
| | | | | Provides better groff compatibility. From bentley@.
* Completely rewrite the top level of the layout parser.Ingo Schwarze2014-11-251-57/+42
| | | | | | * 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-12/+4
| | | | from bentley@.
* Do not access a NULL pointer when a section has no body,Ingo Schwarze2014-11-252-9/+14
| | | | | 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-39/+33
| | | | | | | | | | | | | | | | | | | | | 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-8/+12
| | | | | | | | | 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-1/+9
|
* Fix two minibugs reported by Thomas Klausner <wiz at NetBSD>:Ingo Schwarze2014-11-201-2/+5
| | | | | 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-9/+34
| | | | just like groff; minibug noticed by bentley@.
* Three fixes with respect to the names table:Ingo Schwarze2014-11-191-4/+14
| | | | | | 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-15/+40
| | | | | | 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-4/+8
| | | | | | | 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-16/+31
| | | | | | 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-12/+18
| | | | | | 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-38/+90
| | | | | | | | | | * .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-2/+4
| | | | | | 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-27/+3
| | | | | | | | | * 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-25/+5
| | | | | | | 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-4/+18
| | | | | 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-7/+10
| | | | | | 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-15/+55
| | | | requested by tedu@
* add required vertical spacing before lists that beginIngo Schwarze2014-11-101-10/+12
| | | | | | 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-1/+10
| | | | punctuation in the middle of .Fn
* Let -Tascii \(bu (bullet) output agree with groff;Ingo Schwarze2014-11-062-4/+4
| | | | 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-10/+31
| | | | | | | 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-173/+169
| | | | | | 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-53/+48
| | | | | | 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-2/+2
|
* Major bugsquashing with respect to -offset and -width:Ingo Schwarze2014-10-305-110/+62
| | | | | | | | | 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-3/+3
|
* fix a macro error in previous; from jmc@Ingo Schwarze2014-10-301-3/+3
|
* Some fine tuning of console rendering of named special characters.Ingo Schwarze2014-10-291-20/+20
| | | | | | Correct ASCII rendering: \(lb \(<> \(sd Make ASCII rendering agree with groff, using backspace overstrike: \(da \(ua \(dA \(uA \(fa \(c* \(c+ \(ib \(ip \(/_ \(pp \(is \(dd \(dg
* In terminal output, unify handling of Unicode and numbered characterIngo Schwarze2014-10-294-51/+78
| | | | | | | | | | | escape sequences just like it was earlier implemented for -Thtml. Do not let control characters other than ASCII 9 (horizontal tab) propagate to the output, even though groff allows them; but that really doesn't look like a great idea. Let mchars_num2char() return int such that we can distinguish invalid \N syntax from \N'0'. This also reduces the danger of signed char issues popping up.
* In -Tascii mode, print "<?>" only for Unicode escapes of unknownIngo Schwarze2014-10-282-13/+7
| | | | | | representation, not for character escapes with unknown names. According to groff, the latter produce no output, and we now warn about them.