summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
2015-02-10Be more careful to not generate empty .In, .St, and .Xr nodes.Ingo Schwarze
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.
2015-02-10Do not read past the end of the buffer if an "f" layout font modifierIngo Schwarze
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.
2015-02-10trim trailing white space, no code change;Ingo Schwarze
from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
2015-02-10Explain all WARNING, ERROR, and UNSUPP messages in the DIAGNOSTICS section.Ingo Schwarze
Feedback provided by jmc@ some time ago helped me to get this much more concise than my initial attempt. "i'm fine with it going in" jmc@
2015-02-07Closing a block validates it, which may end up deleting it,Ingo Schwarze
so if we are in a loop over blocks, cleanly restart the loop rather than risking use after free; found by jsg@ with afl.
2015-02-07be more careful about argc == 0Ingo Schwarze
2015-02-06replace the last legacy generic message type, "argument count wrong",Ingo Schwarze
by more specific messages, improving diagnostics for .cc .tr .Bl -column
2015-02-06better error reporting regarding .OP .RS .UR .TH argumentsIngo Schwarze
2015-02-06better diagnostics about excess arguments to .PD .ft .spIngo Schwarze
2015-02-06better error reporting for .br .fi .nf with argumentsIngo Schwarze
2015-02-06Delete the legacy generic warning type MANDOCERR_ARGCWARN,Ingo Schwarze
replacing the last instances by more specific warnings. Improved functionality, minus 50 lines of code.
2015-02-06better handle .Fo and .Fd without argumentIngo Schwarze
better handle .Fo with more than one argument
2015-02-06better handle empty .Bd .Bl .D1 .Dl blocksIngo Schwarze
2015-02-06better handle .In .Sh .Ss .St .Xr without argumentsIngo Schwarze
2015-02-05fix handling of empty .An macrosIngo Schwarze
2015-02-05Simplify by deleting the "lastline" member of struct mdoc_node.Ingo Schwarze
Minus one struct member, minus 17 lines of code, no functional change.
2015-02-04Discard excess head arguments for .Bd .Bl .Bk and delete hwarn_eq0().Ingo Schwarze
Discard empty .Bk blocks. Improve related diagnostics.
2015-02-04improve diagnostics regarding arguments of .An .Pp .Lp .br .spIngo Schwarze
in particular, get rid of check_count(..., CHECK_EQ, 0)
2015-02-04fix column numbers of macro arguments in messagesIngo Schwarze
2015-02-04discard .Rs head arguments and improve .Rs diagnosticsIngo Schwarze
2015-02-04more specific .Nd diagnostics, allowing to get rid of enum check_lvlIngo Schwarze
and the respective argument of check_count()
2015-02-03reduce indentation for better readabilityIngo Schwarze
2015-02-03Avoid closing out an explicit block twice when broken by .ItIngo Schwarze
(assertion failure); regression found in jsg@'s afl test case 847.
2015-02-03Finally delete the kitchensink functions rew_sub() and rew_dohalt().Ingo Schwarze
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.
2015-02-03Bring .Pp/.Lp handling inside .Nm blocks closer to groff;Ingo Schwarze
as a bonus, get rid of another call to rew_sub().
2015-02-02Simplify and reindent make_pending(). No functional changeIngo Schwarze
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).
2015-02-02Simplify: Do not call rew_dohalt() from make_pending(),Ingo Schwarze
the calling macro handler already found the breaking block. No functional change except tiny variations in error messages.
2015-02-02Get rid of all remaining calls to rew_sub() where the target blockIngo Schwarze
is known. This only leaves three that do actual searching. No functional change, minus 30 lines of code.
2015-02-02Get rid of all calls to rew_sub() in blk_exp_close(); only ten callsIngo Schwarze
remain in other functions. As a bonus, this fixes an assertion failure jsg@ found some time ago with afl (test case 982) and improves minor details in error reporting.
2015-02-02When a full block macro gets closed out by a mismatchingIngo Schwarze
block closure macro it calls, do not attempt to open its body. This can for example happen for (nonsensical) constructions like .Fo .Nm Fc in the SYNOPSIS. Fixing an assertion failure jsg@ found with afl some time ago (test case number 731).
2015-02-01get rid of rew_sub() in blk_part_imp(); no functional changeIngo Schwarze
2015-02-01fix .Eo/.Ec spacingIngo Schwarze
2015-02-01Simplify blk_part_exp(), no functional change.Ingo Schwarze
* Replace calls to rew_sub() with rew_last() - two less out of 18. * No need to keep track of the body, it's always opened right after the head and never used for anything in this function.
2015-02-01The function rew_sub() tries to rewind any all all kinds of blocksIngo Schwarze
and elements under any and all circumstances, even handling some bad block nesting now and then. Little surprisingly, this ends up in excessive complexity and has caused many bugs in the past. Start to slowly disentangle this mess by replacing calls to rew_sub() immediately following mdoc_head_alloc() by the much simpler rew_last(). Gets rid of the first two rew_sub() calls out of twenty. No functional change.
2015-01-31Use relative offsets instead of absolute pointers for the terminalIngo Schwarze
font stack. The latter fail after the stack is grown with realloc(). Fixing an assertion failure found by jsg@ with afl some time ago (test case number 51).
2015-01-30Have pity on the poor stack.Ingo Schwarze
Replace tail recursion by iteration when walking the syntax trees. No functional change.
2015-01-30starting a tbl(7) breaks man(7) next-line scope;Ingo Schwarze
triggered by a bug report from jsg@
2015-01-30Delete the redundant tbl span flags, just inspect the actual dataIngo Schwarze
where needed, which is less fragile. This fixes a subtle NULL pointer access to tp->tbl.cols: Due to a bug in the man(7) parser, the first span of a table can end up in a .TP head, in which case tblcalc() was never called. Found by jsg@ with afl.
2015-01-30Abolish struct tbl_head and replace it by an "int col" member inIngo Schwarze
struct tbl_cell. No functional change, minus 40 lines of code.
2015-01-30Auditing the tbl(7) code for more NULL pointer accesses, i came outIngo Schwarze
empty-handed; so this is just KNF and some code simplifications, no functional change.
2015-01-30Make sure every layout line contains at least one cell;Ingo Schwarze
fixing a NULL pointer access in term_tbl() that jsg@ found with afl.
2015-01-30correctly handle table layout lines starting with a dotIngo Schwarze
2015-01-29Radical cleanup of COMPATIBILITY sections:Ingo Schwarze
Remove lots of lies, dozens of irrelevant implementation details, and all references to groff versions older than 1.17. Move relevant information to the pages where it belongs, and out of mandoc(1) in particular. Add some missing general remarks to roff(7), where it fits the character and purpose of the page much better.
2015-01-28Clean up eqn(7) error handling:Ingo Schwarze
* When "define" fails, do not drop the whole equation. * Free memory after "undef". * Use standard mandoc error types instead of rolling our own. * Delete obfuscating EQN_MSG() macro. * Add function prototypes while here.
2015-01-28* Polish tbl(7) error reporting.Ingo Schwarze
* Do not print out macro names in tbl(7) data blocks. * Like with GNU tbl, let empty tables cause a blank line. * Avoid producing empty tables in -Tman.
2015-01-28For now, it can't be helped that mandoc tbl(7) ignores high-level macros,Ingo Schwarze
but stop throwing away their arguments. This fixes information loss in a handful of Xenocara manuals, at the price of a small amount of formatting noise creeping through.
2015-01-28implement the tbl(7) "center" layout optionIngo Schwarze
2015-01-28adjust formatting for the tbl(7) layout 'x' modifier (maximize column)Ingo Schwarze
to match groff for up to six maximized columns
2015-01-27Multiple parser and formatter fixes for line drawing in tbl(7).Ingo Schwarze
* Allow mixing vertical line bars with the layout options of the preceding layout cell. * Correctly combine box options with layout lines. * Correctly print vertical lines in data rows, with the right spacing. * Correctly print cross markers and left and right ends of horizontal lines even if vertical lines differ above and below. * Avoid the bogus error message "no table data cells" when a table data section starts with a horizontal line. No increase in code size.
2015-01-26Rework tbl(7) layout parsing:Ingo Schwarze
* Continue parsing even if part of the input is invalid. * Do not require whitespace between cell specifications. * Allow tabs as well as blanks between modifiers. * Mark the 'm' modifier as unsupported. * Parse and ignore the 'p' and 'v' modifiers. * Better warning and error messages. * Get rid of a static buffer. Improved functionality but minus 50 lines of code.