]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
10 years agoshow the {MDOC,MAN}_EQN node, it contains interesting information,
Ingo Schwarze [Mon, 20 Oct 2014 01:43:48 +0000 (01:43 +0000)]
show the {MDOC,MAN}_EQN node, it contains interesting information,
in particular line and column numbers and flags;
but hide the uninteresting EQN_ROOT box

10 years agoplug file descriptor leaks on read or write failure;
Ingo Schwarze [Sat, 18 Oct 2014 15:57:34 +0000 (15:57 +0000)]
plug file descriptor leaks on read or write failure;
hinted at by Steffen Nurpmeso <sdaoden at yandex dot com>.

10 years agooops, don't escape the first token of inline equations
Ingo Schwarze [Thu, 16 Oct 2014 01:28:38 +0000 (01:28 +0000)]
oops, don't escape the first token of inline equations

10 years agoImplement in-line equations, much needed by Xenocara manuals.
Ingo Schwarze [Thu, 16 Oct 2014 01:11:20 +0000 (01:11 +0000)]
Implement in-line equations, much needed by Xenocara manuals.
Put the steering into the roff parser rather than into the mdoc
parser such that it works for all macro languages and on both text
and macro lines.
Line breaks and blank characters generated before and after in-line
equations are not perfect yet, but let's do one thing at a time.

10 years agoeven if a table has zero columns, do not segfault in the formatter;
Ingo Schwarze [Tue, 14 Oct 2014 18:18:05 +0000 (18:18 +0000)]
even if a table has zero columns, do not segfault in the formatter;
bug reported by bentley@

10 years agoannotate for difficulty, and some minor cleanup
Ingo Schwarze [Tue, 14 Oct 2014 15:47:40 +0000 (15:47 +0000)]
annotate for difficulty, and some minor cleanup

10 years agobentley@ suggests Unicode table borders;
Ingo Schwarze [Tue, 14 Oct 2014 13:53:33 +0000 (13:53 +0000)]
bentley@ suggests Unicode table borders;
while here, remove the note about sox(1), it works now

10 years agoRudimentary implementation of the e, x, and z table layout modifiers
Ingo Schwarze [Tue, 14 Oct 2014 02:16:06 +0000 (02:16 +0000)]
Rudimentary implementation of the e, x, and z table layout modifiers
to equalize, maximize, and ignore the width of columns.
Does not yet take vertical rulers into account,
and does not do line breaks within table cells.
Considerably improves the lftp(1) manual; issue noticed by sthen@.

10 years agoimplement font modifiers in table layouts
Ingo Schwarze [Mon, 13 Oct 2014 23:31:46 +0000 (23:31 +0000)]
implement font modifiers in table layouts

10 years agoProperly scale string length measurements for PostScript and PDF output;
Ingo Schwarze [Mon, 13 Oct 2014 22:00:47 +0000 (22:00 +0000)]
Properly scale string length measurements for PostScript and PDF output;
this doesn't change anything for ASCII and UTF-8.
Problem reported by bentley@.

10 years agoStricter syntax checking of Unicode character names:
Ingo Schwarze [Mon, 13 Oct 2014 17:17:45 +0000 (17:17 +0000)]
Stricter syntax checking of Unicode character names:
Require exactly 4, 5 or 6 hex digits and allow nothing else.
This avoids mishandling stuff like \[ua] and \C'uA' as Unicode
and also fixes underlining in eqn(7) -Thtml output which uses \[ul].
Problem found and semantics suggested by kristaps@.

10 years agosync with OpenBSD:
Ingo Schwarze [Mon, 13 Oct 2014 14:05:32 +0000 (14:05 +0000)]
sync with OpenBSD:
check sorting of .Xr's case-insensitively;
no idea why this was different here

10 years agoDo not warn about declarations of functions returning function pointers,
Ingo Schwarze [Mon, 13 Oct 2014 14:01:21 +0000 (14:01 +0000)]
Do not warn about declarations of functions returning function pointers,
getting rid of a false positive noticed by bentley@.

10 years agoClarify: SEE ALSO sections are sorted case insensitively.
Ingo Schwarze [Mon, 13 Oct 2014 12:46:28 +0000 (12:46 +0000)]
Clarify: SEE ALSO sections are sorted case insensitively.
Patch from bentley@, ok jmc@.

