]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
9 years agoimplement tagging for .Er
Ingo Schwarze [Sat, 25 Jul 2015 14:23:08 +0000 (14:23 +0000)]
implement tagging for .Er

9 years agobasic tag support for function names; written at YYC
Ingo Schwarze [Sat, 25 Jul 2015 14:18:04 +0000 (14:18 +0000)]
basic tag support for function names; written at YYC

9 years agobasic support for tag priorities; written at YYC
Ingo Schwarze [Sat, 25 Jul 2015 14:02:06 +0000 (14:02 +0000)]
basic support for tag priorities; written at YYC

9 years agoWhen creation of the temporary tags file fails, call the pager
Ingo Schwarze [Tue, 21 Jul 2015 03:26:21 +0000 (03:26 +0000)]
When creation of the temporary tags file fails, call the pager
without the -T option, because otherwise the pager won't even start.
Fixing a bug reported by jca@.

While here, shorten the code by two lines
and delete one internal interface function.

9 years agoDo not fork and exec gunzip(1), just link with libz instead.
Ingo Schwarze [Sun, 19 Jul 2015 06:05:16 +0000 (06:05 +0000)]
Do not fork and exec gunzip(1), just link with libz instead.
As discussed with deraadt@, that's cleaner and will help tame(2).
Something like this was also suggested earlier by bapt at FreeBSD.
Minus 50 lines of code, deleting one interface function (mparse_wait),
no functional change intended.

9 years agoIf we aren't on a tty, clear the pager flag up front.
Ingo Schwarze [Sun, 19 Jul 2015 00:07:42 +0000 (00:07 +0000)]
If we aren't on a tty, clear the pager flag up front.
Just to clean up code structure, no functional change.

9 years agoInsist that manual page file name extensions must begin with a digit,
Ingo Schwarze [Sat, 18 Jul 2015 05:47:32 +0000 (05:47 +0000)]
Insist that manual page file name extensions must begin with a digit,
lest pkg.conf(5) be shown when pkg(5) is asked for;
issue reported by Michael Reed <m dot reed at mykolab dot com>.

9 years agoanother portability todo
Ingo Schwarze [Sat, 18 Jul 2015 03:43:51 +0000 (03:43 +0000)]
another portability todo

9 years agoclean up the temporary file when the process dies from a signal
Ingo Schwarze [Sat, 18 Jul 2015 03:41:37 +0000 (03:41 +0000)]
clean up the temporary file when the process dies from a signal

9 years agoInitial, still somewhat experimental implementation to leverage
Ingo Schwarze [Fri, 17 Jul 2015 22:38:29 +0000 (22:38 +0000)]
Initial, still somewhat experimental implementation to leverage
less(1) -T and :t ctags(1)-like functionality to jump to the
definitions of various terms inside manual pages.
To be polished in the tree, so bear with me and report issues.

Technically, if less(1) is used as a pager, information is collected
by the mdoc(7) terminal formatter, first stored using the ohash
library, then ultimately written to a temporary file which is passed
to less via -T.  No change intended for other output formatters or
when running without a pager.

Based on an idea from Kristaps using feedback from many, in particular
phessler@ nicm@ millert@ halex@ doug@ kspillner@ deraadt@.

9 years agoFix the "depend" target and regenerate Makefile.depend:
Ingo Schwarze [Tue, 14 Jul 2015 23:16:29 +0000 (23:16 +0000)]
Fix the "depend" target and regenerate Makefile.depend:
* do not process the test-*.c files, they are not built via make
* add the missing compat_stringlist.c and soelim.c
* read.c now uses roff_int.h
* roff.c no longer uses libmdoc.h

9 years agoheaders should not contain macros
Ingo Schwarze [Tue, 14 Jul 2015 19:40:05 +0000 (19:40 +0000)]
headers should not contain macros

9 years agoIgnore blank characters at the beginning of a conditional block,
Ingo Schwarze [Sat, 27 Jun 2015 13:29:14 +0000 (13:29 +0000)]
Ignore blank characters at the beginning of a conditional block,
that is, after "\{".
Issue found by Markus <Waldeck at gmx dot de> in bash(1).

9 years agodelete some TODO entries that were already fixed
Ingo Schwarze [Fri, 26 Jun 2015 16:56:18 +0000 (16:56 +0000)]
delete some TODO entries that were already fixed

