]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
10 years agoExplicit block closure macros clobber next-line block head scope,
Ingo Schwarze [Tue, 16 Dec 2014 17:26:00 +0000 (17:26 +0000)]
Explicit block closure macros clobber next-line block head scope,
just like explicit block macros themselves.
Fixing an assertion failure jsg@ found with afl.

10 years agoWhen a string comparison condition contains no mismatching character
Ingo Schwarze [Tue, 16 Dec 2014 03:53:43 +0000 (03:53 +0000)]
When a string comparison condition contains no mismatching character
but ends without the final delimiter, the parse point was advanced
one character too far and the invalid pointer returned to the
caller of roff_parseln().  Later use could potentially advance
the pointer even further and maybe even write to it.
Fixing a buffer overrun found by jsg@ with afl (the most severe so far).

10 years agoWhen a numerical condition errors out after consuming at least one
Ingo Schwarze [Tue, 16 Dec 2014 01:22:59 +0000 (01:22 +0000)]
When a numerical condition errors out after consuming at least one
character of input, treat it as false, do not retry it as a string
comparison condition.  This also fixes a read buffer overrun that
happened when the numerical condition advanced to the end of the
input line before erroring out, found by jsg@ with afl.

10 years agoEmpty conditions count as false.
Ingo Schwarze [Mon, 15 Dec 2014 23:43:26 +0000 (23:43 +0000)]
Empty conditions count as false.
When negated, they still count as false.
Found when investigating crashes jsg@ found with afl.
Not completely fixing the crashes yet.

10 years agocorrect some character names to match groff;
Ingo Schwarze [Mon, 15 Dec 2014 19:42:21 +0000 (19:42 +0000)]
correct some character names to match groff;
reported by Carsten dot Kunze at arcor dot de

10 years agoLet "man n open" do the same as "man -s n open" again, that is,
Ingo Schwarze [Mon, 15 Dec 2014 18:05:57 +0000 (18:05 +0000)]
Let "man n open" do the same as "man -s n open" again, that is,
show the open(n) Tcl manual, as documented in man(1).  Issue reported
by Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).

10 years agoCatch localtime() failure for additional safety;
Ingo Schwarze [Mon, 15 Dec 2014 17:30:30 +0000 (17:30 +0000)]
Catch localtime() failure for additional safety;
patch from Jan Stary <hans at stare dot cz> some time ago.

10 years agoversion 1.13.2 VERSION_1_13_2
Ingo Schwarze [Sat, 13 Dec 2014 13:43:47 +0000 (13:43 +0000)]
version 1.13.2

10 years agoFix a regression found by Carsten dot Kunze at arcor dot de:
Ingo Schwarze [Sat, 13 Dec 2014 13:14:39 +0000 (13:14 +0000)]
Fix a regression found by Carsten dot Kunze at arcor dot de:
Do not show bogus quotes when .Bl -column phrases are quoted.

10 years agoescape Nd on a macro line
Ingo Schwarze [Fri, 12 Dec 2014 21:44:33 +0000 (21:44 +0000)]
escape Nd on a macro line

10 years agoGuard some come needed for database support only by #if HAVE_SQLITE3.
Ingo Schwarze [Thu, 11 Dec 2014 19:19:35 +0000 (19:19 +0000)]
Guard some come needed for database support only by #if HAVE_SQLITE3.
Compiler warnings about unused code reported by wiz@NetBSD.

10 years agoMake this work on illumos:
Ingo Schwarze [Thu, 11 Dec 2014 18:20:07 +0000 (18:20 +0000)]
Make this work on illumos:
* define MAX()
* ignore O_DIRECTORY if it isn't defined
* garbage collect two unused variables
Issues reported and fix tested by wiz@NetBSD.

10 years agofix RCS IDs
Ingo Schwarze [Thu, 11 Dec 2014 09:19:32 +0000 (09:19 +0000)]
fix RCS IDs

10 years agosync to OpenBSD
Ingo Schwarze [Thu, 11 Dec 2014 09:05:01 +0000 (09:05 +0000)]
sync to OpenBSD

10 years agonew Copyright years
Ingo Schwarze [Thu, 11 Dec 2014 07:56:24 +0000 (07:56 +0000)]
new Copyright years

10 years agolink to EuroBSDCon 2014
Ingo Schwarze [Thu, 11 Dec 2014 07:44:46 +0000 (07:44 +0000)]
link to EuroBSDCon 2014

