]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
6 years agoDelete support for the style=text-indent attribute, which is no longer used.
Ingo Schwarze [Mon, 25 Jun 2018 13:26:57 +0000 (13:26 +0000)]
Delete support for the style=text-indent attribute, which is no longer used.

6 years agoFor -man -Thtml, ignore author-specified .HP widths because they
Ingo Schwarze [Mon, 25 Jun 2018 13:01:19 +0000 (13:01 +0000)]
For -man -Thtml, ignore author-specified .HP widths because they
harm responsive design; use @media-dependent defaults instead.

6 years agoRevert previous: style=height is still used by roff_html.c, and it
Ingo Schwarze [Mon, 18 Jun 2018 01:49:15 +0000 (01:49 +0000)]
Revert previous: style=height is still used by roff_html.c, and it
doesn't actually harm responsive design, so keep it for now.
Bug reported in de.comp.os.unix.bsd via naddy@, thanks.

6 years agodelete support for the HTML style=height property, which is no longer used
Ingo Schwarze [Sun, 10 Jun 2018 16:47:15 +0000 (16:47 +0000)]
delete support for the HTML style=height property, which is no longer used

6 years agoIn HTML output, for lists that have an -indent argument, just use
Ingo Schwarze [Sun, 10 Jun 2018 16:15:43 +0000 (16:15 +0000)]
In HTML output, for lists that have an -indent argument, just use
a uniform indentation in CSS adapted to the viewport width and
ignore the value of the argument taken from mdoc(7).  While
author-specified widths somewhat work as a micro-optimization in
terminal and typeset output, they are nothing but harmful in HTML
style= attributes because they break responsive design, whereas
using a reasonable default indent almost never results in ugly
output.  Admittedly, the author-specified width might occasionally
look even better, but only slightly so, and only for some viewport
sizes.
Based on guidance provided by John Gardner.

6 years agoWhen formatting man(7) documents that do not contain .SH macros
Ingo Schwarze [Sun, 10 Jun 2018 15:12:35 +0000 (15:12 +0000)]
When formatting man(7) documents that do not contain .SH macros
with -Tps or -Tpdf, do not squeeze the whole text beyond the right
margin.  Bug reported by Will Backman during BSDCan.

6 years agoRemove redundant value= attributes from option elements,
Ingo Schwarze [Tue, 29 May 2018 20:32:45 +0000 (20:32 +0000)]
Remove redundant value= attributes from option elements,
and use type=search rather than type=text for the input element
because it tends to better support autocompletion.
Both suggested by John Gardner <gardnerjohng at gmail dot com>.

6 years agoDelete support for the print_otag(sw) * and - modifiers,
Ingo Schwarze [Tue, 29 May 2018 02:10:10 +0000 (02:10 +0000)]
Delete support for the print_otag(sw) * and - modifiers,
which are no longer used because we write fewer style= attributes.

6 years agoIgnore author-specified -width arguments for -tag and -hang lists
Ingo Schwarze [Tue, 29 May 2018 01:55:50 +0000 (01:55 +0000)]
Ignore author-specified -width arguments for -tag and -hang lists
in HTML output.  For terminal and typeset output, such arguments
kind of work to achieve presentational micro-optimization.
But for HTML, they only do harm.

Large increases usually look ugly.  Large reductions are impossible
since the default is not large in the first place.  Small tweaks in
either direction are not important; at least not important enough
to justify making responsive design impossible.

Triggered by John Gardner's suggestion to further reduce style=
attributes in the HTML code, in particular those containing hard-coded
lengths.

6 years agoJohn Gardner tells me that among frontend developers, gratuitous use
Ingo Schwarze [Mon, 28 May 2018 15:39:25 +0000 (15:39 +0000)]
John Gardner tells me that among frontend developers, gratuitous use
of double selectors like "element.class" is considered poor style.
When doing selection mainly by elements is not appropriate because
most elements require several different styles, exclusively selecting
by class is less cumbersome, more concise, and more flexible.
So drop the elements from the selectors, except where they are
required for disambiguation and except where they add clarity due
to the presence of child selectors.

6 years agoURL-fragment strings can only contain certain characters.
Ingo Schwarze [Mon, 28 May 2018 14:13:36 +0000 (14:13 +0000)]
URL-fragment strings can only contain certain characters.
Fixing HTML syntax violations e.g. in pf.conf(5) and ifconfig(8)
reported by Anton Lazarov <lists at wrant dot com>.

6 years agoStart with baby steps towards responsive design:
Ingo Schwarze [Sat, 26 May 2018 20:04:41 +0000 (20:04 +0000)]
Start with baby steps towards responsive design:
Use a @media width query to select a set of default indentations.
Suggested by John Gardner <gardnerjohng at gmail dot com>.

