]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
8 years agoRename five static functions to make the classification of functions
Ingo Schwarze [Fri, 15 Apr 2016 21:14:51 +0000 (21:14 +0000)]
Rename five static functions to make the classification of functions
as parsers, page generators, and result generators more obvious.
No functional change.

8 years agoprefer warn[x](3) over fprintf(3) where appropriate
Ingo Schwarze [Fri, 15 Apr 2016 16:42:52 +0000 (16:42 +0000)]
prefer warn[x](3) over fprintf(3) where appropriate

8 years agoFix parsing of PATH_INFO if both a section directory and an
Ingo Schwarze [Fri, 15 Apr 2016 15:13:07 +0000 (15:13 +0000)]
Fix parsing of PATH_INFO if both a section directory and an
architecture subdirectory are specified.  Issue reported by tb@.

8 years agoMake HTML tags lower case for better stylistic agreement with what
Ingo Schwarze [Fri, 15 Apr 2016 01:34:51 +0000 (01:34 +0000)]
Make HTML tags lower case for better stylistic agreement with what
html.c does.

8 years agoIn the architectures dropdown, move aviion, ia64, solbourne, and vax
Ingo Schwarze [Fri, 15 Apr 2016 00:51:59 +0000 (00:51 +0000)]
In the architectures dropdown, move aviion, ia64, solbourne, and vax
down to the currently unsupported entries.

8 years agoIf PATH_INFO contains a complete and correct path to a manual page
Ingo Schwarze [Fri, 15 Apr 2016 00:37:50 +0000 (00:37 +0000)]
If PATH_INFO contains a complete and correct path to a manual page
file, for example "/OpenBSD-5.9/man2/pledge.2", no database query
is needed and the file is delivered directly.

But even in this case, let's parse the PATH_INFO and fill the query
structure such that the search form at the top of the result page
gets pre-filled with useful values.

8 years agoomit list of other results when there is only one match
Ingo Schwarze [Fri, 15 Apr 2016 00:14:17 +0000 (00:14 +0000)]
omit list of other results when there is only one match

8 years agofor .Xr links, use short PATH_INFO style URIs
Ingo Schwarze [Thu, 14 Apr 2016 23:48:48 +0000 (23:48 +0000)]
for .Xr links, use short PATH_INFO style URIs

8 years agoFix a process group race.
Ingo Schwarze [Thu, 14 Apr 2016 20:55:48 +0000 (20:55 +0000)]
Fix a process group race.

It could occasionally happen that the child process spawned less(1)
before the parent process passed the control of the terminal to the
child, and in that case, less(1) sometimes complained "Stopped (tty
output)".  Issue reported by naddy@.

8 years agodo not rewrite short queries
Ingo Schwarze [Thu, 14 Apr 2016 20:40:33 +0000 (20:40 +0000)]
do not rewrite short queries

8 years agoin -man -Thtml, .nf does not preserve indentation
Ingo Schwarze [Thu, 14 Apr 2016 11:16:04 +0000 (11:16 +0000)]
in -man -Thtml, .nf does not preserve indentation

8 years agoGive manuals in purely numerical sections priority over manuals of
Ingo Schwarze [Wed, 13 Apr 2016 15:38:45 +0000 (15:38 +0000)]
Give manuals in purely numerical sections priority over manuals of
the same name in sections with an alphabetical suffix; same logic
as in main.c rev. 1.264.

8 years agoGive manuals in purely numerical sections priority over manuals of
Ingo Schwarze [Wed, 13 Apr 2016 12:26:25 +0000 (12:26 +0000)]
Give manuals in purely numerical sections priority over manuals of
the same name in sections with an alphabetical suffix (on OpenBSD,
mostly 3p), restoring behaviour of the traditional BSD man(1) that
got lost in the switch to the mandoc-based implementation.

Issue reported by jsg@, using an idea by mikeb@ for the solution,
and at least afresh1@ and jasper@ also seem in favour of the direction.

8 years agofix error page indentation:
Ingo Schwarze [Wed, 13 Apr 2016 10:19:23 +0000 (10:19 +0000)]
fix error page indentation:
negative indent for h1 only in div.section
issue reported by mikeb@