9 years agonice idea for eqn(7) from CDBUG.
Ingo Schwarze [Thu, 18 Jun 2015 01:02:16 +0000 (01:02 +0000)]
nice idea for eqn(7) from CDBUG.

9 years agotwo new tasks i heard about at BSDCan
Ingo Schwarze [Wed, 10 Jun 2015 22:26:19 +0000 (22:26 +0000)]
two new tasks i heard about at BSDCan

9 years agoAvoid warning "defined but not used" when compiling with HAVE_MANPATH.
Ingo Schwarze [Wed, 10 Jun 2015 19:26:13 +0000 (19:26 +0000)]
Avoid warning "defined but not used" when compiling with HAVE_MANPATH.
Issue found on Debian by Markus <Waldeck at gmx dot de>.

9 years agoAvoid warning "unused variable" when compiling without HAVE_WCHAR.
Ingo Schwarze [Wed, 10 Jun 2015 19:17:15 +0000 (19:17 +0000)]
Avoid warning "unused variable" when compiling without HAVE_WCHAR.
Issue found on Debian by Markus <Waldeck at gmx dot de>.

9 years agoImplement the roff(7) `r' (register exists) conditional.
Ingo Schwarze [Sun, 31 May 2015 23:13:22 +0000 (23:13 +0000)]
Implement the roff(7) `r' (register exists) conditional.
Missing feature found by Markus <Waldeck at gmx dot de>
in Debian's bash(1) manual page.

9 years agoThis one needs config.h too, if only for __BEGIN_DECLS.
Ingo Schwarze [Thu, 21 May 2015 00:18:52 +0000 (00:18 +0000)]
This one needs config.h too, if only for __BEGIN_DECLS.
Found on Solaris 11 in the OpenCSW cluster.

9 years agoadd forgotten glue
Ingo Schwarze [Thu, 21 May 2015 00:13:43 +0000 (00:13 +0000)]
add forgotten glue

9 years agoLink compat_reallocarray.o into soelim; needed on
Ingo Schwarze [Thu, 21 May 2015 00:04:38 +0000 (00:04 +0000)]
Link compat_reallocarray.o into soelim; needed on
platforms having neither stringlist nor compat_reallocarray.

9 years agoRemove clauses 3 and 4 from Christos Zoulas' BSD license.
Ingo Schwarze [Wed, 20 May 2015 23:43:03 +0000 (23:43 +0000)]
Remove clauses 3 and 4 from Christos Zoulas' BSD license.
This is safe because Christos did that himself in NetBSD in 2008.
No code change.

9 years agofix integer overflows by using reallocarray(3)
Ingo Schwarze [Wed, 20 May 2015 23:00:43 +0000 (23:00 +0000)]
fix integer overflows by using reallocarray(3)

9 years ago* fix roff terminology in .Nd
Ingo Schwarze [Wed, 20 May 2015 22:59:12 +0000 (22:59 +0000)]
* fix roff terminology in .Nd
* remove .Xr to self
* add AUTHORS section

9 years agoUse PATH_MAX rather than the non-standard MAXPATHLEN.
Ingo Schwarze [Wed, 20 May 2015 22:57:22 +0000 (22:57 +0000)]
Use PATH_MAX rather than the non-standard MAXPATHLEN.

9 years ago* remove FreeBSDisms
Ingo Schwarze [Wed, 20 May 2015 22:22:59 +0000 (22:22 +0000)]
* remove FreeBSDisms
* purge and sort headers
* add build and compat glue
* and LICENSE information
for soelim(1)

9 years agoInitial revision
Ingo Schwarze [Wed, 20 May 2015 20:55:04 +0000 (20:55 +0000)]
Initial revision

9 years agoDo not let the -m option or MANPATH with leading, trailing, or double
Ingo Schwarze [Thu, 7 May 2015 12:08:13 +0000 (12:08 +0000)]
Do not let the -m option or MANPATH with leading, trailing, or double
colon override the default manpath, let them add to the default manpath.
Only override the default manpath by the -M option, by MANPATH without
leading, trailing, or double colon, or by "manpath" in man.conf(5).

Problem reported by Jan Stary <hans at stare dot cz>.
Patch OK'ed by millert@.