10 years agoadd missing entry for .ll to the dispatch table;
Ingo Schwarze [Sun, 12 Oct 2014 20:32:39 +0000 (20:32 +0000)]
add missing entry for .ll to the dispatch table;
patch from Martin <Natano at natano dot net>, thanks

10 years agobugfix: do not parse quoted strings for tokens; fixes glFrustum(3)
Ingo Schwarze [Sun, 12 Oct 2014 20:08:58 +0000 (20:08 +0000)]
bugfix: do not parse quoted strings for tokens; fixes glFrustum(3)

10 years agoImprove error handling in the eqn(7) parser.
Ingo Schwarze [Sun, 12 Oct 2014 19:31:41 +0000 (19:31 +0000)]
Improve error handling in the eqn(7) parser.
Get rid of the first fatal error, MANDOCERR_EQNSYNT.
In eqn(7), there is no need to be bug-compatible with groff, so there
is no need to abondon the whole equation in case of a syntax error.

In particular:
* Skip "back", "delim", "down", "fwd", "gfont", "gsize", "left",
  "right", "size", and "up" without arguments.
* Skip "gsize" and "size" with a non-numeric argument.
* Skip closing delimiters that are not open.
* Skip "above" outside piles.
* For diacritic marks and binary operators without a left operand,
  default to an empty box.
* Let piles and matrices take one argument rather than insisting
  on a braced list.  Let HTML output handle that, too.
* When rewinding, if the root box is guaranteed to match
  the termination condition, no error handling is needed.

10 years agomajor upgrade to eqn(7) terminal output;
Ingo Schwarze [Sun, 12 Oct 2014 14:49:39 +0000 (14:49 +0000)]
major upgrade to eqn(7) terminal output;
column vectors ("piles") and matrices are not yet pretty,
but everything else is now more or less readable

10 years agodocument the semantics of operation keywords
Ingo Schwarze [Sun, 12 Oct 2014 11:57:38 +0000 (11:57 +0000)]
document the semantics of operation keywords
and some other minor improvements

10 years agooops, don't crash when .Fo has no argument
Ingo Schwarze [Sat, 11 Oct 2014 21:34:04 +0000 (21:34 +0000)]
oops, don't crash when .Fo has no argument

10 years agowarn about parentheses in function names after .Fn and .Fo;
Ingo Schwarze [Sat, 11 Oct 2014 21:14:16 +0000 (21:14 +0000)]
warn about parentheses in function names after .Fn and .Fo;
particularly useful when converting from other languages to mdoc(7);
feature suggested by bentley@

10 years agosync Copyright years after merge to OpenBSD; no code change
Ingo Schwarze [Fri, 10 Oct 2014 15:26:29 +0000 (15:26 +0000)]
sync Copyright years after merge to OpenBSD; no code change

10 years agoDrop trailing whitespace, adjust a few indentations,
Ingo Schwarze [Fri, 10 Oct 2014 14:27:46 +0000 (14:27 +0000)]
Drop trailing whitespace, adjust a few indentations,
and update Copyright year while here; no code change.

10 years agoNo need to assert() that a pointer is non-null right before dereferencing it.
Ingo Schwarze [Fri, 10 Oct 2014 14:02:02 +0000 (14:02 +0000)]
No need to assert() that a pointer is non-null right before dereferencing it.
The assert message contains no more information than the segfault.

10 years agoMake eqn(7) -Ttree output more useful:
Ingo Schwarze [Fri, 10 Oct 2014 12:19:25 +0000 (12:19 +0000)]
Make eqn(7) -Ttree output more useful:
* Reduce noise by not printing default attributes.
* Print missing "top" and "bottom" attributes.
* Print mnemonics, not code numbers for expression positions.
* Do not print unused "pile" attribute.

10 years agotasks found while reading the eqn(7) User's Guide
Ingo Schwarze [Fri, 10 Oct 2014 10:49:38 +0000 (10:49 +0000)]
tasks found while reading the eqn(7) User's Guide