8 years agosed 's/the the/the/' in a comment; from krw@
Ingo Schwarze [Tue, 12 Apr 2016 15:30:00 +0000 (15:30 +0000)]
sed 's/the the/the/' in a comment; from krw@

8 years agodouble word; from jmc@
Ingo Schwarze [Sat, 19 Mar 2016 13:29:22 +0000 (13:29 +0000)]
double word; from jmc@

8 years agoMake the SCRIPT_NAME logic simpler, safer, and make it actually work;
Ingo Schwarze [Fri, 18 Mar 2016 13:22:27 +0000 (13:22 +0000)]
Make the SCRIPT_NAME logic simpler, safer, and make it actually work;
in part based on ideas by bentley@.
While here, improve the documentation.

8 years agodocument short URIs
Ingo Schwarze [Fri, 18 Mar 2016 01:22:56 +0000 (01:22 +0000)]
document short URIs

8 years agomake man(1) mode the default rather than apropos(1) mode
Ingo Schwarze [Thu, 17 Mar 2016 22:06:44 +0000 (22:06 +0000)]
make man(1) mode the default rather than apropos(1) mode

8 years ago'accomodate' -> 'accommodate' in a comment.
Ingo Schwarze [Thu, 17 Mar 2016 21:26:26 +0000 (21:26 +0000)]
'accomodate' -> 'accommodate' in a comment.
From krw@, started by a diff from Mical Mazurek.

8 years agosupport short URIs for man.openbsd.org
Ingo Schwarze [Thu, 17 Mar 2016 21:22:59 +0000 (21:22 +0000)]
support short URIs for man.openbsd.org

9 years agounbreak reading from stdin after recent parse() restructuring;
Ingo Schwarze [Sat, 16 Jan 2016 22:30:33 +0000 (22:30 +0000)]
unbreak reading from stdin after recent parse() restructuring;
patch from florian@

9 years agoDelete the redundant "nchild" member of struct roff_node, replacing
Ingo Schwarze [Fri, 8 Jan 2016 17:48:09 +0000 (17:48 +0000)]
Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a
tiny loop - not only making data smaller, but code shorter as well.

This gets rid of an implicit invariant that confused both static
analysis tools and human auditors.  No functional change.

9 years agoPrefer warn(3) over perror(3) at the few places where it was used.
Ingo Schwarze [Fri, 8 Jan 2016 15:02:54 +0000 (15:02 +0000)]
Prefer warn(3) over perror(3) at the few places where it was used.
It is useful to see the program name, and we have err.h compat in place anyway.
Suggested by Christos Zoulas (NetBSD).

9 years agoSimplify the mparse_open() interface.
Ingo Schwarze [Fri, 8 Jan 2016 02:53:13 +0000 (02:53 +0000)]
Simplify the mparse_open() interface.
Just return the file descriptor or -1 on error;
there is just one kind of error anyway.
Suggested by Christos Zoulas (NetBSD).

9 years agoIt was very surprising that a function called mparse_readfd()
Ingo Schwarze [Fri, 8 Jan 2016 02:13:39 +0000 (02:13 +0000)]
It was very surprising that a function called mparse_readfd()
closed the file descriptor passed to it after completing its work,
in particular considering the fact that it required its callers
to call open(2) or mparse_open() beforehand.

Change mparse_readfd() to not call close(2) and change the callers
to call close(2) afterwards, more or less bringing open and close
to the same level of the code and making review easier.  Note that
man.cgi(8) already did that, even though it was wrong in the past.

Small restructuring suggested by Christos Zoulas (NetBSD).

9 years agowould be nice to warn about broken .Xr links...
Ingo Schwarze [Fri, 8 Jan 2016 01:37:32 +0000 (01:37 +0000)]
would be nice to warn about broken .Xr links...

9 years agoThe root of an .EQ tree is always EQN_ROOT, never EQN_LIST,
Ingo Schwarze [Fri, 8 Jan 2016 00:50:45 +0000 (00:50 +0000)]
The root of an .EQ tree is always EQN_ROOT, never EQN_LIST,
so delete a redundant NULL check that confused Coverity in CID 1257471;
issue reported by wiz@, patch differs from what christos@ did in NetBSD.
No functional change.