10 years agocorrectly align document header and footer;
Ingo Schwarze [Wed, 10 Dec 2014 22:19:45 +0000 (22:19 +0000)]
correctly align document header and footer;
suggested by kristaps@

10 years agothe asciidoc/docbook toolchain uses braindead \h for indentation
Ingo Schwarze [Wed, 10 Dec 2014 21:54:13 +0000 (21:54 +0000)]
the asciidoc/docbook toolchain uses braindead \h for indentation

10 years agomore release preparations
Ingo Schwarze [Tue, 9 Dec 2014 12:05:44 +0000 (12:05 +0000)]
more release preparations

10 years agofirst cut at updating for the next release
Ingo Schwarze [Tue, 9 Dec 2014 09:19:13 +0000 (09:19 +0000)]
first cut at updating for the next release

10 years agoSupport choosing alternative binary and manual names from configure.local,
Ingo Schwarze [Tue, 9 Dec 2014 09:14:33 +0000 (09:14 +0000)]
Support choosing alternative binary and manual names from configure.local,
to help downstream distributions avoid naming conflicts.

10 years agoIntegrate the makewhatis binary into the mandoc binary
Ingo Schwarze [Tue, 9 Dec 2014 07:29:42 +0000 (07:29 +0000)]
Integrate the makewhatis binary into the mandoc binary
just like we do it on OpenBSD.  Smaller and neater.
While here, let ./configure set INSTALL_TARGETS.

10 years agoSome sorting and some more comments.
Ingo Schwarze [Tue, 9 Dec 2014 06:31:03 +0000 (06:31 +0000)]
Some sorting and some more comments.
Drop DISTDIR from www-install target.

10 years agoInstall "man" as a hardlink to "mandoc" during db-install.
Ingo Schwarze [Tue, 9 Dec 2014 06:11:35 +0000 (06:11 +0000)]
Install "man" as a hardlink to "mandoc" during db-install.
Install man(1) manual in db-install, not base-install.
Get rid of the useless variables BASEBIN, DBBIN, CGIBIN.

10 years agoWhen opening mandoc.db fails, tell the user in which directory.
Ingo Schwarze [Sat, 6 Dec 2014 01:23:24 +0000 (01:23 +0000)]
When opening mandoc.db fails, tell the user in which directory.
Improving an unhelpful error message reported by millert@.

10 years agoimplement help(1)
Ingo Schwarze [Fri, 5 Dec 2014 21:55:04 +0000 (21:55 +0000)]
implement help(1)

10 years agoImprove parsing of function names.
Ingo Schwarze [Fri, 5 Dec 2014 16:18:14 +0000 (16:18 +0000)]
Improve parsing of function names.
This gets rid of the last bogus entries in base and Xenocara.

10 years agoDo not misinterpret function arguments as function names;
Ingo Schwarze [Fri, 5 Dec 2014 15:16:54 +0000 (15:16 +0000)]
Do not misinterpret function arguments as function names;
improves semantic analysis of more than 300 manuals.

10 years agoRender text before, not after accumulating flag bits, such that flags
Ingo Schwarze [Fri, 5 Dec 2014 14:26:40 +0000 (14:26 +0000)]
Render text before, not after accumulating flag bits, such that flags
for different representations of the same string end up in the same
database entry.  Improves name classification for 500 manuals.

10 years agoWhen finding a .so link after the page was already processed,
Ingo Schwarze [Thu, 4 Dec 2014 21:48:48 +0000 (21:48 +0000)]
When finding a .so link after the page was already processed,
do not clobber the existing names flags;
instead, OR the additional flags into them.

10 years agocorrectly store .Dt and .TH information in the names table
Ingo Schwarze [Thu, 4 Dec 2014 20:13:25 +0000 (20:13 +0000)]
correctly store .Dt and .TH information in the names table

10 years agoin the SYNOPSIS, add .Fo and first .Fn arguments to the names table
Ingo Schwarze [Thu, 4 Dec 2014 18:31:20 +0000 (18:31 +0000)]
in the SYNOPSIS, add .Fo and first .Fn arguments to the names table

10 years agoIn the SYNOPSIS, if .Nm occurs without argument, give the first .Nm
Ingo Schwarze [Thu, 4 Dec 2014 17:36:00 +0000 (17:36 +0000)]
In the SYNOPSIS, if .Nm occurs without argument, give the first .Nm
that occurred in the document a NAME_SYN entry in the names table.