9 years agomdoc_valid_post() may indirectly call roff_node_unlink() which may
Ingo Schwarze [Fri, 1 May 2015 16:58:33 +0000 (16:58 +0000)]
mdoc_valid_post() may indirectly call roff_node_unlink() which may
set ROFF_NEXT_CHILD, which is desirable for the final call to
mdoc_valid_post() - in case the target itself gets deleted, the
parse point may need this adjustment - but not for the intermediate
calls - if intermediate nodes get deleted, that mustn't clobber the
parse point.  So move setting ROFF_NEXT_SIBLING to the proper place
in rew_last().

This fixes the assertion failure in jsg@'s afl test case 108/Apr27.

9 years agoSetting the "last" member of struct roff_node was done at an extremely
Ingo Schwarze [Fri, 1 May 2015 16:02:47 +0000 (16:02 +0000)]
Setting the "last" member of struct roff_node was done at an extremely
weird place.  Move it to the obviously correct place.
Surprisingly, this didn't cause any misformatting in the test suite
or in any base system manuals, but i cannot believe the code was
really correct for all conceivable input, and it would be very hard
to verify.  At the very least, it cannot have worked for man(7).

9 years agoMinor bug fix: When .Pp rewinds .Nm, rewind the whole block,
Ingo Schwarze [Fri, 1 May 2015 15:27:54 +0000 (15:27 +0000)]
Minor bug fix:  When .Pp rewinds .Nm, rewind the whole block,
not just the body.  In some unusual edge cases, this caused
the .Pp to become a sibling of the .Nm body inside the .Nm block.

9 years agoIf a block body gets broken, that's no good reason to extend the
Ingo Schwarze [Wed, 29 Apr 2015 21:58:32 +0000 (21:58 +0000)]
If a block body gets broken, that's no good reason to extend the
scope of the end macro.  Instead, only keep the tail scope open if
the end macro macro calls an explicit macro and actually breaks
that.  This corrects syntax tree structure and fixes an assertion
found by jsg@ with afl (test case 098/Apr27).

9 years agoReplace the kludge for the \z escape sequence by an actual
Ingo Schwarze [Wed, 29 Apr 2015 18:35:00 +0000 (18:35 +0000)]
Replace the kludge for the \z escape sequence by an actual
implementation.  As a side effect, minus ten lines of code.

As another side effect, this also fixes the assertion failure that
used to be triggered by "\z\o'ab'c" at the beginning of an output
line, found by jsg@ with afl (test case 022/Apr27).

9 years agoDo not mark a block with the MDOC_BROKEN flag if it merely contains
Ingo Schwarze [Wed, 29 Apr 2015 14:48:53 +0000 (14:48 +0000)]
Do not mark a block with the MDOC_BROKEN flag if it merely contains
a mismatching explicit end macro without actually being broken.
Avoids a subsequent upward search for the non-existent breaker
ending up in a NULL pointer access; afl test case 005/Apr27 from jsg@.

9 years agoWhen the last line of a table layout turns out to be empty, it is deleted.
Ingo Schwarze [Wed, 29 Apr 2015 12:44:58 +0000 (12:44 +0000)]
When the last line of a table layout turns out to be empty, it is deleted.
Do not just free the struct tbl_row but also make sure that no pointer
to it remains.  Fixing a use after free found by jsg@ with afl.

9 years agoImprove the error message in case somebody has configured an invalid PAGER.
Ingo Schwarze [Wed, 29 Apr 2015 11:04:17 +0000 (11:04 +0000)]
Improve the error message in case somebody has configured an invalid PAGER.
Suggested by Lorenzo Beretta <lory dot fulgi at infinito dot it>.

9 years agoFix the HAVE_MANPATH case, got broken in rev. 1.23.
Ingo Schwarze [Tue, 28 Apr 2015 16:13:45 +0000 (16:13 +0000)]
Fix the HAVE_MANPATH case, got broken in rev. 1.23.
Patch from Steffen Nurpmeso <sdaoden at yandex dot com>, thanks.