6 years agoUse em units rather than ex units for horizontal lengths.
Ingo Schwarze [Sat, 26 May 2018 17:38:01 +0000 (17:38 +0000)]
Use em units rather than ex units for horizontal lengths.
John Gardner and others tell me it produces more predictable results
and is generally considered better style.
Also use 0em instead of 0ex, in general.

6 years agoDo not write duplicate id= attributes, they violate HTML syntax.
Ingo Schwarze [Fri, 25 May 2018 20:23:51 +0000 (20:23 +0000)]
Do not write duplicate id= attributes, they violate HTML syntax.
Append suffixes for disambiguation.  Issue first reported by Jakub
Klinkovsky <j dot l dot k at gmx dot com> (Arch Linux).

6 years agoUse <span> for .Ms rather than <b>; discussed with John Gardner.
Ingo Schwarze [Mon, 21 May 2018 01:11:31 +0000 (01:11 +0000)]
Use <span> for .Ms rather than <b>; discussed with John Gardner.

6 years agoUse <span> for .Ad rather than <i>; also suggested by John Gardner.
Ingo Schwarze [Mon, 21 May 2018 00:30:23 +0000 (00:30 +0000)]
Use <span> for .Ad rather than <i>; also suggested by John Gardner.

6 years agoUse <span> rather than abusing <i> for .Pa;
Ingo Schwarze [Mon, 21 May 2018 00:00:37 +0000 (00:00 +0000)]
Use <span> rather than abusing <i> for .Pa;
suggested by John Gardner <gardnerjohng at gmail dot com>.

6 years agovarious minor improvements
Ingo Schwarze [Sun, 20 May 2018 21:48:44 +0000 (21:48 +0000)]
various minor improvements

6 years agoProtect against malicious manual pages containing .ll requests with
Ingo Schwarze [Sun, 20 May 2018 21:37:34 +0000 (21:37 +0000)]
Protect against malicious manual pages containing .ll requests with
excessive arguments: apply the same cutoff as for the -O width=
command line argument.

While here, also place some assertions at strategical places to
prevent excessive indentations from being printed in case of bugs.
In the past, we had more than one bug that caused mandoc to print
effectively infinite output, filling up people's /tmp/ file system,
which is not funny.  We cannot prevent bugs from crashing the
program, but we can at least make filling up the disk less likely.

Triggered by a remark from sthen@ on source-changes@.

6 years agoIn a nutshell, all mobile browsers are broken.
Ingo Schwarze [Fri, 18 May 2018 14:23:00 +0000 (14:23 +0000)]
In a nutshell, all mobile browsers are broken.
By default, no matter the physical screen size, they use a fixed
viewport width of about 1000px, then scale down the rendered page
to make that huge viewport fit on the physical screen.
That results in poor rendering for bad websites which assume a
large fixed-size viewport (typically requiring zooming in to be able
to actually read any text), but in atrocious rendering for good
websites that make no assumption about the screen size (unreadably
small text in the top left corner, most of the screen empty).

A standard way to disable that insane behaviour and just render
normally on the actual physical screen size does not exist.
The closest thing is the CSS3 Device Adaptation Module Level 1
https://drafts.csswg.org/css-device-adapt/
but https://caniuse.com/#feat=css-deviceadaptation tells me
that basically no browser implements it, not even on mobile.

The next closest thing is the HTML meta viewport element - even though
the problem has nothing to do with HTML and is purely a CSS issue.
Standardization is not even planned for that one:
* HTML 5.2 mentions it in passing without specifying it:
https://www.w3.org/TR/html/document-metadata.html#the-meta-element
* The Web Hypertext Application Technology Working Group
provides very incomplete information:
https://wiki.whatwg.org/wiki/MetaExtensions
* CSS3 Device Adaptation Module Level 1 already wants to deprecate it,
explaining mostly how to migrate *away* from it to some castle in
the sky that no browser implements:
https://drafts.csswg.org/css-device-adapt/#viewport-meta

While i strongly believe in sticking to well-established standards,
in the absence of standards and with atrocious behaviour being
universal, there appears to be no alternative to using whatever
works.  The meta viewport element appears to be the only way to
make real-world mobile browsers decently render any HTML page that
does not have a fixed-width layout of 1000px.  So use it, grudgingly.

Originally suggested by xcv at dr dot com.
Direction supported by espie@.

6 years agoSome broken terminal emulators (e.g. sakura) do the equivalent
Ingo Schwarze [Mon, 14 May 2018 14:10:23 +0000 (14:10 +0000)]
Some broken terminal emulators (e.g. sakura) do the equivalent
of "stty cols 0".  Ignore that insanity rather than setting
conf.output.width to an invalid value and embarking on infinite loops.
Issue reported by Jesper Wallin <jesper at ifconfig dot se>, thanks!