9 years agoThis code wasted memory by allocating sizeof(enum termfont *)
Ingo Schwarze [Thu, 7 Jan 2016 21:03:54 +0000 (21:03 +0000)]
This code wasted memory by allocating sizeof(enum termfont *)
where only sizeof(enum termfont) is needed.
Fixes CID 1288941.  From christos@ via wiz@, both at NetBSD.

9 years agoRecursive "define" was not detected because "lim" was never
Ingo Schwarze [Thu, 7 Jan 2016 20:19:01 +0000 (20:19 +0000)]
Recursive "define" was not detected because "lim" was never
incremented, causing infinite loops.
Fixing CID 1288962.  From christos@ via wiz@, both at NetBSD.

9 years agoImprove handling of .Va and .Vt macros.
Ingo Schwarze [Mon, 4 Jan 2016 14:44:57 +0000 (14:44 +0000)]
Improve handling of .Va and .Vt macros.
tedu@ noticed that no Vt= database entries were generated.
Serguey Parkhomovsky suggested the deletion of parse_mdoc_body().
tb@ noticed that the fix requires more than just adding TYPE_Vt
to the MDOC_Vt mask in the mdoc_handler array.

9 years agoGenerate simpler in-page links: just replace spaces with underscores.
Ingo Schwarze [Mon, 4 Jan 2016 12:45:29 +0000 (12:45 +0000)]
Generate simpler in-page links: just replace spaces with underscores.
Patch from bentley@.

9 years agoDon't retain the search query in the resulting manual links.
Ingo Schwarze [Mon, 4 Jan 2016 12:36:26 +0000 (12:36 +0000)]
Don't retain the search query in the resulting manual links.
Clean, simple URLs are best.
Patch from bentley@.

9 years agoremove NULL-checks before free(); from mmcc@
Ingo Schwarze [Wed, 23 Dec 2015 20:50:13 +0000 (20:50 +0000)]
remove NULL-checks before free(); from mmcc@

9 years agopledge(2) style:
Ingo Schwarze [Tue, 15 Dec 2015 17:38:45 +0000 (17:38 +0000)]
pledge(2) style:
Make sure to always use the idiom 'if (pledge("'
such that it can easily be searched for.
No functional change.
Requested by deraadt@ some time ago.

9 years agoNo point in trying to go on when elementary database operations
Ingo Schwarze [Thu, 26 Nov 2015 07:42:11 +0000 (07:42 +0000)]
No point in trying to go on when elementary database operations
like preparing queries or binding variables fail; that won't yield
useful results anyway but may generate huge pointless error messages.
Issue reported by deraadt@.

9 years agoFix multiple issues regarding process group and signal mask handling
Ingo Schwarze [Fri, 20 Nov 2015 21:59:54 +0000 (21:59 +0000)]
Fix multiple issues regarding process group and signal mask handling
found by tb@ and millert@; parts of the code, in particular in tag.c,
by millert@; OK millert@.

9 years agoFix an issue reported by deraadt@: When hitting Ctrl-Backslash (= SIGQUIT)
Ingo Schwarze [Sat, 14 Nov 2015 23:57:47 +0000 (23:57 +0000)]
Fix an issue reported by deraadt@:  When hitting Ctrl-Backslash (= SIGQUIT)
in the less(1) spawned by man(1), man(1) died uncleanly, leaving behind
its temp files, and killed less(1) uncleanly as well with SIGPIPE,
leaving the terminal in the wrong state.

Fix this by giving less(1) its own process group and handing it
control of the terminal, but in such a way that Ctrl-z (= SIGSTOP)
still works: In that case, let man(1) stop itself, too, and let it
continue the pager when it continues itself.

Joint work with millert@ who contributed most of the expertise
required, and also most parts of the code.
OK deraadt@ millert@

9 years agoSimplify the logic in mandoc_normdate() and add some comments.
Ingo Schwarze [Thu, 12 Nov 2015 22:44:27 +0000 (22:44 +0000)]
Simplify the logic in mandoc_normdate() and add some comments.
Also add a comment in time2a() explaining why it isn't possible
to use just one single call to strftime().
Do some style cleanup while here.
No functional change.
Triggered by a very different patch from des@FreeBSD.

