]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
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@.

10 years agoWhile all current callers pass valid data to ascii_hspan() only,
Ingo Schwarze [Sun, 17 Aug 2014 22:10:29 +0000 (22:10 +0000)]
While all current callers pass valid data to ascii_hspan() only,
it's safer to assume incoming enum data might be invalid
and catch it instead of happily returning an unitialized int.
No functional change right now.

10 years agotypo; Steven Honeyman <stevenhoneyman at gmail dot com>
Ingo Schwarze [Sun, 17 Aug 2014 21:03:06 +0000 (21:03 +0000)]
typo; Steven Honeyman <stevenhoneyman at gmail dot com>

10 years agoDo not require getsubopt() to provide extern char *suboptarg.
Ingo Schwarze [Sun, 17 Aug 2014 20:53:50 +0000 (20:53 +0000)]
Do not require getsubopt() to provide extern char *suboptarg.
We don't use it anyway in mandoc.  Like this, fewer systems need
the compat implementation.  In particular, we can now use the stock
getsubopt() on glibc and musl.

Besides, the comment in the BSD getsubopt.c that error messages are
tricky without *suboptarg is massively overblown.  If you simply
save a copy of the pointer you pass into getsubopt(), that's quite
usable for an error message.

People start campaigning for the addition of *suboptarg to C libraries
on the grounds that mandoc wants it, but actually, i consider library
functions manipulating global data quite ugly, so stop pushing people
into that questionable direction.

While here, add an explicit Copyright header to the test file.
While it's obviously to me what Kristaps intended, others might
consider this file copyrightable and wonder what's up.

10 years agoone forgotten #ifdef -> #if conversion
Ingo Schwarze [Sun, 17 Aug 2014 20:45:59 +0000 (20:45 +0000)]
one forgotten #ifdef -> #if conversion

10 years ago... and remove the trailing spaces (duh. i should pay more attention)
Ingo Schwarze [Sun, 17 Aug 2014 16:51:55 +0000 (16:51 +0000)]
... and remove the trailing spaces (duh.  i should pay more attention)

10 years agoKNF: fix indentation of previous commit, see style(9):
Ingo Schwarze [Sun, 17 Aug 2014 16:44:41 +0000 (16:44 +0000)]
KNF: fix indentation of previous commit, see style(9):
"Indentation is an 8 character tab.  Second level indents are four spaces."
All the rest of this file already conforms.

10 years agoProtect against accessing "n->next->child" by first checking "n->next".
Kristaps Dzonsons [Sun, 17 Aug 2014 08:37:11 +0000 (08:37 +0000)]
Protect against accessing "n->next->child" by first checking "n->next".
Noticed in a crash against ".It Nm Fo" with no closing "Fc".
Original patch expanded by schwarze@ then extended even more.

10 years agoFully integrate apropos(1) into mandoc(1).
Ingo Schwarze [Sun, 17 Aug 2014 03:24:47 +0000 (03:24 +0000)]
Fully integrate apropos(1) into mandoc(1).
Switch the argmode on the progname, including man(1).
Provide -f and -k options to switch the argmode.
Store the argmode inside struct search, generalizing the flags.
Derive the deftype from the argmode when needed instead of storing it.
Store the outkey inside struct search instead of passing it alone.
While here, get rid of the trailing blanks in Makefile.depend.

10 years agoWhen BUILD_DB is active, link apropos(1) into the mandoc binary.
Ingo Schwarze [Sat, 16 Aug 2014 23:04:25 +0000 (23:04 +0000)]
When BUILD_DB is active, link apropos(1) into the mandoc binary.
This is the first step on the way to a man(1) implementation.
The new ./configure is flexible enough to make this step quite easy.

10 years agoIf a stray .It follows .El, we are no longer in the list,
Ingo Schwarze [Sat, 16 Aug 2014 19:50:37 +0000 (19:50 +0000)]
If a stray .It follows .El, we are no longer in the list,
even though the list is still the last processed macro.
This fixes a regression introduced in mdoc_macro.c rev. 1.138:
Ulrich Spoerlein <uqs at FreeBSD> reports that various of their
kernel manuals trigger assertions.