9 years agoUnify mdoc_deroff() and man_deroff() into a common function deroff().
Ingo Schwarze [Thu, 23 Apr 2015 16:17:44 +0000 (16:17 +0000)]
Unify mdoc_deroff() and man_deroff() into a common function deroff().
No functional change except that for mdoc(7), it now skips leading
escape sequences just like it already did for man(7).
Escape sequences rarely occur in mdoc(7) code and if they do,
skipping them is an improvement in this context.
Minus 30 lines of code.

9 years agoGet rid of two empty wrapper functions. No functional change.
Ingo Schwarze [Thu, 23 Apr 2015 15:35:59 +0000 (15:35 +0000)]
Get rid of two empty wrapper functions.  No functional change.

9 years agoAvoid a use after free when the target node is deleted during validation.
Ingo Schwarze [Tue, 21 Apr 2015 16:14:25 +0000 (16:14 +0000)]
Avoid a use after free when the target node is deleted during validation.
Bug reported by jsg@.

9 years agoFix previous: Don't let man(1) warn twice about non-existant names.
Ingo Schwarze [Mon, 20 Apr 2015 09:54:48 +0000 (09:54 +0000)]
Fix previous:  Don't let man(1) warn twice about non-existant names.
Again noticed by deraadt@.

9 years agoAvoid out-of-bounds read access before the beginning of the
Ingo Schwarze [Mon, 20 Apr 2015 09:48:53 +0000 (09:48 +0000)]
Avoid out-of-bounds read access before the beginning of the
mdoc_macros[] array.  This sometimes prevented proper warnings
about text nodes preceding the first section header.

9 years agoMore than one data field may follow T} on the same input line.
Ingo Schwarze [Sun, 19 Apr 2015 20:35:20 +0000 (20:35 +0000)]
More than one data field may follow T} on the same input line.
Issue found by Christian Neukirchen <chneukirchen at gmail dot com>
in the socket(2) manual on Linux.
Also fixes major rendering bugs (including partial loss of content)
in XkbChangeControls(3), XkbFreeClientMap(3), XkbGetMap(3),
XkbKeyNumGroups(3), and XkbSetMap(3).

9 years agoIf an explicit line break request (.br or .sp) occurs within an .HP block,
Ingo Schwarze [Sun, 19 Apr 2015 19:44:21 +0000 (19:44 +0000)]
If an explicit line break request (.br or .sp) occurs within an .HP block,
the next line doesn't hang, but is simply indented.
Issue found by Christian Neukirchen <chneukirchen at gmail dot com>
in the dmsetup(8) manual on Linux.
This patch also improves the indentation of XDGA(3) and XrmGetResource(3).

9 years agoIf apropos(1) finds no match, print "nothing appropriate" to stderr
Ingo Schwarze [Sun, 19 Apr 2015 15:10:46 +0000 (15:10 +0000)]
If apropos(1) finds no match, print "nothing appropriate" to stderr
similar to what the old apropos did.
Requested by and OK deraadt@.

9 years agoUnify trickier node handling functions.
Ingo Schwarze [Sun, 19 Apr 2015 14:57:38 +0000 (14:57 +0000)]
Unify trickier node handling functions.
* man_elem_alloc() -> roff_elem_alloc()
* man_block_alloc() -> roff_block_alloc()
The functions mdoc_elem_alloc() and mdoc_block_alloc() remain for
now because they need to do mdoc(7)-specific argument processing.

9 years agoUnify some node handling functions that use TOKEN_NONE.
Ingo Schwarze [Sun, 19 Apr 2015 14:25:41 +0000 (14:25 +0000)]
Unify some node handling functions that use TOKEN_NONE.
* mdoc_word_alloc(), man_word_alloc() -> roff_word_alloc()
* mdoc_word_append(), man_word_append() -> roff_word_append()
* mdoc_addspan(), man_addspan() -> roff_addtbl()
* mdoc_addeqn(), man_addeqn() -> roff_addeqn()
Minus 50 lines of code, no functional change.

9 years agoDecouple the token code for "no request or macro" from the individual
Ingo Schwarze [Sun, 19 Apr 2015 14:00:19 +0000 (14:00 +0000)]
Decouple the token code for "no request or macro" from the individual
high-level parsers to allow further unification of functions that
only need to recognize this code, but that don't care about different
high-level macrosets beyond that.