9 years agoNever use LC_ALL. On the one hand, it can cause misformatting.
Ingo Schwarze [Thu, 12 Nov 2015 21:50:03 +0000 (21:50 +0000)]
Never use LC_ALL.  On the one hand, it can cause misformatting.
On the other hand, it is a security risk because it might cause
buffer overflows.  Use LC_CTYPE only, that's all we need.

9 years agomove compat_reallocarray.o into SOELIM_OBJS, no functional change
Ingo Schwarze [Sat, 7 Nov 2015 21:53:14 +0000 (21:53 +0000)]
move compat_reallocarray.o into SOELIM_OBJS, no functional change

9 years agosoelim(1) use getline(3) and err(3), and err(3) uses getprogname(3);
Ingo Schwarze [Sat, 7 Nov 2015 21:38:28 +0000 (21:38 +0000)]
soelim(1) use getline(3) and err(3), and err(3) uses getprogname(3);
found on Solaris 10 at OpenCSW

9 years agoThe sh(1) "test" builtin on Solaris 10 doesn't have -e,
Ingo Schwarze [Sat, 7 Nov 2015 21:31:22 +0000 (21:31 +0000)]
The sh(1) "test" builtin on Solaris 10 doesn't have -e,
even though that's required by POSIX.
Use -w and -r, that's just as good.

9 years agoprovide a simple stand-alone implementation of getline(3)
Ingo Schwarze [Sat, 7 Nov 2015 20:52:52 +0000 (20:52 +0000)]
provide a simple stand-alone implementation of getline(3)
for systems lacking it

9 years agoModernization, no functional change intended:
Ingo Schwarze [Sat, 7 Nov 2015 17:58:55 +0000 (17:58 +0000)]
Modernization, no functional change intended:
Use the POSIX function getline(3) rather than the slightly
dangerous BSD function fgetln(3).
Remove the related compatibility code.

9 years agoWithout HAVE_ERR, don't try to include <err.h>, it probably isn't there.
Ingo Schwarze [Sat, 7 Nov 2015 14:22:29 +0000 (14:22 +0000)]
Without HAVE_ERR, don't try to include <err.h>, it probably isn't there.
In that case, the required prototypes are in "config.h".
Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.

9 years agoIn private header files, __BEGIN_DECLS and __END_DECLS are pointless.
Ingo Schwarze [Sat, 7 Nov 2015 14:01:16 +0000 (14:01 +0000)]
In private header files, __BEGIN_DECLS and __END_DECLS are pointless.
Because these work slightly differently on different systems,
they are becoming a maintenance burden in the portable version,
so delete them.

Besides, one of the chief design goals of the mandoc toolbox is to
make sure that nothing related to documentation requires C++.
Consequently, linking mandoc against any kind of C++ program would
defeat the purpose and is not supported.
I don't understand why kristaps@ added them in the first place.

9 years agogarbage collect unused EXAMPLEDIR, forgotten in the CSS cleanup;
Ingo Schwarze [Sat, 7 Nov 2015 13:14:21 +0000 (13:14 +0000)]
garbage collect unused EXAMPLEDIR, forgotten in the CSS cleanup;
noticed by Peter Bray <pdb_ml at yahoo dot com dot au>

9 years agoInstall the soelim(1) binary and manual to the right places.
Ingo Schwarze [Sat, 7 Nov 2015 13:05:14 +0000 (13:05 +0000)]
Install the soelim(1) binary and manual to the right places.
Bug reported by Peter Bray <pdb_ml at yahoo dot com dot au>.

9 years agoIn ./configure, select a RE syntax for word boundaries supported by libc;
Ingo Schwarze [Fri, 6 Nov 2015 21:19:09 +0000 (21:19 +0000)]
In ./configure, select a RE syntax for word boundaries supported by libc;
issue reported by Svyatoslav Mishyn, Peter Bray, and Daniel Levai.

9 years agomerge pledge(2) support from OpenBSD
Ingo Schwarze [Fri, 6 Nov 2015 17:33:34 +0000 (17:33 +0000)]
merge pledge(2) support from OpenBSD