10 years agoImprove build system and autodetection.
Ingo Schwarze [Sat, 16 Aug 2014 19:00:01 +0000 (19:00 +0000)]
Improve build system and autodetection.
* Make ./configure standalone, that's what people expect.
* Let people write a ./configure.local from scratch, not edit existing files.
* Autodetect wchar, sqlite3, and manpath and act accordingly.
* Autodetect the need for -L/usr/local/lib and -lutil.
* Get rid of config.h.p{re,ost}, let ./configure only write what's needed.
* Let ./configure write a Makefile.local snippet, that's quite flexible.

10 years agoSome compilers apparently worry that abort() might return
Ingo Schwarze [Thu, 14 Aug 2014 22:33:10 +0000 (22:33 +0000)]
Some compilers apparently worry that abort() might return
and then throw a "may be used uninitialized" warning, so
sprinkle some /* NOTREACHED */.  No functional change.
Noticed by Thomas Klausner <wiz at NetBSD dot org>.

10 years agoClarify that .Em and .Sy are physical, not semantic markup,
Ingo Schwarze [Thu, 14 Aug 2014 20:57:19 +0000 (20:57 +0000)]
Clarify that .Em and .Sy are physical, not semantic markup,
explain appropriate usage, and provide some examples.
ok jmc@

10 years agoremove double word; from jmc@
Ingo Schwarze [Thu, 14 Aug 2014 20:27:45 +0000 (20:27 +0000)]
remove double word; from jmc@

10 years agoRevert previous, as requested by kristaps@.
Ingo Schwarze [Thu, 14 Aug 2014 00:31:43 +0000 (00:31 +0000)]
Revert previous, as requested by kristaps@.
The .Bf block can contain subblocks, so it has to render as an
element that can contain flow content.  But <em> cannot contain
flow content, only phrasing content.  Rendering .Em and .Bf differently
would by unfortunate, and closing out .Bf before subblocks and
re-opening it afterwards would merely complicate both the C code
of the program and the generated HTML code.  Besides, converting
.Em to semantic HTML markup would require some content to be put
into <em> and some into <i>, but we cannot automatically distinguish
which is which, so strictly speaking, we can't use semantic HTML
here but have to fall back to physical markup.  Wonders of HTML...

10 years agonote about AT&T documenters workbench
Ingo Schwarze [Wed, 13 Aug 2014 22:17:51 +0000 (22:17 +0000)]
note about AT&T documenters workbench

10 years agonote about <var>
Ingo Schwarze [Wed, 13 Aug 2014 21:30:55 +0000 (21:30 +0000)]
note about <var>

10 years agoBegin cleaning up scaling units.
Kristaps Dzonsons [Wed, 13 Aug 2014 20:34:29 +0000 (20:34 +0000)]
Begin cleaning up scaling units.
Start with the horizontal terminal specifiers, making sure that they match
up with troff.
Then move on to PS, PDF, and HTML, noting that we stick to the terminal
default width for "u".
Lastly, fix some completely-wrong documentation and note that we diverge
from troff w/r/t "u".

10 years agoUse <em> for .Em and .Bf -emphasis.
Ingo Schwarze [Wed, 13 Aug 2014 15:25:22 +0000 (15:25 +0000)]
Use <em> for .Em and .Bf -emphasis.

The vast majority of .Em in real-world manuals is stress emphasis,
for which <em> is the correct markup.  Admittedly, there are some
instances of .Em usage for alternate quality, for which <i> would
be a better match.  Most of these are technical terms that neither
allow semantic markup nor are keywords - for the latter, .Sy would
be preferable.  A typical example is that the shell breaks input into
.Em words .
Alternate voice or mood, which would also require <i>, is almost
absent from manuals.
We cannot satisfy both stress emphasis and alternate quality, so
pick the one that fits more often and looks less wrong when off.

Patch from Guy Harris <guy at alum dot mit dot edu>.
ok joerg@ bentley@

10 years agotypo in comment; Guy Harris <guy at alum dot mit dot edu>
Ingo Schwarze [Tue, 12 Aug 2014 21:35:48 +0000 (21:35 +0000)]
typo in comment; Guy Harris <guy at alum dot mit dot edu>