9 years agoUnify node handling functions:
Ingo Schwarze [Sun, 19 Apr 2015 13:50:25 +0000 (13:50 +0000)]
Unify node handling functions:
* node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc()
* node_append() for mdoc and man_node_append() -> roff_node_append()
* mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc()
* mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc()
* mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink()
* mdoc_node_free() and man_node_free() -> roff_node_free()
* mdoc_node_delete() and man_node_delete() -> roff_node_delete()
Minus 130 lines of code, no functional change.

9 years agoDelete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),
Ingo Schwarze [Sat, 18 Apr 2015 17:53:21 +0000 (17:53 +0000)]
Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),
man_node() from the mandoc(3) semi-public interface and the internal
wrapper functions print_mdoc() and print_man() from the HTML formatters.
Minus 60 lines of code, no functional change.

9 years agoUnify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().
Ingo Schwarze [Sat, 18 Apr 2015 17:28:36 +0000 (17:28 +0000)]
Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().
Minus 80 lines of code, no functional change.
Written on the train from Koeln to Wolfsburg returning from p2k15.

9 years agoMove mdoc_hash_init() and man_hash_init() to libmandoc.h
Ingo Schwarze [Sat, 18 Apr 2015 17:01:58 +0000 (17:01 +0000)]
Move mdoc_hash_init() and man_hash_init() to libmandoc.h
and call them from mparse_alloc() and choose_parser(),
preparing unified allocation of struct roff_man.

9 years agoProfit from the unified struct roff_man and reduce the number of
Ingo Schwarze [Sat, 18 Apr 2015 16:34:25 +0000 (16:34 +0000)]
Profit from the unified struct roff_man and reduce the number of
arguments of mparse_result() by one.  No functional change.
Written on the ICE Bruxelles-Koeln on the way back from p2k15.

9 years agoReplace the structs mdoc and man by a unified struct roff_man.
Ingo Schwarze [Sat, 18 Apr 2015 16:06:39 +0000 (16:06 +0000)]
Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

9 years agolook at COHERENT troff
Ingo Schwarze [Sat, 18 Apr 2015 16:05:45 +0000 (16:05 +0000)]
look at COHERENT troff

9 years agoflorian want <img> tags for https://tlakh.xyz/p2k15.7.html
Ingo Schwarze [Thu, 16 Apr 2015 20:36:04 +0000 (20:36 +0000)]
florian want <img> tags for https://tlakh.xyz/p2k15.7.html

9 years agoRestore the page headers and page footers that accidentally got lost
Ingo Schwarze [Thu, 16 Apr 2015 20:22:27 +0000 (20:22 +0000)]
Restore the page headers and page footers that accidentally got lost
in rev. 1.225.  Regression reported by florian@.

9 years agoshorten "outdated mandoc.db" warning message; requested by deraadt@
Ingo Schwarze [Thu, 16 Apr 2015 16:36:21 +0000 (16:36 +0000)]
shorten "outdated mandoc.db" warning message; requested by deraadt@

9 years agoDo not mistreat empty arguments to font alternating macros
Ingo Schwarze [Mon, 6 Apr 2015 22:06:23 +0000 (22:06 +0000)]
Do not mistreat empty arguments to font alternating macros
as vertical spacing requests.  Bug found with xmahjongg(6).

9 years agoOn a new RS nesting level, the saved width starts from the default
Ingo Schwarze [Mon, 6 Apr 2015 14:59:21 +0000 (14:59 +0000)]
On a new RS nesting level, the saved width starts from the default
width, not from the saved width of the previous level.
Improves xterm(1) and XSetEventQueueOwner(3); found in transcode_filter(1).

9 years agoUse the default width for .RS without arguments.
Ingo Schwarze [Mon, 6 Apr 2015 13:35:08 +0000 (13:35 +0000)]
Use the default width for .RS without arguments.
Reduces groff-mandoc differences in base and Xenocara by about 4%.
Found while looking at wpa_supplicant(8).

9 years agoIf a partial explicit block extending to the next input line follows
Ingo Schwarze [Sun, 5 Apr 2015 23:04:41 +0000 (23:04 +0000)]
If a partial explicit block extending to the next input line follows
the end macro of a broken block, put all of it into the breaking block.
Needed for example by mutella(1).

