summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* The header libmandoc.h is part of the internal parser interface,Ingo Schwarze2014-12-011-1/+0
| | | | | | but html.c is not part of the parser at all, so it cannot include that header, and actually, it doesn't need it. Found while auditing includes after Theo's recent *.h commit.
* The file read.c is part of the parser, so it cannot include main.h,Ingo Schwarze2014-12-012-4/+3
| | | | | | | 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.
* remove unneccessary inclusion protection; patch from deraadt@Ingo Schwarze2014-12-0114-56/+0
|
* typo; Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux)Ingo Schwarze2014-11-301-1/+1
|
* delete three standard abbreviations that areIngo Schwarze2014-11-302-15/+2
| | | | | | * no longer used in OpenBSD * not used in any of NetBSD, FreeBSD, or DragonFly * not supported by groff
* Multiple fixes with respect to .Pf:Ingo Schwarze2014-11-308-10/+33
| | | | | | | * 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.
* warn about attempts to call non-callable macros;Ingo Schwarze2014-11-304-8/+25
| | | | inspired by a similar warning in the groff_mdoc(7) macros
* Reduce code duplication by reusing the same argument parserIngo Schwarze2014-11-291-18/+20
| | | | | for in_line_eoln() macros and .Bl -column phrases. No functional change.
* Provide a helper function macro_or_word() and use it to prune theIngo Schwarze2014-11-293-128/+68
| | | | | | | | | | same chunk of argument parsing code out of five of the eight callback functions. The other three have too much special handling to participate. As a bonus, let lookup() and mdoc_args() deal with line macros and retire the lookup_raw() helper and the mdoc_zargs() internal interface function. No functional change, minus 40 lines of code.
* Fold the loop around mdoc_argv() into the function itself,Ingo Schwarze2014-11-283-124/+82
| | | | | | it was the same in all four cases. As a bonus, get rid of one enum type that was used for internal communication. No functional change, minus 40 lines of code.
* AT&T is unlikely to release an new version of Research UNIX any time soon.Ingo Schwarze2014-11-284-49/+18
| | | | | So, it's pointless to make adding version strings easy for downstream. One source file less to maintain.
* Retire support for CSRG supplementary document titles. These areIngo Schwarze2014-11-286-120/+5
| | | | | long obsolete and were never written in mdoc(7) in the first place. Removes 100 lines from source files.
* 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.