10 years agoIn mdoc(7) and man(7), if a width is given as a bare number without
Ingo Schwarze [Tue, 12 Aug 2014 19:28:16 +0000 (19:28 +0000)]
In mdoc(7) and man(7), if a width is given as a bare number without
specifying a unit, the implied unit is 'n' (on the terminal, one
character position; in PostScript, half of the current font size
in points), not 'u' (roff output device basic unit).  No functional
change right now, but important for the upcoming scaling unit fixes.

10 years agoThe macro SCALE_HS_INIT() is always passed the result of strlen() or
Ingo Schwarze [Tue, 12 Aug 2014 19:28:03 +0000 (19:28 +0000)]
The macro SCALE_HS_INIT() is always passed the result of strlen() or
an equivalent number as its argument, and strlen() measures the width
of a string in characters, not in basic units.  No functional change
right now, but important for the upcoming scaling unit fixes.

10 years agowork around lack of d_namlen and ALIGN/ALIGNBYTES on Linux
Ingo Schwarze [Mon, 11 Aug 2014 03:19:39 +0000 (03:19 +0000)]
work around lack of d_namlen and ALIGN/ALIGNBYTES on Linux

10 years agorevert previous; i missed that config.h needs sys/types.h and stdio.h
Ingo Schwarze [Mon, 11 Aug 2014 02:21:27 +0000 (02:21 +0000)]
revert previous; i missed that config.h needs sys/types.h and stdio.h
for itself because it uses size_t and FILE...

10 years agotypo
Ingo Schwarze [Mon, 11 Aug 2014 02:05:54 +0000 (02:05 +0000)]
typo

10 years agoProvide a fallback version of fts(3) for systems lacking it.
Ingo Schwarze [Mon, 11 Aug 2014 01:39:00 +0000 (01:39 +0000)]
Provide a fallback version of fts(3) for systems lacking it.
I chose the OpenBSD version because it apparently contains various
bugfixes that never made it into libnbcompat.  To reduce size and
complexity, i stripped out the features we don't need.

10 years agoGet rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Ingo Schwarze [Sun, 10 Aug 2014 23:54:41 +0000 (23:54 +0000)]
Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.

10 years agoNew section about deployment by Kristaps. VERSION_1_13_1
Ingo Schwarze [Sun, 10 Aug 2014 17:22:26 +0000 (17:22 +0000)]
New section about deployment by Kristaps.
New paragraph about fts(3) by me.
And various minor tweaks, some by Kristaps and some by me.

10 years ago1.13.1 release notes
Ingo Schwarze [Sun, 10 Aug 2014 16:32:57 +0000 (16:32 +0000)]
1.13.1 release notes

10 years agosync after adding config.h to mansearch_const.c;
Ingo Schwarze [Sun, 10 Aug 2014 16:21:08 +0000 (16:21 +0000)]
sync after adding config.h to mansearch_const.c;
committing on behalf of kristaps@ because i want to release now

10 years agoClarifications in comments and standard output suggested by
Ingo Schwarze [Sun, 10 Aug 2014 02:45:04 +0000 (02:45 +0000)]
Clarifications in comments and standard output suggested by
Paul Onyschuk <ptmelville at gmail dot com> (Alpine Linux)

10 years agommap(2) requires MAP_PRIVATE ^ MAP_SHARED for flags;
Ingo Schwarze [Sat, 9 Aug 2014 14:24:53 +0000 (14:24 +0000)]
mmap(2) requires MAP_PRIVATE ^ MAP_SHARED for flags;
found by kristaps@ on Mac OS X

10 years agomissing #include "config.h",
Ingo Schwarze [Sat, 9 Aug 2014 14:05:21 +0000 (14:05 +0000)]
missing #include "config.h",
hence missing definition of __BEGIN_DECLS;
found by Thomas Klausner <wiz at NetBSD> on SunOS 5.11

10 years agoDo not hardcode stuff in ./configure that is actually user-configurable
Ingo Schwarze [Fri, 8 Aug 2014 23:47:21 +0000 (23:47 +0000)]
Do not hardcode stuff in ./configure that is actually user-configurable
in the Makefile; instead, pass it down via the environment just
like CFLAGS.
Nice suggestion from kristaps@ hoping to make MacOS X happier.