10 years agofix handling of roff requests having a default scale other than "n",
Ingo Schwarze [Thu, 4 Dec 2014 02:05:42 +0000 (02:05 +0000)]
fix handling of roff requests having a default scale other than "n",
in particular .sp which uses "v", when the scale is not specified;
cures groff-mandoc differences in about a dozen Xenocara manuals

10 years agoIgnore macros that never produce any text when deciding whether
Ingo Schwarze [Thu, 4 Dec 2014 01:33:42 +0000 (01:33 +0000)]
Ignore macros that never produce any text when deciding whether
vertical whitespace is needed before a section or subsection.
Cures groff-mandoc differences in more than 300 manuals,
mostly Xenocara, some curses, a few GNU.

10 years agodelete five entries that were already fixed
Ingo Schwarze [Wed, 3 Dec 2014 01:46:54 +0000 (01:46 +0000)]
delete five entries that were already fixed

10 years agoSwitch the default output mode from -Tascii to -Tlocale.
Ingo Schwarze [Tue, 2 Dec 2014 11:31:51 +0000 (11:31 +0000)]
Switch the default output mode from -Tascii to -Tlocale.
This doesn't change anything unless LC_CTYPE is set,
but it helps when running with LC_TYPE=something.UTF-8.

OK tedu@  and earlier positive feedback from:
bentley@ deraadt@ naddy@ stsp@  uqs@freebsd wiz@netbsd

10 years agonote to self to not forget about groff
Ingo Schwarze [Tue, 2 Dec 2014 11:13:49 +0000 (11:13 +0000)]
note to self to not forget about groff

10 years agowe really need .ta
Ingo Schwarze [Tue, 2 Dec 2014 10:41:12 +0000 (10:41 +0000)]
we really need .ta

10 years agoFix the implementation and documentation of \c (continue text input line).
Ingo Schwarze [Tue, 2 Dec 2014 10:08:06 +0000 (10:08 +0000)]
Fix the implementation and documentation of \c (continue text input line).
In particular, make it work in no-fill mode, too.
Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).

10 years agodeveloper documentation regarding header files
Ingo Schwarze [Mon, 1 Dec 2014 08:09:26 +0000 (08:09 +0000)]
developer documentation regarding header files

10 years agoheader cleanup:
Ingo Schwarze [Mon, 1 Dec 2014 08:05:52 +0000 (08:05 +0000)]
header cleanup:
* add missing forward declarations
* remove needless header inclusions
* some style unification

10 years agoThe header libmandoc.h is part of the internal parser interface,
Ingo Schwarze [Mon, 1 Dec 2014 04:34:06 +0000 (04:34 +0000)]
The header libmandoc.h is part of the internal parser interface,
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.

10 years agoThe file read.c is part of the parser, so it cannot include main.h,
Ingo Schwarze [Mon, 1 Dec 2014 04:14:14 +0000 (04:14 +0000)]
The file read.c is part of the parser, so it cannot include main.h,
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.

10 years agoremove unneccessary inclusion protection; patch from deraadt@
Ingo Schwarze [Mon, 1 Dec 2014 04:05:31 +0000 (04:05 +0000)]
remove unneccessary inclusion protection; patch from deraadt@

10 years agotypo; Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux)
Ingo Schwarze [Sun, 30 Nov 2014 22:47:16 +0000 (22:47 +0000)]
typo; Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux)

10 years agodelete three standard abbreviations that are
Ingo Schwarze [Sun, 30 Nov 2014 21:56:18 +0000 (21:56 +0000)]
delete three standard abbreviations that are
* no longer used in OpenBSD
* not used in any of NetBSD, FreeBSD, or DragonFly
* not supported by groff

10 years agoMultiple fixes with respect to .Pf:
Ingo Schwarze [Sun, 30 Nov 2014 05:29:00 +0000 (05:29 +0000)]
Multiple fixes with respect to .Pf:
* 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.

10 years agowarn about attempts to call non-callable macros;
Ingo Schwarze [Sun, 30 Nov 2014 02:36:38 +0000 (02:36 +0000)]
warn about attempts to call non-callable macros;
inspired by a similar warning in the groff_mdoc(7) macros

10 years agoReduce code duplication by reusing the same argument parser
Ingo Schwarze [Sat, 29 Nov 2014 04:31:35 +0000 (04:31 +0000)]
Reduce code duplication by reusing the same argument parser
for in_line_eoln() macros and .Bl -column phrases.
No functional change.