6 years agoFix a long-standing issue:
Ingo Schwarze [Wed, 9 May 2018 00:46:10 +0000 (00:46 +0000)]
Fix a long-standing issue:
Some macros (Nd, Oo) can contain blocks but rendered as elements that
can only contain phrasing content, resulting in invalid HTML nesting.
Switch them to <div>.
Also move the related "display: inline" style from the HTML to the CSS.

Reminded during a conversation with John Gardner.

6 years agoEliminate the class=It-* attributes.
Ingo Schwarze [Tue, 8 May 2018 21:42:34 +0000 (21:42 +0000)]
Eliminate the class=It-* attributes.
Cleaner HTML, more idiomatic CSS, and minus 30 lines of C code.
Suggested by John Gardner <gardnerjohng at gmail dot com>.

6 years agoSwitch the emitted HTML element from <b> to <code> for the fixed
Ingo Schwarze [Tue, 8 May 2018 17:52:55 +0000 (17:52 +0000)]
Switch the emitted HTML element from <b> to <code> for the fixed
syntax element macros .Nm, .Fl, .Cm, .Ic, .In, .Fd, .Fn, and .Cd.
Adjust both the internal and external style sheets such that
rendering remains unchanged in typical browsers.

Based on feedback from John Gardner <gardnerjohng at gmail dot com>.

6 years agoMinor correction: we render HTML character references hexadecimal,
Ingo Schwarze [Thu, 3 May 2018 14:21:46 +0000 (14:21 +0000)]
Minor correction: we render HTML character references hexadecimal,
not decimal; bentley@ changed that in html.c on July 14, 2017.

6 years agoskip printing the embedded style sheet if an external style is referenced
Ingo Schwarze [Tue, 1 May 2018 23:36:55 +0000 (23:36 +0000)]
skip printing the embedded style sheet if an external style is referenced

6 years agoSimpler description of output formats, shortening the manual page by 15 lines.
Ingo Schwarze [Sun, 29 Apr 2018 14:29:53 +0000 (14:29 +0000)]
Simpler description of output formats, shortening the manual page by 15 lines.
Avoid the double redirection from -Tutf8 via -Tlocale to -Tascii.
Add LC_CTYPE to the ENVIRONMENT section.
While here, also correct a few inaccuracies and tweak some wordings.
Triggered by a question from Laura Morales <lauretas at mail dot com>.

6 years agoBetter mandoc(1) -I and -T options for Heirloom comparisons.
Ingo Schwarze [Tue, 24 Apr 2018 13:58:30 +0000 (13:58 +0000)]
Better mandoc(1) -I and -T options for Heirloom comparisons.
Filter through col(1) -b for Heirloom because it produces double encoding.
Switch on mandoc(1) -Wall in groff comparisons.
Update usage.

6 years agomultiple new entries from various sources
Ingo Schwarze [Tue, 24 Apr 2018 13:30:59 +0000 (13:30 +0000)]
multiple new entries from various sources

6 years agoreplace my vague and idiosyncratic term "selflink"
Ingo Schwarze [Tue, 24 Apr 2018 00:36:52 +0000 (00:36 +0000)]
replace my vague and idiosyncratic term "selflink"
with the clearer and more usual "permalink";
suggested by John Gardner <gardnerjohng at gmail dot com>

6 years agodedup issues
Ingo Schwarze [Fri, 20 Apr 2018 14:02:32 +0000 (14:02 +0000)]
dedup issues

6 years agoTweak the description of -l:
Ingo Schwarze [Thu, 19 Apr 2018 23:41:16 +0000 (23:41 +0000)]
Tweak the description of -l:

Avoid the misunderstanding that the essential purpose of -l is
similar to the purpose of the -a option in mandoc(1), which is not
the point: the fact that -l implies -a is merely a minor detail.
The point of -l is to make man(1) behave like mandoc(1).
Move the mention of -a to the end to de-emphasize it.

Nate Bargmann reported that this seriously confused him,
and i can see why.

6 years agoCompatibility with man-db:
Ingo Schwarze [Thu, 19 Apr 2018 16:25:24 +0000 (16:25 +0000)]
Compatibility with man-db:
In page name mode (= man(1) default mode), also try to interpret
names containing slashes as absolute or relative file names.

Missing feature reported by Nate Bargmann on <groff at gnu dot org>,
and the man-db maintainer Colin Watson <cjwatson at debian dot org>
kindly explained to me how this is supposed to work.

6 years agoUse TIOCGWINSZ to reduce the default -Owidth during interactive use
Ingo Schwarze [Fri, 13 Apr 2018 19:55:30 +0000 (19:55 +0000)]
Use TIOCGWINSZ to reduce the default -Owidth during interactive use
on terminals narrower than 79 columns and the default -Oindent on
terminals narrower than 66 columns.
Requested by and feedback from pirofti@;
mpi@ and juanfra@ also like the general direction.