10 years agoDelete the __attribute__((__bounded__(...))) annotation.
Ingo Schwarze [Fri, 8 Aug 2014 23:43:47 +0000 (23:43 +0000)]
Delete the __attribute__((__bounded__(...))) annotation.
That's an OpenBSD-specific gcc-4.2.1 security extension.
It's certainly a bad idea to use such stuff in a compatibility header,
as other operating systems just won't understand it.

10 years agoadd INSTALL and bump VERSION
Ingo Schwarze [Fri, 8 Aug 2014 20:34:06 +0000 (20:34 +0000)]
add INSTALL and bump VERSION

10 years agomention neatroff
Ingo Schwarze [Fri, 8 Aug 2014 20:04:36 +0000 (20:04 +0000)]
mention neatroff

10 years agoprovide some instructions for manual installation
Ingo Schwarze [Fri, 8 Aug 2014 16:45:39 +0000 (16:45 +0000)]
provide some instructions for manual installation

10 years agoWhen .Sm is called without an argument, groff toggles the spacing mode,
Ingo Schwarze [Fri, 8 Aug 2014 16:38:06 +0000 (16:38 +0000)]
When .Sm is called without an argument, groff toggles the spacing mode,
so let us do the same for compatibility.  Using this feature is of
course not recommended except in manual page obfuscation contests.

10 years agosome corrections and improvements with respect to prologue macros;
Ingo Schwarze [Fri, 8 Aug 2014 01:52:40 +0000 (01:52 +0000)]
some corrections and improvements with respect to prologue macros;
found while working on mandoc(1) messages

10 years agodocument warning and error messages, using quite some feedback from jmc@;
Ingo Schwarze [Fri, 8 Aug 2014 01:50:59 +0000 (01:50 +0000)]
document warning and error messages, using quite some feedback from jmc@;
more cleanup is likely to happen when it's in

10 years agoBring the handling of defective prologues even closer to groff,
Ingo Schwarze [Wed, 6 Aug 2014 15:09:05 +0000 (15:09 +0000)]
Bring the handling of defective prologues even closer to groff,
in particular relaxing the distinction between prologue and body
and further improving messages.
* The last .Dd wins and the last .Os wins, even in the body.
* The last .Dt before the first body macro wins.
* Missing title in .Dt defaults to UNTITLED.  Warn about it.
* Missing section in .Dt does not default to 1.  But warn about it.
* Do not warn multiple times about the same mdoc(7) prologue macro.
* Warn about missing .Os.
* Incomplete .TH defaults to empty strings.  Warn about it.

10 years agosync after sqlite3_errstr() compat addition
Ingo Schwarze [Tue, 5 Aug 2014 16:12:25 +0000 (16:12 +0000)]
sync after sqlite3_errstr() compat addition

10 years agostrcasestr() wants _GNU_SOURCE on Linux
Ingo Schwarze [Tue, 5 Aug 2014 16:03:03 +0000 (16:03 +0000)]
strcasestr() wants _GNU_SOURCE on Linux

10 years agoNULL is in <stddef.h>; found on Linux
Ingo Schwarze [Tue, 5 Aug 2014 16:00:37 +0000 (16:00 +0000)]
NULL is in <stddef.h>; found on Linux

10 years agomansearch.h uses uint64_t, so it needs stdint.h; found on Linux
Ingo Schwarze [Tue, 5 Aug 2014 15:29:30 +0000 (15:29 +0000)]
mansearch.h uses uint64_t, so it needs stdint.h; found on Linux

10 years agoAbsurdly, the return value of sqlite3_column_text()
Ingo Schwarze [Tue, 5 Aug 2014 14:43:10 +0000 (14:43 +0000)]
Absurdly, the return value of sqlite3_column_text()
is "const unsigned char *", which causes warnings with GCC on Linux.
Explicitly cast to "const char *" to avoid this.
Issue noticed by kristaps@.

10 years agoSince old SQLite versions do not have sqlite3_errstr(),
Ingo Schwarze [Tue, 5 Aug 2014 12:50:52 +0000 (12:50 +0000)]
Since old SQLite versions do not have sqlite3_errstr(),
provide a dummy fallback implementation.
Do not bother to decode the error, SQLite error codes
are not useful enough for that to be worthwhile.
Note that using sqlite3_errmsg(db) would be a bad idea:
On malloc() failure, db is NULL, which would cause a segfault.
Issue noticed by kristaps@.