9 years agoUse getprogname(3) rather than __progname.
Ingo Schwarze [Fri, 6 Nov 2015 16:30:33 +0000 (16:30 +0000)]
Use getprogname(3) rather than __progname.
Suggested by Joerg@ Sonnenberger (NetBSD).
Last year, deraadt@ confirmed on tech@ that this "has the potential
to be more portable", and micro-optimizing for speed is not relevant
here.  Also gets rid of one global variable.

9 years agoUse include files "header.html" and "footer.html" rather than a
Ingo Schwarze [Thu, 5 Nov 2015 20:55:41 +0000 (20:55 +0000)]
Use include files "header.html" and "footer.html" rather than a
compiled-in string.  This is not a security risk, we read the file
manpath.conf from the same directory, anyway.  No error handling
is needed; even if the files are absent, that's not an error.

This is more flexible without causing complication of the code or
the user interface.  It helps the upcoming revamp of the online
manual pages on man.NetBSD.org.

Based on an idea by Jean-Yves Migeon <jeanyves dot migeon at free dot fr>,
but implemented in a much simpler way.

9 years agoUnify the three stylesheets into a single CSS file.
Ingo Schwarze [Thu, 5 Nov 2015 17:47:51 +0000 (17:47 +0000)]
Unify the three stylesheets into a single CSS file.
Many thanks to bentley@ for doing this work.

9 years agodemandoc(1) needs to link against -lutil, too
Ingo Schwarze [Thu, 5 Nov 2015 17:16:34 +0000 (17:16 +0000)]
demandoc(1) needs to link against -lutil, too

9 years agoremove a stray iso-latin-1 character; noticed by bentley@
Ingo Schwarze [Thu, 5 Nov 2015 16:58:20 +0000 (16:58 +0000)]
remove a stray iso-latin-1 character; noticed by bentley@

9 years agospecify option ordering in the DESCRIPTION section;
Ingo Schwarze [Thu, 5 Nov 2015 12:06:45 +0000 (12:06 +0000)]
specify option ordering in the DESCRIPTION section;
from guenther@, ok and tweaks jmc@

9 years agoIf a .Bd block has no arguments at all, drop the block and only keep
Ingo Schwarze [Fri, 30 Oct 2015 19:04:16 +0000 (19:04 +0000)]
If a .Bd block has no arguments at all, drop the block and only keep
its contents.  Removing a gratuitious difference to groff output
found after a related bug report from krw@.

9 years agoDo not access a NULL pointer when a .Bd macro has no arguments at all.
Ingo Schwarze [Fri, 30 Oct 2015 18:53:54 +0000 (18:53 +0000)]
Do not access a NULL pointer when a .Bd macro has no arguments at all.
Bug reported by krw@.