6 years agoMake sure that mandoc only goes into UTF-8 mode if the user really
Ingo Schwarze [Fri, 13 Apr 2018 18:31:00 +0000 (18:31 +0000)]
Make sure that mandoc only goes into UTF-8 mode if the user really
selected UTF-8, not some other multibyte locale.  This obviously
makes no difference on OpenBSD but improves portability.
Issue reported by <Nakayama at NetBSD> via wiz@.

6 years agopreserve comments before .Dd and .TH (typically Copyright and license)
Ingo Schwarze [Fri, 13 Apr 2018 16:28:07 +0000 (16:28 +0000)]
preserve comments before .Dd and .TH (typically Copyright and license)
in full HTML output, but not with -Ofragment, e.g. in man.cgi(8);
suggested by Thomas Klausner <wiz at NetBSD>

6 years agopreserve comments before .Dd when converting mdoc(7) to man(7)
Ingo Schwarze [Wed, 11 Apr 2018 17:11:13 +0000 (17:11 +0000)]
preserve comments before .Dd when converting mdoc(7) to man(7)
with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>

6 years agoTwo new low-level roff(7) features:
Ingo Schwarze [Tue, 10 Apr 2018 00:52:30 +0000 (00:52 +0000)]
Two new low-level roff(7) features:
* .nr optional third argument (auto-increment step size)
* \n+ and \n- numerical register auto-increment and -decrement
bentley@ reported on Dec 9, 2013 that lang/sbcl(1) uses these.

6 years agoWhen accessing an undefined number register, define it to be zero, like
Ingo Schwarze [Mon, 9 Apr 2018 22:27:04 +0000 (22:27 +0000)]
When accessing an undefined number register, define it to be zero, like
the previous commit for strings and macros, only technically simpler.
Desired behaviour also mentioned by Werner Lemberg in 2011.
This diff adds functionality but is -21 +19 LOC.  :-)

6 years agoUsing an undefined string or macro will cause it to be defined as empty.
Ingo Schwarze [Mon, 9 Apr 2018 02:31:42 +0000 (02:31 +0000)]
Using an undefined string or macro will cause it to be defined as empty.
Observed by Werner Lemberg on Nov 14, 2011
and rotting on my TODO list ever since.

6 years agoStop documenting the non-portable .R man(7) macro. Neither groff
Ingo Schwarze [Thu, 5 Apr 2018 22:12:33 +0000 (22:12 +0000)]
Stop documenting the non-portable .R man(7) macro.  Neither groff
nor the heirloom-doctools support it.  Adding it was a mistake in
the first place.

6 years agoDo not use a non-portable .R man(7) macro. Neither groff nor the
Ingo Schwarze [Thu, 5 Apr 2018 22:05:08 +0000 (22:05 +0000)]
Do not use a non-portable .R man(7) macro.  Neither groff nor the
heirloom-doctools support it.  Work around the gap by using .BR
with an empty first argument.  This was noticed more than once in
the past, but i always forgot to fix it.