10 years agoProvide a helper function macro_or_word() and use it to prune the
Ingo Schwarze [Sat, 29 Nov 2014 03:37:44 +0000 (03:37 +0000)]
Provide a helper function macro_or_word() and use it to prune the
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.

10 years agoFold the loop around mdoc_argv() into the function itself,
Ingo Schwarze [Fri, 28 Nov 2014 23:21:32 +0000 (23:21 +0000)]
Fold the loop around mdoc_argv() into the function itself,
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.

10 years agoAT&T is unlikely to release an new version of Research UNIX any time soon.
Ingo Schwarze [Fri, 28 Nov 2014 18:57:31 +0000 (18:57 +0000)]
AT&T is unlikely to release an new version of Research UNIX any time soon.
So, it's pointless to make adding version strings easy for downstream.
One source file less to maintain.

10 years agoRetire support for CSRG supplementary document titles. These are
Ingo Schwarze [Fri, 28 Nov 2014 18:36:35 +0000 (18:36 +0000)]
Retire support for CSRG supplementary document titles.  These are
long obsolete and were never written in mdoc(7) in the first place.
Removes 100 lines from source files.

10 years agoDrop useless architecture table. Validating architecture names
Ingo Schwarze [Fri, 28 Nov 2014 18:09:01 +0000 (18:09 +0000)]
Drop useless architecture table.  Validating architecture names
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@.

10 years agokill a pointless assert
Ingo Schwarze [Fri, 28 Nov 2014 17:24:41 +0000 (17:24 +0000)]
kill a pointless assert

10 years agomop up an #ifdef turd deraadt@ stepped into
Ingo Schwarze [Fri, 28 Nov 2014 16:54:23 +0000 (16:54 +0000)]
mop up an #ifdef turd deraadt@ stepped into

10 years agoBe more careful about meta->name. For weird input, it can be NULL.
Ingo Schwarze [Fri, 28 Nov 2014 16:02:52 +0000 (16:02 +0000)]
Be more careful about meta->name.  For weird input, it can be NULL.
Fixing a NULL access jsg@ found with afl.

10 years agoSimplify by making the eqn and tbl steering functions void;
Ingo Schwarze [Fri, 28 Nov 2014 06:27:05 +0000 (06:27 +0000)]
Simplify by making the eqn and tbl steering functions void;
no functional change, minus 15 lines of code.

10 years agoSimplify by making many functions in the man(7) parser void,
Ingo Schwarze [Fri, 28 Nov 2014 05:51:32 +0000 (05:51 +0000)]
Simplify by making many functions in the man(7) parser void,
and some cleanup; no functional change, minus 70 lines.

10 years agoSimplify by making the mdoc parser callbacks void, and some cleanup;
Ingo Schwarze [Fri, 28 Nov 2014 04:47:03 +0000 (04:47 +0000)]
Simplify by making the mdoc parser callbacks void, and some cleanup;
no functional change, minus 50 lines of code.

10 years agoSimplify the code by making various mdoc parser helper functions void.
Ingo Schwarze [Fri, 28 Nov 2014 03:14:18 +0000 (03:14 +0000)]
Simplify the code by making various mdoc parser helper functions void.
No functional change, minus 130 lines of code.

10 years agoSimplify code by making mdoc validation handlers void.
Ingo Schwarze [Fri, 28 Nov 2014 01:05:43 +0000 (01:05 +0000)]
Simplify code by making mdoc validation handlers void.
No functional change, minus 90 lines of code.

10 years agoDowngrade .Bd -file from FATAL to ERROR.
Ingo Schwarze [Thu, 27 Nov 2014 23:40:19 +0000 (23:40 +0000)]
Downgrade .Bd -file from FATAL to ERROR.
Since this was the last remaining FATAL error in this area,
this change will allow major simplifications in the mdoc(7) parser.

10 years agoMultiple fixes with respect to .Eo:
Ingo Schwarze [Thu, 27 Nov 2014 22:27:56 +0000 (22:27 +0000)]
Multiple fixes with respect to .Eo:
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.

10 years agoFix the obsolete .Db (toggle debug mode) macro to ignore its arguments
Ingo Schwarze [Thu, 27 Nov 2014 16:20:31 +0000 (16:20 +0000)]
Fix the obsolete .Db (toggle debug mode) macro to ignore its arguments
and not trigger an assertion when there is more than one argument;
the latter found by jsg@ with afl.