9 years agoapply bold and italic to all non-ASCII Unicode codepoints,
Ingo Schwarze [Fri, 23 Oct 2015 14:50:58 +0000 (14:50 +0000)]
apply bold and italic to all non-ASCII Unicode codepoints,
fixing input like \fB\('e; issue reported by bentley@

9 years agouse the new function man_validate() here, too
Ingo Schwarze [Thu, 22 Oct 2015 22:06:43 +0000 (22:06 +0000)]
use the new function man_validate() here, too

9 years agomove man(7) validation into the dedicated validation phase, too
Ingo Schwarze [Thu, 22 Oct 2015 21:54:23 +0000 (21:54 +0000)]
move man(7) validation into the dedicated validation phase, too

9 years agoIf no output device was allocated because no file wanted to produce output,
Ingo Schwarze [Thu, 22 Oct 2015 21:03:43 +0000 (21:03 +0000)]
If no output device was allocated because no file wanted to produce output,
refrain from dereferencing a NULL pointer during final deallocation.
Fixing a recent regression reported by czarkoff@

9 years agoMove all mdoc(7) node validation done before child parsing
Ingo Schwarze [Wed, 21 Oct 2015 23:51:11 +0000 (23:51 +0000)]
Move all mdoc(7) node validation done before child parsing
to the new separate validation pass, except for a tiny bit
needed by the parser which goes to the new mdoc_state() module;
cleaner, simpler, and surprisingly also shorter by 15 lines.

9 years agoIn order to become able to generate syntax tree nodes on the roff(7)
Ingo Schwarze [Tue, 20 Oct 2015 02:01:31 +0000 (02:01 +0000)]
In order to become able to generate syntax tree nodes on the roff(7)
level, validation must be separated from parsing and rewinding.
This first big step moves calling of the mdoc(7) post_*() functions
out of the parser loop into their own mdoc_validate() pass, while
using a new mdoc_state() module to make syntax tree state handling
available to both the parser loop and the validation pass.

9 years agostyle cleanup, no functional change
Ingo Schwarze [Mon, 19 Oct 2015 20:04:10 +0000 (20:04 +0000)]
style cleanup, no functional change

9 years agoSimplify, no functional change:
Ingo Schwarze [Mon, 19 Oct 2015 19:51:22 +0000 (19:51 +0000)]
Simplify, no functional change:
Delete the outmdoc, outman, and outfree function pointers.

9 years agoincluding <ohash.h> requires including <stdint.h> beforehand;
Ingo Schwarze [Mon, 19 Oct 2015 18:58:47 +0000 (18:58 +0000)]
including <ohash.h> requires including <stdint.h> beforehand;
noticed by Svyatoslav Mishyn <juef at openmailbox dot org>

9 years agoVery tricky diff to fix macro interpretation and spacing around tabs
Ingo Schwarze [Sat, 17 Oct 2015 00:21:07 +0000 (00:21 +0000)]
Very tricky diff to fix macro interpretation and spacing around tabs
in .Bl -column; it took me more than a day to get this right.
Triggered by a loosely related bug report from tim@.

The lesson for you is:  Use .Ta macros in .Bl -column, avoid tabs,
or you are in for surprises:  The last word before a tab is not
interpreted as a macro (unless there is a blank in between), the
first word after a tab isn't either (unless there is a blank in
between), and a blank after a tab causes a leading blank in the
respective output cell.  Yes, "blank", "tab", "blank tab" and "tab
blank" all have different semantics; if you write code relying on
that, good luck maintaining it afterwards...

9 years agoDelete two preprocessor constants that are no longer used.
Ingo Schwarze [Thu, 15 Oct 2015 23:35:55 +0000 (23:35 +0000)]
Delete two preprocessor constants that are no longer used.
Patch from Michael Reed <m dot reed at mykolab dot com>.

9 years agoSimplify the part of args() that is handling .Bl -column phrases:
Ingo Schwarze [Thu, 15 Oct 2015 22:45:43 +0000 (22:45 +0000)]
Simplify the part of args() that is handling .Bl -column phrases:
Delete manual "Ta" handling because macro handling should
not be done in an argument parser but should be left to the
macro parsers, which exist anyway and work well.
No functional change, minus 40 lines of code.

Confusing and redundant code found while investigating
an old bug report from tim@.

9 years agoWhen blk_full() handles an .It line in .Bl -column and indirectly
Ingo Schwarze [Thu, 15 Oct 2015 22:27:24 +0000 (22:27 +0000)]
When blk_full() handles an .It line in .Bl -column and indirectly
calls phrase_ta() to handle a .Ta child macro, advance the body
pointer accordingly, such that a subsequent tab character rewinds
the right body block and doesn't fail an assertion.  That happened
when there was nothing between the .Ta and the tab character.
Bug reported by tim@ some time ago.

9 years agoReject the escape sequences \[uD800] to \[uDFFF] in the parser.
Ingo Schwarze [Tue, 13 Oct 2015 23:30:50 +0000 (23:30 +0000)]
Reject the escape sequences \[uD800] to \[uDFFF] in the parser.
These surrogates are not valid Unicode codepoints,
so treat them just like any other undefined character escapes:
Warn about them and do not produce output.
Issue noticed while talking to stsp@, semarie@, and bentley@.

9 years agoMajor character table cleanup:
Ingo Schwarze [Tue, 13 Oct 2015 22:59:54 +0000 (22:59 +0000)]
Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table.
* Make the character table static in the chars.c module:
There is no need to pass a pointer around, we most certainly
never want to use two different character tables concurrently.
* No need to keep the characters in a separate file chars.in;
that merely encourages downstream porters to mess with them.
* Sort the characters to agree with the mandoc_chars(7) manual page.
* Specify Unicode codepoints in hex, not decimal (that's the detail
that originally triggered this patch).
No functional change, minus 100 LOC, and i don't see a performance change.