10 years agoIf an old SQLite version doesn't provide SQLITE_DETERMINISTIC,
Ingo Schwarze [Tue, 5 Aug 2014 12:34:08 +0000 (12:34 +0000)]
If an old SQLite version doesn't provide SQLITE_DETERMINISTIC,
simply ignore it, as using it is merely an optimization.
Issue noticed by kristaps@.

10 years agoPortability fix:
Ingo Schwarze [Tue, 5 Aug 2014 11:19:13 +0000 (11:19 +0000)]
Portability fix:
* POSIX syntax is 'include Makefile.depend', not '.include "Makefile.depend"'
* gmake(1) runs the build rule for the included file (duh), so delete the rule
* consequently, we have to mark the 'depend' maintainer target .PHONY
* as it's now .PHONY anyway, drop some prerequisites that are now useless
Issue noticed by kristaps@.

10 years agoSync library documentation with reality.
Ingo Schwarze [Tue, 5 Aug 2014 05:48:56 +0000 (05:48 +0000)]
Sync library documentation with reality.
Split mandoc_escape(3), mandoc_malloc(3), and mchars_alloc(3)
out of mandoc(3), adding lots of new information.

10 years agoSwitch to autogenerated dependency rules; they are less error-prone.
Ingo Schwarze [Tue, 5 Aug 2014 05:27:16 +0000 (05:27 +0000)]
Switch to autogenerated dependency rules; they are less error-prone.
Provide a maintainer target to regenerate them.

10 years agoProperly partition the build system and install some missing stuff:
Ingo Schwarze [Tue, 5 Aug 2014 03:02:40 +0000 (03:02 +0000)]
Properly partition the build system and install some missing stuff:
* Introduce targets base-build, db-build, cgi-build.
* Introduce targets base-install, db-install, cgi-install.
* Introduce a BUILD_TARGETS variable to contain db-build and cgi-build.
* Introduce an INSTALL_TARGETS variable and fill it using BUILD_TARGETS.
* Install the whatis(1) and makewhatis(8) binaries.
* Install the apropos(1), whatis(1), and makewhatis(8) manuals.
* Install mandoc_aux.h.
* Do not build manpage(1) by default.

10 years agoVarious minor corrections:
Ingo Schwarze [Tue, 5 Aug 2014 01:45:02 +0000 (01:45 +0000)]
Various minor corrections:
* Do not unconditionally use -I/usr/local/include and -L/usr/local/lib.
* Do not install programs and libs root-writeable.
* Add missing test-strcasestr.c and test-strsep.c to TESTSRCS.
* Add missing cgi.h.example and mandoc_html.3 to SRCS.
* Add missing mandoc_html.3.html to WWW_MANS.

10 years agosort user settings; no functional change
Ingo Schwarze [Tue, 5 Aug 2014 01:07:00 +0000 (01:07 +0000)]
sort user settings; no functional change

10 years agoremove strnlen(3) compat, we no longer use it
Ingo Schwarze [Mon, 4 Aug 2014 23:44:29 +0000 (23:44 +0000)]
remove strnlen(3) compat, we no longer use it

10 years agoSimplify by allowing only one post-handler.
Ingo Schwarze [Sat, 2 Aug 2014 00:02:42 +0000 (00:02 +0000)]
Simplify by allowing only one post-handler.
Saves 36 static arrays and 10 lines of code
at the expense of only five new trivial static functions.
No functional change.

10 years agoSimplify by allowing only one pre-handler.
Ingo Schwarze [Fri, 1 Aug 2014 22:22:11 +0000 (22:22 +0000)]
Simplify by allowing only one pre-handler.
Saves 12 static arrays and 19 lines of code.
No functional change.

10 years agoSimplify man(7) validation:
Ingo Schwarze [Fri, 1 Aug 2014 21:24:17 +0000 (21:24 +0000)]
Simplify man(7) validation:
Drop pre-handlers, they were almost unused.
Drop the needless complexity of allowing more than one post-handler.

