summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* For selecting a two-digit font size, support the historic syntax \s12Ingo Schwarze2015-02-201-0/+8
| | | | | | | in addition to the classic syntax \s(12, the modern syntax \s[12], and the alternative syntax \s'12'. The historic syntax only works for the font sizes 10-39. Real-world usage found by naddy@ in plan9/rc.
* Completely delete all carriage return characters from the input.Ingo Schwarze2015-02-201-1/+2
| | | | | | | No change to messages about them (ignore them right before line feeds, report errors elsewhere). naddy@ found a manual in the wild containing lots of these (ysm(1)), and i can't imagine a situation where dropping them could be problematic.
* \n(.$Ingo Schwarze2015-02-201-0/+4
|
* naddy@ scoured the ports tree for remaining mandoc issuesIngo Schwarze2015-02-171-4/+6
| | | | and identified two top priority issues
* Render \(lq and \(rq as '"' in -Tascii mode but leave the renderingIngo Schwarze2015-02-176-52/+54
| | | | | | of .Do/.Dc, .Dq, .Lb, and .St untouched. Reduces groff-mandoc differences in OpenBSD base by about 7%. Reminded of the issue by naddy@.
* Cope with another one of the many kinds of DocBook stupidity:Ingo Schwarze2015-02-171-2/+11
| | | | | | | | | | | | | | Instead of just using .br, DocBook sometimes fiddles with the utterly unportable internal register \n[an-break-flag] that is only available in the GNU implementation of man(7) and then arms an input line trap to call the equally unportable internal macro .an-trap that, in the GNU implementation, inspects that variable; all the world is GNU, isn't it? Since naddy@ reports that quite a few ports manuals suffer from this insanity, let's just translate it to the intended .br. Et ceterum censeo DocBookem esse delendam.
* Let .it accept numerical expressions, not just numerical constants.Ingo Schwarze2015-02-172-40/+50
| | | | | | | For .it, ignore scaling units in roff_getnum(). Inside parentheses, skip whitespace after a sign in roff_getnum(). Parse and ignore unary plus in roff_getnum(). As a bonus, get rid of the only call to mandoc_strntoi() in roff.c.
* clean up post_dt() validation function;Ingo Schwarze2015-02-162-42/+43
| | | | improved diagnostics, minus six lines of code
* Delete the -V option. It serves no purpose but keeps confusing people.Ingo Schwarze2015-02-166-32/+10
| | | | | | | | Keeping track of the versions of installed software is the job of the package manager, not of the individual binaries. If individual binaries include version numbers, that tends to goad people into writing broken configuration tests that inspect version numbers instead of properly testing for features.
* strtonum(3) compat glueIngo Schwarze2015-02-167-3/+134
|
* Clamp width and indent settings to sensible values.Ingo Schwarze2015-02-161-2/+8
| | | | | Ignore errors for now. Patch from tedu@.
* Tweak the wording to avoid the possible misunderstanding that .InIngo Schwarze2015-02-151-5/+6
| | | | | could only be used in the SYNOPSIS section. It is fine anywhere. Issue noticed by bentley@.
* shut up about tabs in SYNOPSIS .Fd lines, there is no good way to avoid themIngo Schwarze2015-02-141-1/+2
|
* After almost five years and 99 revisions, mdoc_macro.c rev. 1.182Ingo Schwarze2015-02-121-4/+0
| | | | | finally fixed the four issues explained in the mdoc_macro.c rev. 1.83 commit message.
* Do not confuse .Bl -column lists that just broken another blockIngo Schwarze2015-02-121-4/+4
| | | | | | with newly opened .Bl -column lists; fixing an assertion failure jsg@ found with afl: test case #481, Bl It Bl -column It Bd El text text El
* Delete the mdoc_node.pending pointer and the function calculatingIngo Schwarze2015-02-127-167/+108
| | | | | | | | | | | | | | | | | | | | | | | it, make_pending(), which was the most difficult function of the whole mdoc(7) parser. After almost five years of maintaining this hellhole, i just noticed the pointer isn't needed after all. Blocks are always rewound in the reverse order they were opened; that even holds for broken blocks. Consequently, it is sufficient to just mark broken blogs with the flag MDOC_BROKEN and breaking blocks with the flag MDOC_ENDED. When rewinding, instead of iterating the pending pointers, just iterate from each broken block to its parents, rewinding all that are MDOC_ENDED and stopping after processing the first ancestor that it not MDOC_BROKEN. For ENDBODY markers, use the mdoc_node.body pointer in place of the former mdoc_node.pending. This also fixes an assertion failure found by jsg@ with afl, test case #467 (Bo Bl It Bd Bc It), where (surprise surprise) the pending pointer got corrupted. Improved functionality, minus one function, minus one struct field, minus 50 lines of code.
* do not access a NULL pointer if an .Eo block lacks a tail;Ingo Schwarze2015-02-113-9/+6
| | | | found by jsg@ with afl, test case #16
* explicit blocks close out .Nd; fixing data structure corruptionIngo Schwarze2015-02-111-0/+7
| | | | | eventually leading to NULL pointer access; found by jsg@ with afl, text case #455.
* Be more careful to not generate empty .In, .St, and .Xr nodes.Ingo Schwarze2015-02-101-33/+43
| | | | | | | | That could happen when their first argument was another called macro, causing a NULL pointer access in .St validation found by jsg@ with afl. Make in_line_argn() easier to understand by using one state variable rather than two.
* Do not read past the end of the buffer if an "f" layout font modifierIngo Schwarze2015-02-101-10/+26
| | | | | | | | | | | is followed by the end of the input line instead of a font specifier. Found by jsg@ with afl, test case #591. While here, improve functionality as well: * There is no "r" font modifier. * Font specifiers (as opposed to font modifiers) are case sensitive. * One-character font specifiers require trailing whitespace. * Ignore parenthised and two-letter font specifiers.
* trim trailing white space, no code change;Ingo Schwarze2015-02-1010-38/+38
| | | | from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
* Closing a block validates it, which may end up deleting it,Ingo Schwarze2015-02-071-0/+1
| | | | | so if we are in a loop over blocks, cleanly restart the loop rather than risking use after free; found by jsg@ with afl.
* some tweaks to the DIAGNOSTICS sectionIngo Schwarze2015-02-071-12/+9
|
* ignore O_CLOEXEC when the operating system doesn't provide it;Ingo Schwarze2015-02-071-0/+3
| | | | | needed for some older versions of SunOS; from jperkin@ via wiz@, both at NetBSD
* trivial sync to OpenBSD: <sys/param.h> no longer neededIngo Schwarze2015-02-071-4/+4
|
* be more careful about argc == 0Ingo Schwarze2015-02-072-9/+13
|
* replace the last legacy generic message type, "argument count wrong",Ingo Schwarze2015-02-065-14/+26
| | | | by more specific messages, improving diagnostics for .cc .tr .Bl -column
* better error reporting regarding .OP .RS .UR .TH argumentsIngo Schwarze2015-02-065-54/+76
|
* better diagnostics about excess arguments to .PD .ft .spIngo Schwarze2015-02-063-10/+12
|
* better error reporting for .br .fi .nf with argumentsIngo Schwarze2015-02-063-11/+13
|
* Delete the legacy generic warning type MANDOCERR_ARGCWARN,Ingo Schwarze2015-02-066-95/+39
| | | | | replacing the last instances by more specific warnings. Improved functionality, minus 50 lines of code.
* better handle .Fo and .Fd without argumentIngo Schwarze2015-02-066-14/+42
| | | | better handle .Fo with more than one argument
* better handle empty .Bd .Bl .D1 .Dl blocksIngo Schwarze2015-02-061-38/+44
|
* better handle .In .Sh .Ss .St .Xr without argumentsIngo Schwarze2015-02-062-10/+13
|
* fix handling of empty .An macrosIngo Schwarze2015-02-054-11/+7
|
* Simplify by deleting the "lastline" member of struct mdoc_node.Ingo Schwarze2015-02-056-25/+8
| | | | Minus one struct member, minus 17 lines of code, no functional change.
* Discard excess head arguments for .Bd .Bl .Bk and delete hwarn_eq0().Ingo Schwarze2015-02-043-43/+53
| | | | | Discard empty .Bk blocks. Improve related diagnostics.
* improve diagnostics regarding arguments of .An .Pp .Lp .br .spIngo Schwarze2015-02-042-11/+27
| | | | in particular, get rid of check_count(..., CHECK_EQ, 0)
* fix column numbers of macro arguments in messagesIngo Schwarze2015-02-041-2/+2
|
* discard .Rs head arguments and improve .Rs diagnosticsIngo Schwarze2015-02-045-38/+52
|
* more specific .Nd diagnostics, allowing to get rid of enum check_lvlIngo Schwarze2015-02-044-24/+34
| | | | and the respective argument of check_count()
* Enable the integrated man(1) even when database support is disabled,Ingo Schwarze2015-02-033-65/+45
| | | | | | using the file system lookup fallback code, also reducing the number of preprocessor conditional directives. Hopefully, it will make some small Linux distros happy.
* reduce indentation for better readabilityIngo Schwarze2015-02-031-12/+20
|
* Avoid closing out an explicit block twice when broken by .ItIngo Schwarze2015-02-031-0/+1
| | | | (assertion failure); regression found in jsg@'s afl test case 847.
* minimal support for Heirloom nroffIngo Schwarze2015-02-031-5/+17
|
* Finally delete the kitchensink functions rew_sub() and rew_dohalt().Ingo Schwarze2015-02-031-159/+74
| | | | | | | They were a maintenance and auditing nightmare because if you changed one bit in there, stuff tended to break at seemingly unrelated places. No functional change except getting rid of one bogus error message, but minus 80 lines of code.
* Bring .Pp/.Lp handling inside .Nm blocks closer to groff;Ingo Schwarze2015-02-032-6/+21
| | | | as a bonus, get rid of another call to rew_sub().
* Simplify and reindent make_pending(). No functional changeIngo Schwarze2015-02-021-56/+49
| | | | | | except that some error messages become less confusing. Now the function is almost readable (but still requires nineteen lines of comments for fourteen lines of code).
* Simplify: Do not call rew_dohalt() from make_pending(),Ingo Schwarze2015-02-021-30/+20
| | | | | the calling macro handler already found the breaking block. No functional change except tiny variations in error messages.
* Get rid of all remaining calls to rew_sub() where the target blockIngo Schwarze2015-02-021-65/+36
| | | | | is known. This only leaves three that do actual searching. No functional change, minus 30 lines of code.