6 years agouse the portable \(lq and \(rq internally rather than \(Lq and \(Rq
Ingo Schwarze [Thu, 5 Apr 2018 09:17:26 +0000 (09:17 +0000)]
use the portable \(lq and \(rq internally rather than \(Lq and \(Rq

6 years agoFor .Do/.Dq, use the documented and portable \(lq and \(rq
Ingo Schwarze [Thu, 5 Apr 2018 08:47:16 +0000 (08:47 +0000)]
For .Do/.Dq, use the documented and portable \(lq and \(rq
character escape sequences rather than the undocumented and
non-portable \(Lq and \(Rq.

Bug reported by Tim L <darkxst at github>
via Thomas Klausner <wiz at NetBSD>;
see https://github.com/nih-at/libzip/pull/42

6 years agoOuch, fix previous: In the edge case of a single-character string
Ingo Schwarze [Fri, 16 Mar 2018 20:41:41 +0000 (20:41 +0000)]
Ouch, fix previous:  In the edge case of a single-character string
containing nothing but a single hyphen, the pointer got incremented
twice at one point, causing a read overrun found by naddy@.

6 years agoStyle message about bad input encoding of em-dashes as -- instead of \(em.
Ingo Schwarze [Fri, 16 Mar 2018 15:05:44 +0000 (15:05 +0000)]
Style message about bad input encoding of em-dashes as -- instead of \(em.
Suggested by Thomas Klausner <wiz at NetBSD>; discussed with jmc@.

6 years agoSoften the language discouraging special character escape sequences.
Ingo Schwarze [Thu, 15 Mar 2018 18:10:31 +0000 (18:10 +0000)]
Soften the language discouraging special character escape sequences.
After i improved their ASCII renderings in groff and mandoc some time
ago, mathematical symbols can now be used in specialised mathematical
manual pages like libm and some X libraries.
Tweaks and OK jmc@.

6 years agoAdd strndup(3) compat implementation.
Ingo Schwarze [Tue, 27 Feb 2018 11:16:23 +0000 (11:16 +0000)]
Add strndup(3) compat implementation.
Jan Stary reports that MacOS X Snow Leopard and older lacks it.

6 years agoAfter opening a file with gzdopen(3), we have to call gzclose(3) or
Ingo Schwarze [Fri, 23 Feb 2018 21:35:19 +0000 (21:35 +0000)]
After opening a file with gzdopen(3), we have to call gzclose(3) or
we leak memory internally used by zlib to keep compression state.
Bug reported by Wolfgang Mueller <vehk at vehk dot de> who also
provided an incomplete patch, part of which i'm using in this commit.

6 years agoclarify documentation of macro keys
Ingo Schwarze [Fri, 23 Feb 2018 18:54:02 +0000 (18:54 +0000)]
clarify documentation of macro keys

6 years agoLogically, the following are are type names - just like .Vt,
Ingo Schwarze [Fri, 23 Feb 2018 18:25:57 +0000 (18:25 +0000)]
Logically, the following are are type names - just like .Vt,
some of them with an optional variable name following:
- .Ft
- .Fa in the SYNOPSIS
- .Fn second and later arguments in the SYNOPSIS
So add these to the .Vt macro table in the mandoc.db(5) database.
During my LibreSSL work, i'm getting really tired of typing
$ man -k Vt,Ft,Fa=some_type_name
over and over again; now, this becomes just:
$ man -k Vt=some_type_name

6 years agoInvalidate the tag_files.tfd after fclose(3)ing the stram associated
Ingo Schwarze [Fri, 23 Feb 2018 16:47:10 +0000 (16:47 +0000)]
Invalidate the tag_files.tfd after fclose(3)ing the stram associated
with it.  In main() assert that the tfd was actually invalidated.
This avoids closing an invalid fd.
From tb@; OK deraadt@ on an earlier version.

6 years agoIn man(7) and cat pages, cut off excessive one line descriptions.
Ingo Schwarze [Wed, 7 Feb 2018 20:31:39 +0000 (20:31 +0000)]
In man(7) and cat pages, cut off excessive one line descriptions.
An extreme example of how rogue files could mess up apropos(1) output
was reported by bentley@: qwtlicense(3) in the x11/qwt port.

6 years agoFix the mandoc_strndup() utility function. All existing callers seem
Ingo Schwarze [Wed, 7 Feb 2018 20:04:57 +0000 (20:04 +0000)]
Fix the mandoc_strndup() utility function.  All existing callers seem
safe so far, but implementing it with an unchecked memcpy(3) is just
wrong and quite dangerous.

6 years agofix wrong date
Ingo Schwarze [Wed, 7 Feb 2018 19:58:42 +0000 (19:58 +0000)]
fix wrong date

6 years agoDelete the "no blank before trailing delimiter" check from the
Ingo Schwarze [Tue, 6 Feb 2018 16:29:57 +0000 (16:29 +0000)]
Delete the "no blank before trailing delimiter" check from the
partial explicit macros.  Leah Neukirchen <leah at vuxu dot org>
rightfully points out that the check makes no sense for these macros.

7 years agoRemove the implicit display feature of .Lk because it was inconsistent
Ingo Schwarze [Sat, 13 Jan 2018 05:23:18 +0000 (05:23 +0000)]
Remove the implicit display feature of .Lk because it was inconsistent
across output devices, counter-intuitive, and resulted in ugly
output for many real-world manual pages.  Always format even long
links in-line.  I already committed a similar change to groff.

OK jmc@, bentley@, and the original author
of the feature, Werner Lemberg <wl@gnu.org>.

7 years agotypo; from Alexander Kuleshov <kuleshovmail at gmail dot com>
Ingo Schwarze [Fri, 15 Dec 2017 23:39:07 +0000 (23:39 +0000)]
typo; from Alexander Kuleshov <kuleshovmail at gmail dot com>

7 years agoRecognize .Bl -column at parse time, and not only at validation time,
Ingo Schwarze [Wed, 29 Nov 2017 20:05:33 +0000 (20:05 +0000)]
Recognize .Bl -column at parse time, and not only at validation time,
even if other arguments precede -column.  This is required because
the .It parser needs to know whether or not we are a -column list.
Fixes tree corruption leading to an assertion failure.
Bug reported by bentley@.

7 years agoduplicate word, found by igor(1)
Ingo Schwarze [Tue, 28 Nov 2017 20:26:21 +0000 (20:26 +0000)]
duplicate word, found by igor(1)

7 years agostreamline termp allocation: this will allow the init function
Ingo Schwarze [Fri, 10 Nov 2017 23:42:52 +0000 (23:42 +0000)]
streamline termp allocation: this will allow the init function
to do things differently in the ps vs pdf case;
from espie@

7 years agobe less assertive when warning about a possible typo;
Ingo Schwarze [Fri, 10 Nov 2017 23:32:40 +0000 (23:32 +0000)]
be less assertive when warning about a possible typo;
from jca@, ok jmc@

7 years agoShrink -Tps output by more than 50%
Ingo Schwarze [Thu, 2 Nov 2017 14:53:02 +0000 (14:53 +0000)]
Shrink -Tps output by more than 50%
by using PostScript as a programming language.
* Define and use one PostScript procedure to select each font.
* Define and use procedures combining "use" and "show".
* In one of these, reuse the current row if it did not change.
Most ideas and most coding by espie@, tweaked by me.

7 years agoPrint a human-readable media name in the %%DocumentMedia DSC comment
Ingo Schwarze [Sun, 29 Oct 2017 19:25:31 +0000 (19:25 +0000)]
Print a human-readable media name in the %%DocumentMedia DSC comment
and use the setpagedevice PostScript operator to help printers
automatically select the paper of the best matching PageSize.

Many thanks to Mike Williams <obsd1 at eandem dot co dot uk>
for teaching me about the relevant features of PostScript and DSC
and for suggesting what to put into the first %%DocumentMedia argument.

7 years agoduplicate anchors
Ingo Schwarze [Sat, 28 Oct 2017 16:20:24 +0000 (16:20 +0000)]
duplicate anchors

7 years agomore readable conversion of paper size from millimeters to PostScript
Ingo Schwarze [Thu, 26 Oct 2017 18:11:31 +0000 (18:11 +0000)]
more readable conversion of paper size from millimeters to PostScript
basic units, also slightly more precise

7 years agoThe page footer line (psmarg) is created in ps_begin(), and the
Ingo Schwarze [Wed, 25 Oct 2017 20:48:48 +0000 (20:48 +0000)]
The page footer line (psmarg) is created in ps_begin(), and the
last call writing to it is always ps_endline(), which ends with
ps_pclose(), which prints "ET" (end text).

Consequently, do not print another instance of "ET" in ps_closepage()
after the footer line and before the "endstream" for the page.

Fixing a PDF syntax error found while investigating the bug report
from Jan Stary that also resulted in the previous commit.

7 years agoProperly close out the top-level Font object, the end-of-page
Ingo Schwarze [Wed, 25 Oct 2017 18:52:06 +0000 (18:52 +0000)]
Properly close out the top-level Font object, the end-of-page
Resource objects, and the Catalog object, fixing three PDF syntax
errors that were present in every PDF file generated with mandoc
since the initial checkin of the formatter in July 2010.
Bug reported by Jan Stary <hans at stare dot cz> on misc@.

7 years agoModernize documentation of .Ao and .Aq.
Ingo Schwarze [Mon, 23 Oct 2017 13:54:41 +0000 (13:54 +0000)]
Modernize documentation of .Ao and .Aq.

I looked through our whole tree and failed to find a single use
that is really convincing, except those with .Mt.  Putting it around
character and key names is somewhat widespread and maybe acceptable,
even if hardly useful.

So for now, delete the bogus examples and explain what these macros
are really used for.  Discourage the most common abuses.

Triggered by a question from Raf Czlonka <rczlonka at gmail dot com>.

7 years agoHISTORY: mention first appearance in OpenBSD
Ingo Schwarze [Tue, 17 Oct 2017 23:19:12 +0000 (23:19 +0000)]
HISTORY: mention first appearance in OpenBSD

7 years agoDo not segfault when there are two .Dt macros, the first without
Ingo Schwarze [Tue, 12 Sep 2017 18:21:03 +0000 (18:21 +0000)]
Do not segfault when there are two .Dt macros, the first without
an architecture argument and the second with an invalid one.
Bug found by jsg@ with afl(1).

7 years agotypo: convertion -> convention; from dcoppa@
Ingo Schwarze [Thu, 7 Sep 2017 14:55:12 +0000 (14:55 +0000)]
typo: convertion -> convention; from dcoppa@

7 years agofix a NULL pointer access on deroff() failure;
Ingo Schwarze [Wed, 6 Sep 2017 16:24:25 +0000 (16:24 +0000)]
fix a NULL pointer access on deroff() failure;
could be triggered with '.SS ""';
reported by Michael <Stapelberg at debian>

7 years agofix grammar; while here, improve spacing; from sobrado@
Ingo Schwarze [Mon, 4 Sep 2017 10:35:27 +0000 (10:35 +0000)]
fix grammar; while here, improve spacing; from sobrado@

7 years agoformat ".IP *" etc. as <ul> rather than <dl>
Ingo Schwarze [Sat, 2 Sep 2017 11:55:11 +0000 (11:55 +0000)]
format ".IP *" etc. as <ul> rather than <dl>

7 years agoFix previous: mmap(2) returns MAP_FAILED on failure, not NULL.
Ingo Schwarze [Sat, 26 Aug 2017 20:38:14 +0000 (20:38 +0000)]
Fix previous: mmap(2) returns MAP_FAILED on failure, not NULL.
Bug pointed out by tedu@.

7 years agoDo not fork and exec cmp(1); instead, simply fstat(2), mmap(2), and
Ingo Schwarze [Sat, 26 Aug 2017 15:55:46 +0000 (15:55 +0000)]
Do not fork and exec cmp(1); instead, simply fstat(2), mmap(2), and
compare the files directly, allowing a much stricter pledge(2), at
very little cost: merely 15 additional lines of very simple code.
Suggested by George Brown <321 dot george at gmail dot com> on misc@.

7 years agoNo need to fork and exec rm(1) -rf, we know that we have exactly
Ingo Schwarze [Sat, 26 Aug 2017 12:59:17 +0000 (12:59 +0000)]
No need to fork and exec rm(1) -rf, we know that we have exactly
one file and exactly one directory to remove.  While here, increase
the size of the buffer such that the file name actually fits.
Minus 17 lines of code, no functional change.

Opportunity for simplification reported by George Brown <321 dot
george at gmail dot com> on misc@.

7 years agoremove spacing after another representation of unary minus
Ingo Schwarze [Wed, 23 Aug 2017 21:56:20 +0000 (21:56 +0000)]
remove spacing after another representation of unary minus

7 years agoremove spacing after unary minus
Ingo Schwarze [Wed, 23 Aug 2017 20:49:15 +0000 (20:49 +0000)]
remove spacing after unary minus

7 years agoeliminate white space after opening and before closing punctuation
Ingo Schwarze [Wed, 23 Aug 2017 20:29:42 +0000 (20:29 +0000)]
eliminate white space after opening and before closing punctuation

7 years agouse the tty-char macro file for ASCII comparisons
Ingo Schwarze [Wed, 23 Aug 2017 20:03:17 +0000 (20:03 +0000)]
use the tty-char macro file for ASCII comparisons

7 years agoSuppress spacing before certain kinds of lists.
Ingo Schwarze [Wed, 23 Aug 2017 20:03:17 +0000 (20:03 +0000)]
Suppress spacing before certain kinds of lists.
One benefit is a reduced probablity that a blank appears between
a function name and the opening parenthesis introducing the arguments.
The heuristics isn't perfect and may occasionally suppress a blank
that wouldn't do harm.

7 years agoImprove ASCII rendering of a few rare character escape sequences
Ingo Schwarze [Wed, 23 Aug 2017 13:01:29 +0000 (13:01 +0000)]
Improve ASCII rendering of a few rare character escape sequences
that can be changed unilaterally because groff fails to render them
at all.

7 years agocatch up with ASCII renderings in chars.c rev. 1.72
Ingo Schwarze [Wed, 23 Aug 2017 10:59:58 +0000 (10:59 +0000)]
catch up with ASCII renderings in chars.c rev. 1.72

7 years agoSwitch ASCII rendering of the same mathematical symbols and greek
Ingo Schwarze [Wed, 23 Aug 2017 10:50:15 +0000 (10:50 +0000)]
Switch ASCII rendering of the same mathematical symbols and greek
letters as in groff commit babca15f from trying to imitate the
characters' graphical shapes, which resulted in unintelligible
renderings in many cases, to transliterations conveying the characters'
meanings.  One benefit is making these characters usable for portable
manual pages.

Solving a problem pointed out by bentley@.

7 years agoCorrect the mandoc.db(5) requirements of man(1) after the deprecation
Ingo Schwarze [Tue, 22 Aug 2017 18:17:52 +0000 (18:17 +0000)]
Correct the mandoc.db(5) requirements of man(1) after the deprecation
of MLINKS.  Inaccuracy pointed out by espie@.

7 years agoWhen finding a bogus database entry,
Ingo Schwarze [Tue, 22 Aug 2017 17:50:11 +0000 (17:50 +0000)]
When finding a bogus database entry,
print a meaningful warning and skip the entry.
Issue reported by espie@.

7 years agoWhen the stdout stream gets broken, there is no point in reading
Ingo Schwarze [Mon, 21 Aug 2017 15:42:58 +0000 (15:42 +0000)]
When the stdout stream gets broken, there is no point in reading
any more input files, and it would be misleading to start a parser,
because that would show randomly truncated text.
Instead, print an error message and exit the program.

Issue found by Leah Neukirchen <leah at vuxu dot org>, who was
surprised to see half a manpage when her /tmp/ overflew.

7 years agosync with FreeBSD;
Ingo Schwarze [Sun, 20 Aug 2017 02:30:27 +0000 (02:30 +0000)]
sync with FreeBSD;
suggested by Sevan Janiyan <venture37 at geeklan dot co dot uk>

7 years agoDelete the lie that $PAGER would only be used with -a or -l; the text
Ingo Schwarze [Sat, 19 Aug 2017 22:05:38 +0000 (22:05 +0000)]
Delete the lie that $PAGER would only be used with -a or -l; the text
was probably copied from mandoc(1) or apropos(1), where it is true.

7 years agodocument -O mdoc; triggered by a question from jmc@ and OK jmc@
Ingo Schwarze [Sat, 19 Aug 2017 22:00:05 +0000 (22:00 +0000)]
document -O mdoc; triggered by a question from jmc@ and OK jmc@

7 years agoMake the "new sentence, new line" check stricter, allowing digits
Ingo Schwarze [Fri, 11 Aug 2017 16:56:21 +0000 (16:56 +0000)]
Make the "new sentence, new line" check stricter, allowing digits
in the last two letters of the last word of the sentence.
No false positives in base or Xenocara.
Suggested by and OK jmc@.

7 years agoAdd two EXAMPLES; triggered by a question from jmc@.
Ingo Schwarze [Fri, 11 Aug 2017 15:10:26 +0000 (15:10 +0000)]
Add two EXAMPLES; triggered by a question from jmc@.
Feedback and OK jmc@.

7 years agoExplain how to transform markup for the terminal when not using a
Ingo Schwarze [Wed, 9 Aug 2017 12:49:04 +0000 (12:49 +0000)]
Explain how to transform markup for the terminal when not using a
pager, and how to remove markup.  Add related cross references.
While here, as suggested by jmc@, replace the excessive cross
references to the intro pages by a more relevant one to mandoc(1).
Triggered by a question from, using feedback from, and OK jmc@.

7 years agorelease 1.14.3 VERSION_1_14_3
Ingo Schwarze [Sat, 5 Aug 2017 13:34:39 +0000 (13:34 +0000)]
release 1.14.3

7 years agoNo longer use names that only occur in the SYNOPSIS section as names
Ingo Schwarze [Wed, 2 Aug 2017 13:29:04 +0000 (13:29 +0000)]
No longer use names that only occur in the SYNOPSIS section as names
for man(1) lookup.  For OpenBSD base and Xenocara, that functionality
was never intended to be required, and i just fixed the last handful
of offenders using it - not counting the horribly ill-designed
interfaces engine(3) and lh_new(3) which are impossible to properly
document in the first place.

Of course, apropos(1) and whatis(1) continue to use SYNOPSIS .Nm,
.Fn, and .Fo macros, so "man -k ENGINE_get_load_privkey_function"
still works.

This change also gets rid of a few bogus warnings "cross reference
to self" which actually are *not* to self, like in yp(8).

This former functionality was intended to help third-party software
in the ports tree and on non-OpenBSD systems containing manual pages
with incomplete or corrupt NAME sections.  But it turned out it did
more harm than good, and caused more confusion than relief,
specifically for third party manuals and for maintainers of
mandoc-portable on other operating systems.  So kill it.
Problems reported, among others, by Yuri Pankov (illumos).

OK jmc@

7 years agoIgnore explicitly specified negative column widths rather than
Ingo Schwarze [Mon, 31 Jul 2017 16:14:10 +0000 (16:14 +0000)]
Ignore explicitly specified negative column widths rather than
wrapping around to huge numbers and risking memory exhaustion;
fixes Debian ps(1).  Bug reported by Dr. Markus Waldeck.

7 years agoFix an out of bounds read access to a constant array that caused
Ingo Schwarze [Mon, 31 Jul 2017 15:19:06 +0000 (15:19 +0000)]
Fix an out of bounds read access to a constant array that caused
segfaults on certain hardened versions of glibc.  Triggered by .sp
or blank lines right before .SS or .SH, or before the first .Sh.
Found the hard way by Dr. Markus Waldner on Debian
and by Leah Neukirchen on Void Linux.

7 years agofinal tweaks for the 1.14.2 release VERSION_1_14_2
Ingo Schwarze [Fri, 28 Jul 2017 14:57:56 +0000 (14:57 +0000)]
final tweaks for the 1.14.2 release