This saves one internal interface function, one static function, one
private struct definition, sixteen static arrays, and 45 lines of code.
No functional change.

10 years agoFix floating point handling: When converting double to size_t,
Ingo Schwarze [Fri, 1 Aug 2014 19:38:29 +0000 (19:38 +0000)]
Fix floating point handling: When converting double to size_t,
properly round to the nearest M (=0.001m), which is the smallest
available unit.

This avoids weirdness like (size_t)(0.6 * 10.0) == 5
by instead calculating (size_t)(0.6 * 10.0 + 0.0005) == 6,
and so it fixes the indentation of the readline(3) manual.

10 years agoClarity with respect to floating point handling:
Ingo Schwarze [Fri, 1 Aug 2014 19:25:52 +0000 (19:25 +0000)]
Clarity with respect to floating point handling:
Write double constants as double rather than integer literals.
Remove useless explicit (double) cast done at one place and nowhere else.
No functional change.

10 years agodemacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()
Ingo Schwarze [Fri, 1 Aug 2014 17:40:34 +0000 (17:40 +0000)]
demacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()

10 years agomention requests and macros in more messages
Ingo Schwarze [Fri, 1 Aug 2014 17:27:44 +0000 (17:27 +0000)]
mention requests and macros in more messages

10 years agoDynamically allocate the stack of roff(7) .ie condition values
Ingo Schwarze [Fri, 1 Aug 2014 15:08:46 +0000 (15:08 +0000)]
Dynamically allocate the stack of roff(7) .ie condition values
and thus get rid of the last useless fatal error.

10 years agoSplit MANDOCERR_IGNARGV into one message for .An and one for .Bl
Ingo Schwarze [Thu, 31 Jul 2014 09:22:21 +0000 (09:22 +0000)]
Split MANDOCERR_IGNARGV into one message for .An and one for .Bl
and report the macro name and argument.

10 years agoIn .Bl -column, if some of the column width declarations are given
Ingo Schwarze [Thu, 31 Jul 2014 00:41:10 +0000 (00:41 +0000)]
In .Bl -column, if some of the column width declarations are given
right after the -column argument and some at the very end of the
argument list, after some other arguments like -compact, concatenate
the column lists.
This gets rid of one of the last useless FATAL errors
and actually shortens the code by a few lines.

This fixes an issue introduced more than five years ago, at first
causing an assert() since mdoc_action.c rev. 1.14 (June 17, 2009),
then later a FATAL error since mdoc_validate rev. 1.130 (Nov. 30, 2010),
and marked as "TODO" ever since.

10 years agoRemove the useless FATAL error "argument count wrong, violates syntax".
Ingo Schwarze [Wed, 30 Jul 2014 23:38:52 +0000 (23:38 +0000)]
Remove the useless FATAL error "argument count wrong, violates syntax".
The last remaining instance was .It in .Bl -column with more than one
excessive .Ta.  However, simply downgrading from FATAL to ERROR, it just
works fine, almost the same way as in groff, without any other changes.

10 years agoImprove handling of next-line scope broken by end of file.
Ingo Schwarze [Wed, 30 Jul 2014 23:01:39 +0000 (23:01 +0000)]
Improve handling of next-line scope broken by end of file.
Detect the condition earlier, report in the error message
which block is broken, and delete the broken block.
Consequently, empty section headers can no longer happen.

10 years agogarbage collect three unused global flags; no functional change
Ingo Schwarze [Wed, 30 Jul 2014 21:18:24 +0000 (21:18 +0000)]
garbage collect three unused global flags; no functional change

10 years agoSimplify: replace one global flag by one local variable.
Ingo Schwarze [Wed, 30 Jul 2014 20:06:36 +0000 (20:06 +0000)]
Simplify: replace one global flag by one local variable.
No functional change.

10 years agoGet rid of the useless FATAL error "child violates parent syntax".
Ingo Schwarze [Wed, 30 Jul 2014 17:06:26 +0000 (17:06 +0000)]
Get rid of the useless FATAL error "child violates parent syntax".
When finding items outside lists, simply skip them and throw an ERROR.
Handle subsections before the first section instead of bailing out.