10 years agoMake makewhatis(8) understand .so links to .gz pages.
Ingo Schwarze [Thu, 27 Nov 2014 01:58:21 +0000 (01:58 +0000)]
Make makewhatis(8) understand .so links to .gz pages.
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.

10 years agofix build when HAVE_MANPATH is set; patch from <bapt at FreeBSD>
Ingo Schwarze [Thu, 27 Nov 2014 00:30:40 +0000 (00:30 +0000)]
fix build when HAVE_MANPATH is set; patch from <bapt at FreeBSD>

10 years agoLet mparse_readfd() use mparse_open() and mparse_wait()
Ingo Schwarze [Wed, 26 Nov 2014 23:42:14 +0000 (23:42 +0000)]
Let mparse_readfd() use mparse_open() and mparse_wait()
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.

10 years agoSimplify the mparse_open()/mparse_wait() interface.
Ingo Schwarze [Wed, 26 Nov 2014 21:40:17 +0000 (21:40 +0000)]
Simplify the mparse_open()/mparse_wait() interface.
Don't bother the user with the PID of the child process,
store it inside the opaque mparse handle.

10 years agoremove an unreachable warning about .Sm arguments
Ingo Schwarze [Wed, 26 Nov 2014 19:24:03 +0000 (19:24 +0000)]
remove an unreachable warning about .Sm arguments

10 years agoThe .Sm macro accepts at most one argument;
Ingo Schwarze [Wed, 26 Nov 2014 19:22:51 +0000 (19:22 +0000)]
The .Sm macro accepts at most one argument;
fixing an assertion failure found by jsg@ with afl.

10 years agoMake the code sipler and more robust by always assigning a value
Ingo Schwarze [Wed, 26 Nov 2014 17:55:27 +0000 (17:55 +0000)]
Make the code sipler and more robust by always assigning a value
to q.manpath and dropping the (incomplete) later NULL checks.

10 years agoAllow comma-separated options in tbl(7) tables.
Ingo Schwarze [Wed, 26 Nov 2014 17:51:55 +0000 (17:51 +0000)]
Allow comma-separated options in tbl(7) tables.
Provides better groff compatibility.
From bentley@.

10 years agoCompletely rewrite the top level of the layout parser.
Ingo Schwarze [Tue, 25 Nov 2014 21:41:47 +0000 (21:41 +0000)]
Completely rewrite the top level of the layout parser.
* 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.

10 years ago"Aq foo" is not the same as "<foo>". Don't use it to mark up HTML;
Ingo Schwarze [Tue, 25 Nov 2014 20:18:15 +0000 (20:18 +0000)]
"Aq foo" is not the same as "<foo>". Don't use it to mark up HTML;
from bentley@.

10 years agoDo not access a NULL pointer when a section has no body,
Ingo Schwarze [Tue, 25 Nov 2014 20:00:01 +0000 (20:00 +0000)]
Do not access a NULL pointer when a section has no body,
which can for example happen for .Sh Xo .Sh without .Xc.
Crash found by jsg@ with afl.

10 years agoWe repeatedly observed assertion crashes in the low-level terminal
Ingo Schwarze [Fri, 21 Nov 2014 01:52:53 +0000 (01:52 +0000)]
We repeatedly observed assertion crashes in the low-level terminal
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.

10 years agoPrevent negative arguments to the .ll request from causing integer
Ingo Schwarze [Thu, 20 Nov 2014 13:56:20 +0000 (13:56 +0000)]
Prevent negative arguments to the .ll request from causing integer
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.

10 years agowarn about calling non-callable macros
Ingo Schwarze [Thu, 20 Nov 2014 02:21:27 +0000 (02:21 +0000)]
warn about calling non-callable macros

10 years agoFix two minibugs reported by Thomas Klausner <wiz at NetBSD>:
Ingo Schwarze [Thu, 20 Nov 2014 00:31:28 +0000 (00:31 +0000)]
Fix two minibugs reported by Thomas Klausner <wiz at NetBSD>:
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.

10 years agoLet .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,
Ingo Schwarze [Wed, 19 Nov 2014 22:00:37 +0000 (22:00 +0000)]
Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,
just like groff; minibug noticed by bentley@.

10 years agoThree fixes with respect to the names table:
Ingo Schwarze [Wed, 19 Nov 2014 20:40:51 +0000 (20:40 +0000)]
Three fixes with respect to the names table:
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.