9 years agoReduce code duplication, no functional change:
Ingo Schwarze [Sun, 5 Apr 2015 22:44:20 +0000 (22:44 +0000)]
Reduce code duplication, no functional change:
Both partial and full implicit blocks can break explicit blocks.
Put the code to handle both cases into a common function.

9 years agoArguments to end macros of broken partial explicit blocks
Ingo Schwarze [Sun, 5 Apr 2015 14:43:36 +0000 (14:43 +0000)]
Arguments to end macros of broken partial explicit blocks
must go inside the breaking block.  For example, in
.It Ic cmd Oo
.Ar optional_arg Oc Ar mandatory_arg
the mandatory_arg is still inside the .It block.
Used for example by mutella(1).

9 years agoallow using an alternate mandoc binary
Ingo Schwarze [Sun, 5 Apr 2015 09:30:24 +0000 (09:30 +0000)]
allow using an alternate mandoc binary

9 years agoGive man(7) section and subsection headers hanging indentation.
Ingo Schwarze [Sat, 4 Apr 2015 18:52:51 +0000 (18:52 +0000)]
Give man(7) section and subsection headers hanging indentation.
Reduces groff-mandoc differences in base by about 2.5% due to
various Perl manuals having long section titles.
Quirk found in argtable2(3).

9 years agoRounding rules for horizontal scaling widths are more complicated.
Ingo Schwarze [Sat, 4 Apr 2015 17:47:18 +0000 (17:47 +0000)]
Rounding rules for horizontal scaling widths are more complicated.
There is a first rounding to basic units on the input side.
After that, rounding rules differ between requests and macros.
Requests round to the nearest possible character position.
Macros round to the next character position to the left.

Implement that by changing the return value of term_hspan()
to basic units and leaving the second scaling and rounding stage
to the formatters instead of doing it in the terminal handler.

Improves for example argtable2(3).

9 years agoDon't allow breaking the output line after hyphens following escape
Ingo Schwarze [Sat, 4 Apr 2015 13:53:42 +0000 (13:53 +0000)]
Don't allow breaking the output line after hyphens following escape
sequences.  Improves tic(1), sxpm(1), and a few Perl manuals.
Quirk found by naddy@ in milter-greylist(8).

9 years agoFix a quirk with respect to empty .HP.
Ingo Schwarze [Sat, 4 Apr 2015 11:44:43 +0000 (11:44 +0000)]
Fix a quirk with respect to empty .HP.
Found while writing a regression test for man_macro.c rev. 1.66.
Incidentally, this brings rendering of XFreeEventData(3) closer to groff.

9 years agoVastly simplify man(7) block unwinding, similar to mdoc_macro.c 1.171.
Ingo Schwarze [Fri, 3 Apr 2015 23:19:15 +0000 (23:19 +0000)]
Vastly simplify man(7) block unwinding, similar to mdoc_macro.c 1.171.
Drop one enum type, two static functions, 70 lines of code.
Also fixes the mpeg_encode(1) manual reported broken by naddy@.

9 years agoIt turns out the man(7) parser suffers from unintelligible handling
Ingo Schwarze [Fri, 3 Apr 2015 17:00:52 +0000 (17:00 +0000)]
It turns out the man(7) parser suffers from unintelligible handling
of block rewinding, just like then mdoc(7) parser did.
First step in getting rid of rew_scope():
Replace the only call where the target block is known.
This commit is analogous to mdoc_macro.c rev. 1.167.
One down, three to go.

9 years agoportability: word boundaries in regular expressions
Ingo Schwarze [Fri, 3 Apr 2015 12:41:02 +0000 (12:41 +0000)]
portability: word boundaries in regular expressions

9 years agoNo need to hardcode /usr/bin/ as the path to more(1); helps portability.
Ingo Schwarze [Fri, 3 Apr 2015 08:46:17 +0000 (08:46 +0000)]
No need to hardcode /usr/bin/ as the path to more(1); helps portability.
We don't hardcode the paths to gunzip(1) and cmp(1) either.
Discussed with ajacoutot@.

9 years agoThird step towards parser unification:
Ingo Schwarze [Thu, 2 Apr 2015 23:48:19 +0000 (23:48 +0000)]
Third step towards parser unification:
Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta.
Written of the train from London to Exeter on the way to p2k15.