9 years agoReduce the amount of code by moving the three copies of the ohash
Ingo Schwarze [Tue, 13 Oct 2015 15:53:05 +0000 (15:53 +0000)]
Reduce the amount of code by moving the three copies of the ohash
callback functions into one common place, preparing for the use of
ohash for some additional purposes.  No functional change.

9 years agoDelete an assignment that is unconditionally overwritten two lines later;
Ingo Schwarze [Mon, 12 Oct 2015 21:26:02 +0000 (21:26 +0000)]
Delete an assignment that is unconditionally overwritten two lines later;
found by Svyatoslav Mishyn <juef at openmailbox dot org>
with the clang static analyzer.

9 years agoGarbage collect an unused variable, no functional change;
Ingo Schwarze [Mon, 12 Oct 2015 21:17:15 +0000 (21:17 +0000)]
Garbage collect an unused variable, no functional change;
found by Svyatoslav Mishyn <juef at openmailbox dot org> with cppcheck.

9 years agoCheck the right pointer against NULL;
Ingo Schwarze [Mon, 12 Oct 2015 21:09:54 +0000 (21:09 +0000)]
Check the right pointer against NULL;
fixing a pasto introduced in the previous commit;
found by Svyatoslav Mishyn <juef at openmailbox dot org> with cppcheck.

9 years agoUse "-" rather than "\(hy" for the heads of .Bl -dash and -hyphen lists.
Ingo Schwarze [Mon, 12 Oct 2015 15:29:35 +0000 (15:29 +0000)]
Use "-" rather than "\(hy" for the heads of .Bl -dash and -hyphen lists.
In UTF-8 output, that renders as ASCII HYPHEN-MINUS (U+002D)
rather than HYPHEN (U+2010), which looks better and matches groff.
In ASCII output, it makes no difference.
Suggested by naddy@.

9 years agoClear dform and dsec when exiting a first-level directory in treescan().
Ingo Schwarze [Mon, 12 Oct 2015 00:32:55 +0000 (00:32 +0000)]
Clear dform and dsec when exiting a first-level directory in treescan().
Fixes a segfault reported by bentley@.
While here, do some style cleanup in the same function.

9 years agoFix an obvious bug found during the /* FALLTHROUGH */ cleanup:
Ingo Schwarze [Mon, 12 Oct 2015 00:15:31 +0000 (00:15 +0000)]
Fix an obvious bug found during the /* FALLTHROUGH */ cleanup:
ASCII_NBRSP has to be rendered as "&nbsp;", not "-".

9 years agoTo make the code more readable, delete 283 /* FALLTHROUGH */ comments
Ingo Schwarze [Mon, 12 Oct 2015 00:08:15 +0000 (00:08 +0000)]
To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

9 years agoDrop tags containing a blank character:
Ingo Schwarze [Sun, 11 Oct 2015 22:00:52 +0000 (22:00 +0000)]
Drop tags containing a blank character:
They don't work, they break other tags in weird ways, and even
if they could be made to work, they would be mostly useless.
Issue reported by naddy@, thanks.

9 years agoFinally use __progname, err(3) and warn(3).
Ingo Schwarze [Sun, 11 Oct 2015 21:12:54 +0000 (21:12 +0000)]
Finally use __progname, err(3) and warn(3).
That's more readable and less error-prone than fumbling around
with argv[0], fprintf(3), strerror(3), perror(3), and exit(3).

It's a bad idea to boycott good interfaces merely because standards
committees ignore them.  Instead, let's provide compatibility modules
for archaic systems (like commercial Solaris) that still don't have
them.  The compat module has an UCB Copyright (c) 1993...

9 years agoMention that the first argument of .Pf does not need escaping.
Ingo Schwarze [Sun, 11 Oct 2015 18:56:51 +0000 (18:56 +0000)]
Mention that the first argument of .Pf does not need escaping.
While here, make the first sentence regarding .Pf more concise.
OK jmc@

