summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Some fine tuning of console rendering of named special characters.Ingo Schwarze2014-10-291-19/+19
| | | | | | 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-47/+74
| | | | | | | | | | | 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-11/+5
| | | | | | representation, not for character escapes with unknown names. According to groff, the latter produce no output, and we now warn about them.
* Make the character table available to libroff so it can check theIngo Schwarze2014-10-2819-87/+93
| | | | | | | | validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
* stricter parsing of Unicode escape namesIngo Schwarze2014-10-281-13/+17
|
* Tighten Unicode escape name parsing.Ingo Schwarze2014-10-282-12/+12
| | | | | Accept only 0xXXXX, 0xYXXXX, 0x10XXXX with Y != 0. This simplifies mchars_num2uc().
* Refine -Tascii rendering of Unicode characters, mostly to better agreeIngo Schwarze2014-10-282-128/+128
| | | | | | | | | with groff, in particular in cases where groff uses backspace overstrike. In two cases, agreement is impossible because groff clobbers the previous line: \(*G \(*S In a number of cases, groff rendering is so misleading that i chose to render differently: \(Sd \(TP \(Tp \(Po \(ps \(sc \(r! \(r? \(de While here, also correct the \(la and \(ra Unicode code points.
* Support overstriking by backspace in PostScript and PDF output.Ingo Schwarze2014-10-271-15/+61
| | | | | | | | | Of course, this is only a minor improvement; it would be much better to support non-ASCII characters in these output modes, but that would require major changes that i'm not going to work on right now. The main reason for doing this is that it allows to get ASCII output closer to groff.
* Handle output encoding for unicode, numbered and named escape sequencesIngo Schwarze2014-10-271-22/+10
| | | | | | | | in one common, safe way instead of three different ways. In particular, * skip NUL, it is used to mean "no output desired" * deny 0x01-0x1F and 0x7F-0x9F, print REPLACEMENT CHARACTER instead * print 0x20-0x7E literally or name-encoded, as required * print characters above 0x9F numerically
* Fix a regression in term.c rev. 1.229 reported by bentley@:Ingo Schwarze2014-10-274-12/+11
| | | | | | | | | | In UTF-8 output, do not print anything if mchars_spec2cp() returns 0. In particular, this repairs handling of zero-width spaces (\&). While here, let mchars_spec2cp() return 0xFFFD instead of -1 if the character is not found, simplifying the using code. In HTML output, do not print obfuscated ASCII characters and do not test for one-char escapes, mchars_spec2cp() already does that.
* KNF: indentation and sort variables by size; no functional changeIngo Schwarze2014-10-261-4/+3
|
* Grrr, patch(1) merged the new function to the wrong place in this file.Ingo Schwarze2014-10-261-77/+77
| | | | Resync with OpenBSD. No code change.
* In -Tascii mode, provide approximations even for some Unicode escapeIngo Schwarze2014-10-264-2/+27
| | | | | | | | sequences above codepoint 512 by doing a reverse lookup in the existing mandoc_char(7) character table. Again, groff isn't smart enough to do this and silently discards such escape sequences without printing anything.
* Improve -Tascii output for Unicode escape sequences: For the first 512Ingo Schwarze2014-10-265-70/+134
| | | | | | | | | | | | code points, provide ASCII approximations. This is already much better than what groff does, which prints nothing for most code points. A few minor fixes while here: * Handle Unicode escape sequences in the ASCII range. * In case of errors, use the REPLACEMENT CHARACTER U+FFFD for -Tutf8 and the string "<?>" for -Tascii output. * Handle all one-character escape sequences in mchars_spec2{cp,str}() and remove the workarounds on the higher level.
* With the current architecture, we can't support inline equationsIngo Schwarze2014-10-251-1/+2
| | | | | | | inside tables, sorry. So don't even try to parse tbl(7) blocks for eqn(7) delimiters. Broken table layout found in glPixelMap(3) while investigating a bug report by Theo Buehler <theo at math dot ethz dot ch>.
* Fix a NULL pointer dereference reportedIngo Schwarze2014-10-251-1/+3
| | | | | by Theo Buehler <theo at math dot ethz dot ch> on tech at openbsd: Do not attempt to parse empty equations.
* Report arguments to .EQ as an error, and simplify the code:Ingo Schwarze2014-10-254-37/+13
| | | | | | | * drop trivial wrapper function roff_openeqn() * drop unused first arg of function eqn_alloc() * drop usused member "name" of struct eqn_node While here, sync to OpenBSD by killing some trailing blanks.
* integrate preconv(1) into mandoc(1);Ingo Schwarze2014-10-2510-557/+180
| | | | enhances functionality and reduces code and docs by more than 300 lines
* some new tasksIngo Schwarze2014-10-251-1/+12
|
* Protect the roff parser from dividing by zero. ok schwarze@Kristaps Dzonsons2014-10-203-13/+26
|
* improve documentation of .Fa, .Va, and .Vt;Ingo Schwarze2014-10-201-8/+20
| | | | inspired by a discussion with matthew@
* correct the spacing after in-line equationsIngo Schwarze2014-10-204-4/+6
| | | | | that start at the beginning of an input line but end before the end of an input line
* correctly parse spacing around in-line equationsIngo Schwarze2014-10-201-5/+36
| | | | | at the beginning and at the end of input lines; issue reported by kristaps@