10 years agoEscape sequences terminate high-level macro names, and when doing so,
Ingo Schwarze [Wed, 19 Nov 2014 03:08:17 +0000 (03:08 +0000)]
Escape sequences terminate high-level macro names, and when doing so,
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.

10 years agoSupport the ".if v" conditional operator (vroff mode, always false)
Ingo Schwarze [Wed, 19 Nov 2014 01:20:25 +0000 (01:20 +0000)]
Support the ".if v" conditional operator (vroff mode, always false)
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@.

10 years agoIgnore invalid directories in man.conf(5) and MANPATH, even if their
Ingo Schwarze [Tue, 18 Nov 2014 19:41:47 +0000 (19:41 +0000)]
Ignore invalid directories in man.conf(5) and MANPATH, even if their
parent directories exist, but complain about invalid directories
given on the command line.
Intended to fix an oddity reported by sthen@.

10 years agoIn man(1) mode, prefer file name matches over .Dt name matches over
Ingo Schwarze [Tue, 18 Nov 2014 01:15:21 +0000 (01:15 +0000)]
In man(1) mode, prefer file name matches over .Dt name matches over
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.

10 years agoMultiple fixes with respect to in-line macros:
Ingo Schwarze [Mon, 17 Nov 2014 06:44:58 +0000 (06:44 +0000)]
Multiple fixes with respect to in-line macros:
* .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@.

10 years agoWhen a line (in the sense of term_flushln()) contains white space only,
Ingo Schwarze [Sun, 16 Nov 2014 21:29:35 +0000 (21:29 +0000)]
When a line (in the sense of term_flushln()) contains white space only,
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 " "

10 years agoDelete five standards that are:
Ingo Schwarze [Sun, 16 Nov 2014 20:46:21 +0000 (20:46 +0000)]
Delete five standards that are:
* 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@

10 years agoRemove needless and harmful byte swapping on big endian architectures.
Ingo Schwarze [Fri, 14 Nov 2014 04:24:04 +0000 (04:24 +0000)]
Remove needless and harmful byte swapping on big endian architectures.
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.

10 years agoIn man(1) mode without -a, stop searching after the first manual tree
Ingo Schwarze [Tue, 11 Nov 2014 19:04:55 +0000 (19:04 +0000)]
In man(1) mode without -a, stop searching after the first manual tree
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.

10 years agoLet -h imply -c (that is, not use the pager).
Ingo Schwarze [Tue, 11 Nov 2014 02:43:41 +0000 (02:43 +0000)]
Let -h imply -c (that is, not use the pager).
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.

10 years agoimplement -h (synopsis only) for preformatted (cat) pages;
Ingo Schwarze [Tue, 11 Nov 2014 02:10:04 +0000 (02:10 +0000)]
implement -h (synopsis only) for preformatted (cat) pages;
requested by tedu@

10 years agoadd required vertical spacing before lists that begin
Ingo Schwarze [Mon, 10 Nov 2014 21:56:43 +0000 (21:56 +0000)]
add required vertical spacing before lists that begin
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>

10 years agohyperlinking in -man -Thtml
Ingo Schwarze [Sun, 9 Nov 2014 00:54:58 +0000 (00:54 +0000)]
hyperlinking in -man -Thtml
punctuation in the middle of .Fn

10 years agoLet -Tascii \(bu (bullet) output agree with groff;
Ingo Schwarze [Thu, 6 Nov 2014 22:28:36 +0000 (22:28 +0000)]
Let -Tascii \(bu (bullet) output agree with groff;
this is now possible because -Tps now handles backspace overstriking.

10 years agoAllow the five man(7) font macros to concatenate their line arguments,
Ingo Schwarze [Mon, 3 Nov 2014 23:18:39 +0000 (23:18 +0000)]
Allow the five man(7) font macros to concatenate their line arguments,
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.

10 years agoUse struct buf in libroff, it is very natural there
Ingo Schwarze [Sat, 1 Nov 2014 06:03:13 +0000 (06:03 +0000)]
Use struct buf in libroff, it is very natural there
and reduces the number of arguments of many functions.
While here, sprinkle some KNF.
No functional change.

10 years agoRefactor, no functional change: Remove the parse point from struct buf.
Ingo Schwarze [Sat, 1 Nov 2014 04:08:43 +0000 (04:08 +0000)]
Refactor, no functional change: Remove the parse point from struct buf.
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.