9 years agoDecide whether to use_pager as early as possible,
Ingo Schwarze [Sat, 10 Oct 2015 13:21:18 +0000 (13:21 +0000)]
Decide whether to use_pager as early as possible,
in preparation for pledge(2); no functional change intended.

9 years agomodernize style: "return" is not a function
Ingo Schwarze [Tue, 6 Oct 2015 18:32:19 +0000 (18:32 +0000)]
modernize style: "return" is not a function

9 years agoimprove wording and start a new sentence on a new line; from jmc@
Ingo Schwarze [Tue, 6 Oct 2015 15:33:29 +0000 (15:33 +0000)]
improve wording and start a new sentence on a new line; from jmc@

9 years agoTheo found a stray blank in HTML output.
Ingo Schwarze [Tue, 29 Sep 2015 18:45:36 +0000 (18:45 +0000)]
Theo found a stray blank in HTML output.

9 years agobriefly document -T tree output
Ingo Schwarze [Sat, 26 Sep 2015 12:56:04 +0000 (12:56 +0000)]
briefly document -T tree output

9 years agoShow the flags MDOC_DELIMO, MDOC_DELIMC, MDOC_EOS, and MAN_EOS.
Ingo Schwarze [Sat, 26 Sep 2015 12:55:16 +0000 (12:55 +0000)]
Show the flags MDOC_DELIMO, MDOC_DELIMC, MDOC_EOS, and MAN_EOS.
Drop the "block-" prefixes from the node type names.

9 years ago/* NOTREACHED */ after abort() is silly, delete it
Ingo Schwarze [Sat, 26 Sep 2015 00:54:03 +0000 (00:54 +0000)]
/* NOTREACHED */ after abort() is silly, delete it

9 years agoresolve code duplication and do style cleanup in mdoc_nm_pre(),
Ingo Schwarze [Sat, 26 Sep 2015 00:32:35 +0000 (00:32 +0000)]
resolve code duplication and do style cleanup in mdoc_nm_pre(),
no functional change

9 years agoFix multiple aspects of SYNOPSIS .Nm formatting:
Ingo Schwarze [Sat, 26 Sep 2015 00:22:07 +0000 (00:22 +0000)]
Fix multiple aspects of SYNOPSIS .Nm formatting:
* Don't break lines before non-block .Nm elements.
* Use proper <b> markup for the heads of .Nm blocks.
* Make the width measurements work by doing them on the head children.

9 years agotypos; found and fixed by sobrado@
Ingo Schwarze [Thu, 24 Sep 2015 18:41:22 +0000 (18:41 +0000)]
typos; found and fixed by sobrado@

9 years agoTrailing whitespace is significant when determining the width of a tag
Ingo Schwarze [Mon, 21 Sep 2015 13:25:00 +0000 (13:25 +0000)]
Trailing whitespace is significant when determining the width of a tag
in mdoc(7) .Bl -tag and man(7) .TP, but not in man(7) .IP.
Quirk reported by Jan Stary <hans at stare dot cz> on ports@.

9 years agono more _subdir; Jan Stary <hans at stare dot cz>
Ingo Schwarze [Mon, 21 Sep 2015 09:59:02 +0000 (09:59 +0000)]
no more _subdir; Jan Stary <hans at stare dot cz>

9 years agofor portability, use (char *)NULL in execlp(3) as discussed on tech@ OpenBSD
Ingo Schwarze [Wed, 16 Sep 2015 09:50:29 +0000 (09:50 +0000)]
for portability, use (char *)NULL in execlp(3) as discussed on tech@ OpenBSD
(didn't blow up anywhere yet, but better safe than sorry)

9 years agoAvoid .Ns right after .Pf, it's pointless.
Ingo Schwarze [Mon, 14 Sep 2015 20:10:19 +0000 (20:10 +0000)]
Avoid .Ns right after .Pf, it's pointless.

9 years agoRemove the warning about children of .Vt blocks because actually,
Ingo Schwarze [Mon, 14 Sep 2015 15:36:14 +0000 (15:36 +0000)]
Remove the warning about children of .Vt blocks because actually,
.Vt type global_variable No = Dv defined_constant ;
is the best way to specify in the SYNOPSIS how a global variable
is initialized in the rare case where that matters.
Issue noticed by jmc@.