10 years agoIgnore "delim" command.
Kristaps Dzonsons [Fri, 10 Oct 2014 09:12:44 +0000 (09:12 +0000)]
Ignore "delim" command.
This fixes run-time assertions regarding "tok".

10 years agoRe-write of eqn(7) parser and MathML output.
Kristaps Dzonsons [Fri, 10 Oct 2014 08:44:24 +0000 (08:44 +0000)]
Re-write of eqn(7) parser and MathML output.
This adds parser-level support for the grammar described by the eqn
second-edition technical paper, "Typesetting Mathematics — User's Guide"
(Kernighan, Cherry).
The reason for this re-write is the grouping rules, which were not
possible given the existing implementation.
The re-write has also considerably simplified the HTML (and, if it ever
is completed, terminal) front-end.

10 years agobe a bit more patient, 1s is sometimes insufficient for legitimate queries
Ingo Schwarze [Tue, 7 Oct 2014 18:20:06 +0000 (18:20 +0000)]
be a bit more patient, 1s is sometimes insufficient for legitimate queries

10 years agoIf a tbl(7) layout contains unknown font modifiers, fall back to the
Ingo Schwarze [Tue, 7 Oct 2014 14:07:03 +0000 (14:07 +0000)]
If a tbl(7) layout contains unknown font modifiers, fall back to the
default font rather than failing the whole table.
Needed by some pages in books/man-pages-posix.
Written on the plane back from EuroBSDCon in Sofia.

10 years agonote HTML max-width issue
Ingo Schwarze [Mon, 6 Oct 2014 18:35:49 +0000 (18:35 +0000)]
note HTML max-width issue

10 years agoChange "to" and "from" commands to use munder, mover, and munderover.
Kristaps Dzonsons [Sun, 28 Sep 2014 20:14:20 +0000 (20:14 +0000)]
Change "to" and "from" commands to use munder, mover, and munderover.

10 years agoCrudely accomodate for matrices by way of adjacent tables. We don't do this
Kristaps Dzonsons [Sun, 28 Sep 2014 14:06:09 +0000 (14:06 +0000)]
Crudely accomodate for matrices by way of adjacent tables.  We don't do this
nicely right now because eqn uses column ordering.
Also add from/to support and to support.

10 years agoParse from/to clauses in eqn.
Kristaps Dzonsons [Sun, 28 Sep 2014 14:05:11 +0000 (14:05 +0000)]
Parse from/to clauses in eqn.

10 years agoSupport a decent subset of eqn(7) in MathML.
Kristaps Dzonsons [Sun, 28 Sep 2014 13:34:15 +0000 (13:34 +0000)]
Support a decent subset of eqn(7) in MathML.
This has basic support for positions (under, sup, sub, sub/sup) and piles.
It *does not* support right-left grouping (among many other things), e.g.,

  a sub b over c sub d

Which it will interpret, for the time being, as

  a sub { b over { c sub d } }

instead of

  { a sub b } over { c sub d }

However, left-right grouping works fine.

10 years agoAdd support for some MathML elements and attributes in our HTML5.
Kristaps Dzonsons [Sun, 28 Sep 2014 11:33:15 +0000 (11:33 +0000)]
Add support for some MathML elements and attributes in our HTML5.

10 years agoMake eqn tree output a bit more useful.
Kristaps Dzonsons [Sun, 28 Sep 2014 11:32:33 +0000 (11:32 +0000)]
Make eqn tree output a bit more useful.

10 years agoAdd support for EQNPOS_SUBSUP and a doubly-linked eqn_box list.
Kristaps Dzonsons [Sun, 28 Sep 2014 11:32:08 +0000 (11:32 +0000)]
Add support for EQNPOS_SUBSUP and a doubly-linked eqn_box list.

10 years agoHave Makefile build mandoc(1) before it tries to generate the HTML.
Kristaps Dzonsons [Sat, 27 Sep 2014 11:20:39 +0000 (11:20 +0000)]
Have Makefile build mandoc(1) before it tries to generate the HTML.

10 years agoModify man.cgi to use HTML5.
Kristaps Dzonsons [Sat, 27 Sep 2014 11:17:36 +0000 (11:17 +0000)]
Modify man.cgi to use HTML5.