9 years agoSecond step towards parser unification:
Ingo Schwarze [Thu, 2 Apr 2015 22:48:17 +0000 (22:48 +0000)]
Second step towards parser unification:
Replace struct mdoc_node and struct man_node by a unified struct roff_node.
To be able to use the tok member for both mdoc(7) and man(7) without
defining all the macros in roff.h, sacrifice a tiny bit of type safety
and make tok an int rather than an enum.
Almost mechanical, no functional change.
Written on the Eurostar from Bruxelles to London on the way to p2k15.

9 years agoFirst step towards parser unification:
Ingo Schwarze [Thu, 2 Apr 2015 21:36:49 +0000 (21:36 +0000)]
First step towards parser unification:
Replace enum mdoc_type and enum man_type by a unified enum roff_type.
Almost mechanical, no functional change.
Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.

9 years agoLet man(1) and apropos(1) work even when the current directory
Ingo Schwarze [Wed, 1 Apr 2015 12:48:33 +0000 (12:48 +0000)]
Let man(1) and apropos(1) work even when the current directory
is unusable: Only change back to the current directory when the
directory was changed before and the next path is relative.
This is now more similar to what makewhatis(8) does.
Issue reported by espie@.

9 years agoEscape punctuation characters that have a different meaning in -Tpdf.
Ingo Schwarze [Mon, 30 Mar 2015 16:06:14 +0000 (16:06 +0000)]
Escape punctuation characters that have a different meaning in -Tpdf.