10 years agoDon't pretend we have a separate XHTML and HTML mode any more.
Kristaps Dzonsons [Sat, 27 Sep 2014 11:17:19 +0000 (11:17 +0000)]
Don't pretend we have a separate XHTML and HTML mode any more.

10 years agoSpecify the spacer in the overridable CSS.
Kristaps Dzonsons [Sat, 27 Sep 2014 11:16:24 +0000 (11:16 +0000)]
Specify the spacer in the overridable CSS.

10 years agoRemove <p> in favour of <div class="spacer">.
Kristaps Dzonsons [Sat, 27 Sep 2014 10:56:18 +0000 (10:56 +0000)]
Remove <p> in favour of <div class="spacer">.
This is good because <p> is brittle: it can't appear within other block
macros.
This fixes a regression of the original HTML5 patch as noted by schwarze@
on the tech@ list, 14/8/2014.

10 years agoRemove last hard-coded width attribute.
Kristaps Dzonsons [Sat, 27 Sep 2014 09:26:01 +0000 (09:26 +0000)]
Remove last hard-coded width attribute.

10 years agoHTML5-isation: remove more alignments.
Kristaps Dzonsons [Sat, 27 Sep 2014 09:20:03 +0000 (09:20 +0000)]
HTML5-isation: remove more alignments.

10 years agoContinue in HTML5-ing by kicking out some hard-coded alignments.
Kristaps Dzonsons [Sat, 27 Sep 2014 09:13:39 +0000 (09:13 +0000)]
Continue in HTML5-ing by kicking out some hard-coded alignments.

10 years agoKick out "summary" attribute, which isn't HTML5.
Kristaps Dzonsons [Sat, 27 Sep 2014 09:05:57 +0000 (09:05 +0000)]
Kick out "summary" attribute, which isn't HTML5.

10 years agoKick out two attibutes we don't use any more in HTML5.
Kristaps Dzonsons [Sat, 27 Sep 2014 09:03:24 +0000 (09:03 +0000)]
Kick out two attibutes we don't use any more in HTML5.

10 years agoFirst, add space for default styling for HTML5 (non-fragment) output.
Kristaps Dzonsons [Sat, 27 Sep 2014 09:02:19 +0000 (09:02 +0000)]
First, add space for default styling for HTML5 (non-fragment) output.
This uses a <style /> block right before the <link /> for the stylesheet.
Use this to kick out hardcoded header and footer table widths.

10 years agoFirst steps in HTML5: use UTF8 meta-charset and HTML5 doctype identifier.
Kristaps Dzonsons [Sat, 27 Sep 2014 08:54:34 +0000 (08:54 +0000)]
First steps in HTML5: use UTF8 meta-charset and HTML5 doctype identifier.

10 years agosimplify handling of .An -[no]split for terminal output:
Ingo Schwarze [Wed, 17 Sep 2014 20:18:58 +0000 (20:18 +0000)]
simplify handling of .An -[no]split for terminal output:
delete one static function, one flag #define, and 25 lines of code;
no functional change

10 years agoimplement .An -[no]split for -Thtml
Ingo Schwarze [Wed, 17 Sep 2014 19:55:59 +0000 (19:55 +0000)]
implement .An -[no]split for -Thtml

10 years agoFive year old typo reported by Theo Buehler at math dot ethz dot ch, thanks.
Ingo Schwarze [Wed, 17 Sep 2014 00:43:15 +0000 (00:43 +0000)]
Five year old typo reported by Theo Buehler at math dot ethz dot ch, thanks.
I nearly asked: ``What's wrong with it? It formats as "intended".''
(However, what Kristaps intended to write was "indented".)

10 years agoSupport backslash-escaping of white space in the query expression,
Ingo Schwarze [Sun, 14 Sep 2014 19:44:28 +0000 (19:44 +0000)]
Support backslash-escaping of white space in the query expression,
to be more similar to apropos(1) called from the shell.
Missing feature reported by Marcus MERIGHI <mcmer dash openbsd at
tor dot at> on misc@.

10 years agowarn about commas in function arguments; inspired by mdoclint(1)
Ingo Schwarze [Fri, 12 Sep 2014 00:54:10 +0000 (00:54 +0000)]
warn about commas in function arguments; inspired by mdoclint(1)

10 years agodocument new SEE ALSO .Xr warnings
Ingo Schwarze [Fri, 12 Sep 2014 00:10:26 +0000 (00:10 +0000)]
document new SEE ALSO .Xr warnings

10 years agowarn about botched .Xr ordering and punctuation below SEE ALSO;
Ingo Schwarze [Thu, 11 Sep 2014 23:53:30 +0000 (23:53 +0000)]
warn about botched .Xr ordering and punctuation below SEE ALSO;
inspired by mdoclint(1)

10 years agoIf a manpath directory (for example, a _whatdb entry from man.conf(5)
Ingo Schwarze [Tue, 9 Sep 2014 19:35:25 +0000 (19:35 +0000)]
If a manpath directory (for example, a _whatdb entry from man.conf(5)
or an entry in the MANPATH environment variable) does not exist,
silently skip it.  This brings makewhatis(8) back closer to the
behaviour of espie@'s version and ought to shut up the weekly(8)
whining observed by henning@ on machines not having xbase installed.
Also, don't error out after the first unusable manpath entry, still
try the others.

Of course, still complain about non-existent directories specified
on the command line and about any directories failing for other
reasons than ENOENT.

10 years agowarn about AUTHORS sections without .An macros, inspired by mdoclint(1)
Ingo Schwarze [Sun, 7 Sep 2014 23:25:01 +0000 (23:25 +0000)]
warn about AUTHORS sections without .An macros, inspired by mdoclint(1)

10 years agoDo not report a page as arch=any merely because .Dt lacks the third argument.
Ingo Schwarze [Sun, 7 Sep 2014 03:08:47 +0000 (03:08 +0000)]
Do not report a page as arch=any merely because .Dt lacks the third argument.
Pages found outside arch-specific dirs still get arch=any, of course.
Issue reported by justinhenryhaynes at gmail dot com on misc@, thanks!

10 years agofix debugging output
Ingo Schwarze [Sun, 7 Sep 2014 03:00:21 +0000 (03:00 +0000)]
fix debugging output

10 years agoalways use the right buffer, and fix one evil typo
Ingo Schwarze [Sun, 7 Sep 2014 02:17:40 +0000 (02:17 +0000)]
always use the right buffer, and fix one evil typo

10 years agoParse and ignore the .pl (page length) request;
Ingo Schwarze [Sun, 7 Sep 2014 00:21:53 +0000 (00:21 +0000)]
Parse and ignore the .pl (page length) request;
Daniel Levai reports that Slackware Linux uses this.

10 years agoAllow .ll in the prologue; Daniel Levai reports Slackware Linux uses this.
Ingo Schwarze [Sun, 7 Sep 2014 00:05:28 +0000 (00:05 +0000)]
Allow .ll in the prologue; Daniel Levai reports Slackware Linux uses this.

10 years agoSimplify by handling empty request lines at the one logical place
Ingo Schwarze [Sat, 6 Sep 2014 23:24:32 +0000 (23:24 +0000)]
Simplify by handling empty request lines at the one logical place
in the roff parser instead of in three other places in other parsers.
No functional change.

10 years agoMove main format autodetection from the parser dispatcher to the
Ingo Schwarze [Sat, 6 Sep 2014 22:39:36 +0000 (22:39 +0000)]
Move main format autodetection from the parser dispatcher to the
roff parser where .Dd and .TH are already detected, anyway.  This
improves robustness because it correctly handles whitespace or an
alternate control character before Dd.  In the parser dispatcher,
provide a fallback looking ahead in the input buffer instead of
always assuming man(7).  This corrects autodetection when Dd is
preceded by other macros or macro-like handled requests like .ll.

Triggered by reports from Daniel Levai about issues on Slackware Linux.

10 years agoAdd *.gz support to apropos(1) -a, man(1), and even mandoc(1).
Ingo Schwarze [Wed, 3 Sep 2014 23:21:47 +0000 (23:21 +0000)]
Add *.gz support to apropos(1) -a, man(1), and even mandoc(1).
Implemented by moving the zip code from makewhatis(8) to the parser lib.

10 years agoIf a manual page is installed gzip(1)ed, let makewhatis(8) take
Ingo Schwarze [Wed, 3 Sep 2014 18:09:14 +0000 (18:09 +0000)]
If a manual page is installed gzip(1)ed, let makewhatis(8) take
note in mandoc.db(5), such that man(1) -w and apropos(1) -w can
report the correct filename.
This is a prerequisite for letting apropos -a and man support
gzip'ed manuals in the future, which doesn't work yet.

10 years agoImplement the traditional -h option for man(1): show the SYNOPSIS only.
Ingo Schwarze [Wed, 3 Sep 2014 05:22:45 +0000 (05:22 +0000)]
Implement the traditional -h option for man(1): show the SYNOPSIS only.
As usual, we get mandoc -h and apropos -h for free.
Try stuff like "apropos -h In=dirent" or "apropos -h Fa=timespec".

Only useful for terminal output, so -Tps, -Tpdf, -Thtml ignore -h for now.

10 years agoWhen makewhatis(8) finds an .so link after the manual being pointed to
Ingo Schwarze [Mon, 1 Sep 2014 23:47:59 +0000 (23:47 +0000)]
When makewhatis(8) finds an .so link after the manual being pointed to
has already been processed, add the file names to the names table, too,
not just to the mlinks table.
This fixes a bug where apropos(1) and the new man(1) wouldn't find some
of the Xenocara manuals via some of their .so links.  After rebuilding,
run "makewhatis /usr/X11R6/man" or just wait for weekly(8).

10 years agoIn man(1) mode, change to the right directory before starting the parser,
Ingo Schwarze [Mon, 1 Sep 2014 22:45:53 +0000 (22:45 +0000)]
In man(1) mode, change to the right directory before starting the parser,
just like traditional man(1) does, such that .so links have a chance to
work.  After this point, we don't need the current directory for anything
else before exit, so we don't need to worry about getting back and we can
safely ignore failure.

10 years agoIntroduce a man(1) -l option as an alias for mandoc -a.
Ingo Schwarze [Sat, 30 Aug 2014 18:08:10 +0000 (18:08 +0000)]
Introduce a man(1) -l option as an alias for mandoc -a.
Basically, this does the same as man -l in Linux man-db.
The point is that now all functionality of the combined tool
is reachable from the man(1) command name:
apropos = man -k, whatis = man -f, mandoc = man -cl.

Originally suggested by Carsten dot Kunze at arcor dot de,
current maintainer of the Heirloom Documentation Tools.

While here, add various missing information to the usage()
and to the manuals.

10 years agoOn Linux, wcwidth() needs _XOPEN_SOURCE, or just _GNU_SOURCE for simplicity.
Ingo Schwarze [Thu, 28 Aug 2014 10:38:06 +0000 (10:38 +0000)]
On Linux, wcwidth() needs _XOPEN_SOURCE, or just _GNU_SOURCE for simplicity.
Besides, signedness of wchar_t and wint_t may differ, it i only
guaranteed that each wchar_t can be represented as a wint_t.
A problem report by Daniel Levai reminded me to fix this.

10 years agoSupport .St -susv1 and .St -susv4. Illumos wants to use this,
Ingo Schwarze [Thu, 28 Aug 2014 03:51:56 +0000 (03:51 +0000)]
Support .St -susv1 and .St -susv4.  Illumos wants to use this,
and it's illogical anyway to have -susv2 and -susv3 but not -susv4.

10 years agoI just noticed that -Tps writes "%%CreationDate:" headers.
Ingo Schwarze [Thu, 28 Aug 2014 01:37:12 +0000 (01:37 +0000)]
I just noticed that -Tps writes "%%CreationDate:" headers.
That's an unwelcome leak of potentially private information.
Kill it with fire.

10 years agoSync section titles with OpenBSD.
Ingo Schwarze [Tue, 26 Aug 2014 11:21:40 +0000 (11:21 +0000)]
Sync section titles with OpenBSD.

For section 4, "Kernel Interfaces" is just too confusing,
the difference from sections 2 and 9 is too hard to see.

The 3p change was suggested by bluhm@; that part
of the manual describes more modules than functions.

Align the CGI section titles with the console section titles.

10 years agoWhen support for bold italic font was added to the parsers and to the
Ingo Schwarze [Sun, 24 Aug 2014 23:43:13 +0000 (23:43 +0000)]
When support for bold italic font was added to the parsers and to the
generic parts of the formatters some time ago, the PostScript- and
PDF-specific part of the formatters was neglected.

Now pascal@ reports that mandoc -Tps throws an assertion on perl(1),
apparently because that manual actually uses bold italic font.

So here is an overdue implementation of bold italic font support for
PostScript and PDF output.

10 years agowithout search results, skip the processing loops and the parser
Ingo Schwarze [Sat, 23 Aug 2014 22:26:06 +0000 (22:26 +0000)]
without search results, skip the processing loops and the parser

10 years agodo not leak a file descriptor on fdopen(3) failure; from doug@
Ingo Schwarze [Sat, 23 Aug 2014 18:13:47 +0000 (18:13 +0000)]
do not leak a file descriptor on fdopen(3) failure; from doug@

10 years agoLet man(1) display preformatted manuals by simply reading them
Ingo Schwarze [Sat, 23 Aug 2014 00:34:59 +0000 (00:34 +0000)]
Let man(1) display preformatted manuals by simply reading them
from the file and copying them to the standard output.
This works even for mixed formats: "man -a groff mandoc" displays
groff(1) [formatted], mandoc(1) [unformatted], groff(7) [formatted],
and mandoc(7) [unformatted] in that order.

10 years agoimplement man(1) quirk: section argument without -s
Ingo Schwarze [Fri, 22 Aug 2014 18:07:15 +0000 (18:07 +0000)]
implement man(1) quirk: section argument without -s

10 years agotypo; noticed by jmc@ some time ago
Ingo Schwarze [Fri, 22 Aug 2014 15:49:50 +0000 (15:49 +0000)]
typo; noticed by jmc@ some time ago

10 years agoimplement MANPAGER and PAGER
Ingo Schwarze [Fri, 22 Aug 2014 04:52:55 +0000 (04:52 +0000)]
implement MANPAGER and PAGER

10 years agomandoc -a, man, apropos -a, whatis -a now paginate by default
Ingo Schwarze [Fri, 22 Aug 2014 03:42:18 +0000 (03:42 +0000)]
mandoc -a, man, apropos -a, whatis -a now paginate by default
but provide an option -c to not paginate;
taking inspiration from manpage.c, hence adding (c) 2012 kristaps@

10 years agoBugfix: make whatis(1) case-insensitive again.
Ingo Schwarze [Thu, 21 Aug 2014 20:29:07 +0000 (20:29 +0000)]
Bugfix: make whatis(1) case-insensitive again.
The traditional whatis(1) was case-insensitve and it's still documented
that way, but that apparently got broken with or after the switch.

10 years agolimit CGI process execution time to make REDoS attacks less effective;
Ingo Schwarze [Thu, 21 Aug 2014 16:05:21 +0000 (16:05 +0000)]
limit CGI process execution time to make REDoS attacks less effective;
attack surface pointed out by Sebastien Marie

10 years agoRight after .Fl, a middle delimiter triggers an empty scope,
Ingo Schwarze [Thu, 21 Aug 2014 12:57:17 +0000 (12:57 +0000)]
Right after .Fl, a middle delimiter triggers an empty scope,
just like a closing delimiter.  This didn't work in groff-1.15,
but it now works in groff-1.22.

After being closed by delimiters, .Nm scopes do not reopen.

Do not suppress white space after .Fl if the next node is a text node
on the same input line; that can happen for middle delimiters.

Fixing an issue reported by jmc@.

10 years agoman -I -O -T -W now work, too
Ingo Schwarze [Thu, 21 Aug 2014 02:38:24 +0000 (02:38 +0000)]
man -I -O -T -W now work, too

10 years agoDescribe the new options -afkw.
Ingo Schwarze [Thu, 21 Aug 2014 02:28:40 +0000 (02:28 +0000)]
Describe the new options -afkw.
Clean up the description of whatis(1).

10 years agoComplete the whatis.1 -> apropos.1 merge,
Ingo Schwarze [Thu, 21 Aug 2014 01:52:59 +0000 (01:52 +0000)]
Complete the whatis.1 -> apropos.1 merge,
in particular regarding HISTORY and AUTHORS.

10 years ago* remove pointless separate -f and -k synopses, they take almost all args
Ingo Schwarze [Thu, 21 Aug 2014 01:35:43 +0000 (01:35 +0000)]
* remove pointless separate -f and -k synopses, they take almost all args
* fix up descriptions of -f and -k
* remove excessive example for -k
* remove explicit BSD references
* add CVS Id

10 years agoNow that we have man(1) functionality, add a man(1) manual page.
Ingo Schwarze [Thu, 21 Aug 2014 00:42:38 +0000 (00:42 +0000)]
Now that we have man(1) functionality, add a man(1) manual page.
I'm importing the totally unchanged OpenBSD version
such that all changes can easily be tracked in CVS.

10 years agoImplement classic man(1) output mode showing only one manual even
Ingo Schwarze [Thu, 21 Aug 2014 00:32:15 +0000 (00:32 +0000)]
Implement classic man(1) output mode showing only one manual even
if there is more than one match, using traditional section priorities,
and implement man(1) -a (show all) output mode, not just for man(1),
but also for apropos(1) and whatis(1).

10 years agoParse the new -a, -i, and -w options.
Ingo Schwarze [Wed, 20 Aug 2014 21:04:35 +0000 (21:04 +0000)]
Parse the new -a, -i, and -w options.
Implement -w (list manual page filenames).

10 years agoDo not dereference a NULL pointer if a .Bl macro has
Ingo Schwarze [Tue, 19 Aug 2014 17:31:55 +0000 (17:31 +0000)]
Do not dereference a NULL pointer if a .Bl macro has
no -type, -width, -offset or -compact arguments whatsoever;
this got broken in rev. 1.238.

10 years agolibroff depends on libmandoc and so libmandoc should be included first;
Ingo Schwarze [Tue, 19 Aug 2014 16:52:32 +0000 (16:52 +0000)]
libroff depends on libmandoc and so libmandoc should be included first;
merge from OpenBSD, patch by daniel@

10 years agoControl reading off the edge of our buffer in term_flushln().
Kristaps Dzonsons [Mon, 18 Aug 2014 21:07:53 +0000 (21:07 +0000)]
Control reading off the edge of our buffer in term_flushln().
This happens in specific conditions (trailing whitespace in certain
terminal modes), but in practise, it happens quite often (as reported by
valgrind).
In short, "Nothing about term_flushln() is simple.  Srsly!" (schwarze@)
Discussed on tech@, ok schwarze@.

10 years agoWhen the first child of the node being validated gets deleted during
Ingo Schwarze [Mon, 18 Aug 2014 16:36:54 +0000 (16:36 +0000)]
When the first child of the node being validated gets deleted during
validation, man_node_unlink() switches to MAN_NEXT_CHILD.  After
that, we have to switch back to MAN_NEXT_SIBLING after completing
validation, or subsequent parsing would add content into an already
closed node, clobbering potentially existing children, causing
information loss and a memory leak.  Bug found by kristaps@ with
valgrind in groff(7) on Mac OS X.

Note that the switch back must be conditional, for if the node being
validated itself gets deleted, we must *not* go to MAN_NEXT_SIBLING,
which would not only yield wrong results in general but also crash
in malformed manuals having an empty paragraph before the first .SH,
for example OpenBSD c++filt(1).

10 years agoNotes on CGI: installation (readying cgi.h) and future plans.
Kristaps Dzonsons [Mon, 18 Aug 2014 13:27:47 +0000 (13:27 +0000)]
Notes on CGI: installation (readying cgi.h) and future plans.

10 years agoFix a corner case where \H<nil> (where <nil> is the \0 character) would
Kristaps Dzonsons [Mon, 18 Aug 2014 09:11:47 +0000 (09:11 +0000)]
Fix a corner case where \H<nil> (where <nil> is the \0 character) would
cause mandoc_escape() to read past the end of an allocated string.
Found when a script scanning of all Mac OSX manual accidentally also
scanned binary (gzip'd) files, discussed with schwarze@ on tech@.