~, `, and ' get translated to non-ASCII characters by most troff
implementations when generating PostScript/PDF output.  When the
original ASCII character is meant, it needs to be manually escaped.

Patch from bentley@.

9 years agorefering -> referring; patch from jmc@
Ingo Schwarze [Fri, 27 Mar 2015 21:40:04 +0000 (21:40 +0000)]
refering -> referring; patch from jmc@

9 years agoActually use the new man.conf(5) "output" directive.
Ingo Schwarze [Fri, 27 Mar 2015 21:33:20 +0000 (21:33 +0000)]
Actually use the new man.conf(5) "output" directive.
Additional functionality, yet minus 45 lines of code.

9 years agoParse the new man.conf(5) "output" directive.
Ingo Schwarze [Fri, 27 Mar 2015 17:37:25 +0000 (17:37 +0000)]
Parse the new man.conf(5) "output" directive.
The next step will be to actually use the parsed data.

9 years agoModernize documentation by inserting blanks between option letters
Ingo Schwarze [Fri, 27 Mar 2015 16:36:31 +0000 (16:36 +0000)]
Modernize documentation by inserting blanks between option letters
and option arguments, except for -m because "-m an" and "-m andoc"
look just too weird.  Of course, the traditional form without the
blank will continue to work.

9 years agovarious tweaks from jmc@
Ingo Schwarze [Fri, 27 Mar 2015 16:28:55 +0000 (16:28 +0000)]
various tweaks from jmc@

9 years agooops, forgot to apply the actual patch...
Ingo Schwarze [Fri, 27 Mar 2015 01:01:28 +0000 (01:01 +0000)]
oops, forgot to apply the actual patch...

9 years agoDocument that certain stand-alone accents need escaping in rare cases to
Ingo Schwarze [Fri, 27 Mar 2015 00:57:28 +0000 (00:57 +0000)]
Document that certain stand-alone accents need escaping in rare cases to
prevent them from being converted to Unicode replacements in PDF output.
Issue found by bentley@, OK jmc@ bentley@.

9 years agoAdd man.conf(5). After adding some additional functionality,
Ingo Schwarze [Fri, 27 Mar 2015 00:18:14 +0000 (00:18 +0000)]
Add man.conf(5).  After adding some additional functionality,
one of the next steps will be to use it in addition to manpath(1)
rather than as an alternative to it.

9 years agoAdd a new directive "manpath path"
Ingo Schwarze [Thu, 26 Mar 2015 22:42:32 +0000 (22:42 +0000)]
Add a new directive "manpath path"
to replace the legacy "_whatdb path/whatis.db".
Keep _whatdb support for backward compat, for now.
Discussed with many, jmc@ and ajacoutot@ agree with the general direction.

9 years agomake MANPATH_DEFAULT compile-time configurable
Ingo Schwarze [Sun, 22 Mar 2015 18:14:30 +0000 (18:14 +0000)]
make MANPATH_DEFAULT compile-time configurable

9 years agowhen there is no -m, no -M, no MANPATH and no /etc/man.conf,
Ingo Schwarze [Sat, 21 Mar 2015 17:19:36 +0000 (17:19 +0000)]
when there is no -m, no -M, no MANPATH and no /etc/man.conf,
fall back to /usr/share/man:/usr/X11R6/man:/usr/local/man

9 years agovasprintf(3) needs _GNU_SOURCE on Linux;
Ingo Schwarze [Fri, 20 Mar 2015 15:32:02 +0000 (15:32 +0000)]
vasprintf(3) needs _GNU_SOURCE on Linux;
pointed out by Christian Neukirchen <chneukirchen at gmail dot com>.

9 years agoPatch from Christian Neukirchen <chneukirchen at gmail dot com>:
Ingo Schwarze [Fri, 20 Mar 2015 15:25:12 +0000 (15:25 +0000)]
Patch from Christian Neukirchen <chneukirchen at gmail dot com>:
He reports that on some platforms, it is not possible to use the
same va_list twice.  So use va_copy(3) for additional safety.

9 years agoThe .PD macro can occur in next-line scope. Fixes zshmisc(1).
Ingo Schwarze [Fri, 20 Mar 2015 14:47:52 +0000 (14:47 +0000)]
The .PD macro can occur in next-line scope.  Fixes zshmisc(1).
Issue reported by Christian Neukirchen <chneukirchen at gmail dot com>.

9 years agoSimplify by almost halving the number of macro flags:
Ingo Schwarze [Fri, 20 Mar 2015 12:54:22 +0000 (12:54 +0000)]
Simplify by almost halving the number of macro flags:
1. MAN_EXPLICIT was used iff fp == blk_exp, so just test fp.
2. MAN_FSCOPED was used only for TP, so just test for TP.
3. MAN_NOCLOSE was completely unused.
No functional change.

9 years agoCompat glue needed for Solaris 9 and 10.
Ingo Schwarze [Thu, 19 Mar 2015 14:57:29 +0000 (14:57 +0000)]
Compat glue needed for Solaris 9 and 10.

Thanks to Sevan Janiyan <venture37 at geeklan dot co dot uk> for
reporting the Solaris 10 issues, to Jan Holzhueter <jh at opencsw
dot org> for some additional insight, and to OpenCSW in general for
providing me with a Solaris 9/10/11 testing environment.

9 years agoWe always use FTS_NOCHDIR, so delete the directory changing code.
Ingo Schwarze [Wed, 18 Mar 2015 19:29:48 +0000 (19:29 +0000)]
We always use FTS_NOCHDIR, so delete the directory changing code.
This not only simplifies matters, but also helps operating systems
lacking dirfd(3), for example Solaris 10.  Solaris dirfd issue
reported by Sevan Janiyan <venture37 at geeklan dot co dot uk>.

9 years agoPass the CC set in configure.local to Makefile.local.
Ingo Schwarze [Wed, 18 Mar 2015 17:13:37 +0000 (17:13 +0000)]
Pass the CC set in configure.local to Makefile.local.
Issue found while testing on opencsw.org.

9 years agoSimplify: Now that rc is global anyway, no need to pass it around
Ingo Schwarze [Tue, 17 Mar 2015 13:35:52 +0000 (13:35 +0000)]
Simplify: Now that rc is global anyway, no need to pass it around
as an argument.  No functional change.

9 years agoWhen the user exits the pager before the pager has drained all input
Ingo Schwarze [Tue, 17 Mar 2015 07:33:07 +0000 (07:33 +0000)]
When the user exits the pager before the pager has drained all input
from man(1), man(1) dies from SIGPIPE.  Exiting man(1) is fine in this
case, generating more output would be pointless, but without handling
SIGPIPE, the exit code from man(1) was wrong and csh(1) printed an
ugly message "Broken pipe".  Fix this by handling SIGPIPE explicitly.
Issue noticed by deraadt@.

9 years agonaddy@ found a tough problem - fittingly, in cobfusc(1)...
Ingo Schwarze [Mon, 16 Mar 2015 14:51:14 +0000 (14:51 +0000)]
naddy@ found a tough problem - fittingly, in cobfusc(1)...