diff options
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/CVS/Entries | 184 | ||||
-rw-r--r-- | usr.bin/mandoc/CVS/Entries.Log | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/apropos.1 | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/arch.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/cgi.c | 7 | ||||
-rw-r--r-- | usr.bin/mandoc/html.c | 7 | ||||
-rw-r--r-- | usr.bin/mandoc/libmandoc.h | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/main.c | 44 | ||||
-rw-r--r-- | usr.bin/mandoc/man_html.c | 16 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 10 | ||||
-rw-r--r-- | usr.bin/mandoc/man_validate.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.1 | 70 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.c | 25 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.css | 7 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc.h | 9 | ||||
-rw-r--r-- | usr.bin/mandoc/mandoc_msg.c | 9 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 18 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 34 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/read.c | 7 | ||||
-rw-r--r-- | usr.bin/mandoc/roff.c | 12 | ||||
-rw-r--r-- | usr.bin/mandoc/tbl_data.c | 21 | ||||
-rw-r--r-- | usr.bin/mandoc/tbl_html.c | 16 | ||||
-rw-r--r-- | usr.bin/mandoc/tbl_term.c | 13 | ||||
-rw-r--r-- | usr.bin/mandoc/term_tag.c | 11 | ||||
-rw-r--r-- | usr.bin/mandoc/term_tag.h | 4 |
26 files changed, 323 insertions, 229 deletions
diff --git a/usr.bin/mandoc/CVS/Entries b/usr.bin/mandoc/CVS/Entries index 3091a79..c1a6b0a 100644 --- a/usr.bin/mandoc/CVS/Entries +++ b/usr.bin/mandoc/CVS/Entries @@ -1,101 +1,101 @@ -/Makefile/1.118/Fri Mar 13 00:31:04 2020// -/apropos.1/1.43/Mon Jul 20 14:52:12 2020// -/arch.c/1.12/Mon Jun 29 19:16:59 2020// -/att.c/1.14/Thu Dec 13 11:55:14 2018// -/cgi.c/1.111/Mon Jun 29 19:16:59 2020// -/cgi.h.example/1.6/Sat Mar 18 16:48:07 2017// /chars.c/1.49/Thu Feb 13 16:16:03 2020// /dba.c/1.7/Thu Feb 9 18:26:17 2017// -/dba.h/1.2/Wed Aug 17 20:46:06 2016// -/dba_array.c/1.1/Mon Aug 1 10:32:39 2016// -/dba_array.h/1.1/Mon Aug 1 10:32:39 2016// -/dba_read.c/1.4/Wed Aug 17 20:46:06 2016// -/dba_write.c/1.1/Mon Aug 1 10:32:39 2016// -/dba_write.h/1.1/Mon Aug 1 10:32:39 2016// /dbm.c/1.5/Mon Jul 1 22:43:03 2019// -/dbm.h/1.1/Mon Aug 1 10:32:39 2016// /dbm_map.c/1.6/Thu Feb 9 18:26:17 2017// -/dbm_map.h/1.2/Mon Jul 1 22:43:03 2019// -/eqn.c/1.47/Wed Jan 8 12:09:14 2020// -/eqn.h/1.1/Thu Dec 13 05:13:15 2018// -/eqn_html.c/1.15/Sun Mar 17 18:20:07 2019// -/eqn_parse.h/1.3/Fri Dec 14 06:33:03 2018// -/eqn_term.c/1.15/Thu Dec 13 05:13:15 2018// -/html.c/1.141/Mon Apr 20 12:59:24 2020// -/html.h/1.70/Sat Apr 18 20:28:46 2020// -/libman.h/1.61/Mon Dec 31 10:03:38 2018// -/libmandoc.h/1.64/Fri Apr 3 11:34:19 2020// -/libmdoc.h/1.88/Mon Dec 31 04:55:42 2018// -/main.c/1.255/Tue Jul 21 15:08:48 2020// -/main.h/1.25/Sun Mar 3 13:01:47 2019// -/makewhatis.8/1.14/Wed May 17 22:26:52 2017// -/man.1/1.39/Mon Jul 20 14:52:12 2020// -/man.c/1.135/Sat Jan 5 00:36:46 2019// -/man.cgi.8/1.22/Sun May 20 21:48:23 2018// -/man.conf.5/1.8/Mon Feb 10 14:42:03 2020// -/man.h/1.59/Thu Aug 23 19:32:03 2018// -/man_html.c/1.131/Sat Apr 4 20:23:06 2020// -/man_macro.c/1.107/Wed Sep 9 16:57:05 2020// -/man_term.c/1.188/Fri Mar 13 00:31:05 2020// -/man_validate.c/1.124/Fri Apr 24 11:58:02 2020// -/manconf.h/1.9/Tue Jul 21 15:08:49 2020// -/mandoc.1/1.173/Tue Sep 1 18:24:09 2020// -/mandoc.c/1.85/Sun Jan 19 16:16:32 2020// -/mandoc.css/1.33/Sun Jun 2 16:50:46 2019// -/mandoc.h/1.211/Tue Sep 1 18:24:09 2020// -/mandoc_aux.c/1.9/Wed Feb 7 20:04:33 2018// -/mandoc_aux.h/1.9/Mon Jun 12 18:55:42 2017// -/mandoc_msg.c/1.10/Tue Sep 1 18:24:10 2020// /mandoc_ohash.c/1.2/Mon Oct 19 18:58:20 2015// -/mandoc_ohash.h/1.2/Sat Nov 7 13:57:55 2015// -/mandoc_parse.h/1.4/Sat Nov 9 14:39:42 2019// /mandoc_xr.c/1.3/Sun Jul 2 21:17:12 2017// -/mandoc_xr.h/1.3/Sun Jul 2 21:17:12 2017// -/mandocdb.c/1.216/Fri Apr 3 11:34:19 2020// -/manpath.c/1.30/Thu Aug 27 14:59:42 2020// /mansearch.c/1.65/Mon Jul 1 22:43:03 2019// -/mansearch.h/1.24/Tue Apr 30 18:48:26 2019// -/mdoc.c/1.164/Mon Apr 6 09:55:49 2020// -/mdoc.h/1.71/Sun Dec 30 00:48:47 2018// -/mdoc_argv.c/1.76/Thu Jul 11 16:56:52 2019// -/mdoc_html.c/1.215/Sun Apr 19 15:15:54 2020// -/mdoc_macro.c/1.191/Sun Jan 19 17:59:01 2020// -/mdoc_man.c/1.134/Thu Feb 27 01:25:57 2020// -/mdoc_markdown.c/1.35/Fri Apr 3 11:34:19 2020// -/mdoc_state.c/1.16/Sun Jan 19 17:59:01 2020// -/mdoc_term.c/1.279/Mon Apr 6 09:55:49 2020// -/mdoc_validate.c/1.302/Sun Apr 26 21:29:45 2020// -/msec.c/1.13/Fri Dec 14 01:17:46 2018// -/msec.in/1.6/Sat Jun 24 17:36:50 2017// -/out.c/1.51/Tue Dec 31 22:49:17 2019// -/out.h/1.25/Fri Apr 3 11:34:19 2020// -/preconv.c/1.9/Thu Dec 13 11:55:14 2018// -/predefs.in/1.4/Fri Nov 28 19:25:03 2014// -/read.c/1.190/Fri Apr 24 11:58:02 2020// -/roff.c/1.248/Thu Aug 27 12:58:00 2020// -/roff.h/1.56/Wed Apr 8 11:54:14 2020// -/roff_html.c/1.20/Tue Apr 30 15:52:42 2019// -/roff_int.h/1.17/Fri Apr 24 11:58:02 2020// -/roff_term.c/1.21/Thu Sep 3 20:33:20 2020// -/roff_validate.c/1.19/Thu Feb 27 01:25:58 2020// -/st.c/1.13/Fri Dec 14 01:17:46 2018// /tag.c/1.36/Sun Apr 19 16:26:11 2020// -/tag.h/1.14/Sat Apr 18 20:28:46 2020// -/tbl.c/1.27/Fri Dec 14 06:33:03 2018// -/tbl.h/1.5/Wed Dec 12 21:54:30 2018// -/tbl_data.c/1.40/Sat Jan 11 20:48:13 2020// -/tbl_html.c/1.28/Sun Mar 17 18:20:07 2019// -/tbl_int.h/1.2/Fri Dec 14 06:33:03 2018// -/tbl_layout.c/1.36/Tue Sep 1 18:24:10 2020// -/tbl_opts.c/1.16/Fri Dec 14 05:17:45 2018// -/tbl_parse.h/1.2/Fri Dec 14 06:33:03 2018// -/tbl_term.c/1.61/Sat Jan 11 16:24:33 2020// -/term.c/1.142/Wed Sep 2 16:36:48 2020// -/term.h/1.75/Fri Jan 4 03:20:44 2019// -/term_ascii.c/1.52/Wed Sep 9 13:40:24 2020// -/term_ps.c/1.56/Sun Sep 6 14:44:19 2020// -/term_tab.c/1.4/Sat Jun 17 14:55:02 2017// -/term_tag.c/1.5/Tue Jul 21 15:08:49 2020// -/term_tag.h/1.3/Tue Jul 21 15:08:49 2020// -/tree.c/1.56/Wed Apr 8 11:54:14 2020// +/Makefile/1.118/Mon Oct 19 10:36:43 2020// +/apropos.1/1.45/Wed Jul 14 10:44:49 2021// +/arch.c/1.14/Wed Jul 14 10:44:49 2021// +/att.c/1.14/Mon Oct 19 10:36:43 2020// +/cgi.c/1.113/Wed Jul 14 10:44:49 2021// +/cgi.h.example/1.6/Mon Oct 19 10:36:43 2020// +/dba.h/1.2/Mon Oct 19 10:36:43 2020// +/dba_array.c/1.1/Mon Oct 19 10:36:43 2020// +/dba_array.h/1.1/Mon Oct 19 10:36:43 2020// +/dba_read.c/1.4/Mon Oct 19 10:36:43 2020// +/dba_write.c/1.1/Mon Oct 19 10:36:43 2020// +/dba_write.h/1.1/Mon Oct 19 10:36:43 2020// +/dbm.h/1.1/Mon Oct 19 10:36:43 2020// +/dbm_map.h/1.2/Mon Oct 19 10:36:43 2020// +/eqn.c/1.47/Mon Oct 19 10:36:43 2020// +/eqn.h/1.1/Mon Oct 19 10:36:43 2020// +/eqn_html.c/1.15/Mon Oct 19 10:36:43 2020// +/eqn_parse.h/1.3/Mon Oct 19 10:36:43 2020// +/eqn_term.c/1.15/Mon Oct 19 10:36:43 2020// +/html.c/1.144/Result of merge// +/html.h/1.70/Mon Oct 19 10:36:43 2020// +/libman.h/1.61/Mon Oct 19 10:36:43 2020// +/libmandoc.h/1.65/Wed Jul 14 10:44:49 2021// +/libmdoc.h/1.88/Mon Oct 19 10:36:43 2020// +/main.c/1.257/Result of merge// +/main.h/1.25/Mon Oct 19 10:36:43 2020// +/makewhatis.8/1.14/Mon Oct 19 10:36:43 2020// +/man.1/1.39/Mon Oct 19 10:36:43 2020// +/man.c/1.135/Mon Oct 19 10:36:43 2020// +/man.cgi.8/1.22/Mon Oct 19 10:36:43 2020// +/man.conf.5/1.8/Mon Oct 19 10:36:43 2020// +/man.h/1.59/Mon Oct 19 10:36:43 2020// +/man_html.c/1.132/Wed Jul 14 10:44:50 2021// +/man_macro.c/1.107/Mon Oct 19 10:36:43 2020// +/man_term.c/1.189/Wed Jul 14 10:44:50 2021// +/man_validate.c/1.125/Wed Jul 14 10:44:50 2021// +/manconf.h/1.9/Mon Oct 19 10:36:43 2020// +/mandoc.1/1.178/Wed Jul 14 10:44:50 2021// +/mandoc.c/1.86/Wed Jul 14 10:44:50 2021// +/mandoc.css/1.35/Wed Jul 14 10:44:50 2021// +/mandoc.h/1.214/Wed Jul 14 10:44:50 2021// +/mandoc_aux.c/1.9/Mon Oct 19 10:36:43 2020// +/mandoc_aux.h/1.9/Mon Oct 19 10:36:43 2020// +/mandoc_msg.c/1.13/Wed Jul 14 10:44:50 2021// +/mandoc_ohash.h/1.2/Mon Oct 19 10:36:43 2020// +/mandoc_parse.h/1.4/Mon Oct 19 10:36:43 2020// +/mandoc_xr.h/1.3/Mon Oct 19 10:36:43 2020// +/mandocdb.c/1.216/Mon Oct 19 10:36:43 2020// +/manpath.c/1.30/Mon Oct 19 10:36:43 2020// +/mansearch.h/1.24/Mon Oct 19 10:36:43 2020// +/mdoc.c/1.164/Mon Oct 19 10:36:43 2020// +/mdoc.h/1.71/Mon Oct 19 10:36:43 2020// +/mdoc_argv.c/1.76/Mon Oct 19 10:36:43 2020// +/mdoc_html.c/1.217/Wed Jul 14 10:44:50 2021// +/mdoc_macro.c/1.191/Mon Oct 19 10:36:43 2020// +/mdoc_man.c/1.135/Wed Jul 14 10:44:50 2021// +/mdoc_markdown.c/1.35/Mon Oct 19 10:36:43 2020// +/mdoc_state.c/1.16/Mon Oct 19 10:36:43 2020// +/mdoc_term.c/1.279/Mon Oct 19 10:36:43 2020// +/mdoc_validate.c/1.303/Wed Jul 14 10:44:50 2021// +/msec.c/1.13/Mon Oct 19 10:36:43 2020// +/msec.in/1.6/Mon Oct 19 10:36:43 2020// +/out.c/1.51/Mon Oct 19 10:36:43 2020// +/out.h/1.25/Mon Oct 19 10:36:43 2020// +/preconv.c/1.9/Mon Oct 19 10:36:43 2020// +/predefs.in/1.4/Mon Oct 19 10:36:43 2020// +/read.c/1.191/Wed Jul 14 10:44:50 2021// +/roff.c/1.249/Result of merge// +/roff.h/1.56/Mon Oct 19 10:36:43 2020// +/roff_html.c/1.20/Mon Oct 19 10:36:43 2020// +/roff_int.h/1.17/Mon Oct 19 10:36:43 2020// +/roff_term.c/1.21/Mon Oct 19 10:36:43 2020// +/roff_validate.c/1.19/Mon Oct 19 10:36:43 2020// +/st.c/1.13/Mon Oct 19 10:36:43 2020// +/tag.h/1.14/Mon Oct 19 10:36:43 2020// +/tbl.c/1.27/Mon Oct 19 10:36:43 2020// +/tbl.h/1.5/Mon Oct 19 10:36:43 2020// +/tbl_data.c/1.42/Wed Jul 14 10:44:50 2021// +/tbl_html.c/1.30/Wed Jul 14 10:44:50 2021// +/tbl_int.h/1.2/Mon Oct 19 10:36:43 2020// +/tbl_layout.c/1.36/Mon Oct 19 10:36:43 2020// +/tbl_opts.c/1.16/Mon Oct 19 10:36:43 2020// +/tbl_parse.h/1.2/Mon Oct 19 10:36:43 2020// +/tbl_term.c/1.62/Wed Jul 14 10:44:50 2021// +/term.c/1.142/Mon Oct 19 10:36:43 2020// +/term.h/1.75/Mon Oct 19 10:36:43 2020// +/term_ascii.c/1.52/Mon Oct 19 10:36:43 2020// +/term_ps.c/1.56/Mon Oct 19 10:36:43 2020// +/term_tab.c/1.4/Mon Oct 19 10:36:43 2020// +/term_tag.c/1.6/Wed Jul 14 10:44:50 2021// +/term_tag.h/1.4/Wed Jul 14 10:44:50 2021// +/tree.c/1.56/Mon Oct 19 10:36:43 2020// D diff --git a/usr.bin/mandoc/CVS/Entries.Log b/usr.bin/mandoc/CVS/Entries.Log new file mode 100644 index 0000000..73c8ed5 --- /dev/null +++ b/usr.bin/mandoc/CVS/Entries.Log @@ -0,0 +1,4 @@ +A D/lib//// +A D/mandoc//// +R D/mandoc//// +R D/lib//// diff --git a/usr.bin/mandoc/apropos.1 b/usr.bin/mandoc/apropos.1 index c81add1..5f1229f 100644 --- a/usr.bin/mandoc/apropos.1 +++ b/usr.bin/mandoc/apropos.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: apropos.1,v 1.43 2020/07/20 14:52:12 schwarze Exp $ +.\" $OpenBSD: apropos.1,v 1.45 2020/10/01 22:47:26 schwarze Exp $ .\" .\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> .\" Copyright (c) 2011,2012,2014,2017,2018 Ingo Schwarze <schwarze@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 20 2020 $ +.Dd $Mdocdate: October 1 2020 $ .Dt APROPOS 1 .Os .Sh NAME @@ -403,6 +403,10 @@ Search in names and descriptions using a case-sensitive regular expression: .Pp .Dl $ apropos \(aq\(tiset.?[ug]id\(aq .Pp +Search for all manual pages in a given section: +.Pp +.Dl $ apropos \-s 9 \&. +.Pp Search for manuals in the library section mentioning both the .Qq optind and the diff --git a/usr.bin/mandoc/arch.c b/usr.bin/mandoc/arch.c index 782f2c7..cc1c456 100644 --- a/usr.bin/mandoc/arch.c +++ b/usr.bin/mandoc/arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arch.c,v 1.12 2020/06/29 19:16:59 schwarze Exp $ */ +/* $OpenBSD: arch.c,v 1.14 2021/05/01 16:11:17 visa Exp $ */ /* * Copyright (c) 2017, 2019 Ingo Schwarze <schwarze@openbsd.org> * @@ -24,7 +24,7 @@ arch_valid(const char *arch, enum mandoc_os os) const char *openbsd_arch[] = { "alpha", "amd64", "arm64", "armv7", "hppa", "i386", "landisk", "loongson", "luna88k", "macppc", "mips64", - "octeon", "powerpc64", "sgi", "sparc64", NULL + "octeon", "powerpc64", "riscv64", "sparc64", NULL }; const char *netbsd_arch[] = { "acorn26", "acorn32", "algor", "alpha", "amiga", diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c index c6db66f..0fa50e1 100644 --- a/usr.bin/mandoc/cgi.c +++ b/usr.bin/mandoc/cgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cgi.c,v 1.111 2020/06/29 19:16:59 schwarze Exp $ */ +/* $OpenBSD: cgi.c,v 1.113 2021/05/01 16:11:17 visa Exp $ */ /* * Copyright (c) 2014-2019 Ingo Schwarze <schwarze@usta.de> * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> @@ -121,14 +121,15 @@ static const char *const arch_names[] = { "amd64", "alpha", "armv7", "arm64", "hppa", "i386", "landisk", "loongson", "luna88k", "macppc", "mips64", "octeon", - "powerpc64", "sgi", "socppc", "sparc64", + "powerpc64", "riscv64", "sparc64", "amiga", "arc", "armish", "arm32", "atari", "aviion", "beagle", "cats", "hppa64", "hp300", "ia64", "mac68k", "mvme68k", "mvme88k", "mvmeppc", "palm", "pc532", "pegasos", - "pmax", "powerpc", "solbourne", "sparc", + "pmax", "powerpc", "sgi", "socppc", + "solbourne", "sparc", "sun3", "vax", "wgrisc", "x68k", "zaurus" }; diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 0225e66..a47dc92 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.141 2020/04/20 12:59:24 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.144 2021/05/22 05:49:32 anton Exp $ */ /* * Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -80,7 +80,7 @@ static const struct htmldata htmltags[TAG_MAX] = { {"h1", HTML_TOPHRASE | HTML_NLAROUND}, {"h2", HTML_TOPHRASE | HTML_NLAROUND}, {"p", HTML_TOPHRASE | HTML_NLAROUND | HTML_INDENT}, - {"pre", HTML_TOPHRASE | HTML_NLALL | HTML_NOINDENT}, + {"pre", HTML_TOPHRASE | HTML_NLAROUND | HTML_NOINDENT}, {"a", HTML_INPHRASE | HTML_TOPHRASE}, {"b", HTML_INPHRASE | HTML_TOPHRASE}, {"cite", HTML_INPHRASE | HTML_TOPHRASE}, @@ -139,6 +139,7 @@ html_alloc(const struct manoutput *outopts) h = mandoc_calloc(1, sizeof(struct html)); h->tag = NULL; + h->metac = h->metal = ESCAPE_FONTROMAN; h->style = outopts->style; if ((h->base_man1 = outopts->man) == NULL) h->base_man2 = NULL; @@ -194,6 +195,8 @@ print_gen_head(struct html *h) struct tag *t; print_otag(h, TAG_META, "?", "charset", "utf-8"); + print_otag(h, TAG_META, "??", "name", "viewport", + "content", "width=device-width, initial-scale=1.0"); if (h->style != NULL) { print_otag(h, TAG_LINK, "?h??", "rel", "stylesheet", h->style, "type", "text/css", "media", "all"); diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h index b291631..354845f 100644 --- a/usr.bin/mandoc/libmandoc.h +++ b/usr.bin/mandoc/libmandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libmandoc.h,v 1.64 2020/04/03 11:34:19 schwarze Exp $ */ +/* $OpenBSD: libmandoc.h,v 1.65 2021/06/27 17:57:13 schwarze Exp $ */ /* * Copyright (c) 2013-2015,2017,2018,2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> @@ -73,7 +73,7 @@ void roff_reset(struct roff *); void roff_man_free(struct roff_man *); struct roff_man *roff_man_alloc(struct roff *, const char *, int); void roff_man_reset(struct roff_man *); -int roff_parseln(struct roff *, int, struct buf *, int *); +int roff_parseln(struct roff *, int, struct buf *, int *, size_t); void roff_userret(struct roff *); void roff_endparse(struct roff *); void roff_setreg(struct roff *, const char *, int, char); diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index e472977..3a5585c 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,6 +1,6 @@ -/* $OpenBSD: main.c,v 1.255 2020/07/21 15:08:48 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.257 2021/06/02 18:27:36 schwarze Exp $ */ /* - * Copyright (c) 2010-2012, 2014-2020 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * @@ -92,7 +92,7 @@ struct outstate { int mandocdb(int, char *[]); -static void check_xr(void); +static void check_xr(struct manpaths *); static int fs_lookup(const struct manpaths *, size_t ipath, const char *, const char *, const char *, @@ -103,7 +103,7 @@ static int fs_search(const struct mansearch *, static void glob_esc(char **, const char *, const char *); static void outdata_alloc(struct outstate *, struct manoutput *); static void parse(struct mparse *, int, const char *, - struct outstate *, struct manoutput *); + struct outstate *, struct manconf *); static void passthrough(int, int); static void process_onefile(struct mparse *, struct manpage *, int, struct outstate *, struct manconf *); @@ -432,7 +432,8 @@ main(int argc, char *argv[]) /* Read the configuration file. */ - if (search.argmode != ARG_FILE) + if (search.argmode != ARG_FILE || + mandoc_msg_getmin() == MANDOCERR_STYLE) manconf_parse(&conf, conf_file, defpaths, auxpaths); /* man(1): Resolve each name individually. */ @@ -826,6 +827,7 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir, if (outst->use_pager) { outst->use_pager = 0; outst->tag_files = term_tag_init(conf->output.outfilename, + outst->outtype == OUTT_HTML ? ".html" : "", conf->output.tagfilename); if ((conf->output.outfilename != NULL || conf->output.tagfilename != NULL) && @@ -842,7 +844,7 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir, } if (resp->form == FORM_SRC) - parse(mp, fd, resp->file, outst, &conf->output); + parse(mp, fd, resp->file, outst, conf); else { passthrough(fd, conf->output.synopsisonly); outst->had_output = 1; @@ -863,8 +865,9 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir, static void parse(struct mparse *mp, int fd, const char *file, - struct outstate *outst, struct manoutput *outconf) + struct outstate *outst, struct manconf *conf) { + static struct manpaths basepaths; static int previous; struct roff_meta *meta; @@ -890,7 +893,7 @@ parse(struct mparse *mp, int fd, const char *file, return; if (outst->outdata == NULL) - outdata_alloc(outst, outconf); + outdata_alloc(outst, &conf->output); else if (outst->outtype == OUTT_HTML) html_reset(outst->outdata); @@ -947,24 +950,25 @@ parse(struct mparse *mp, int fd, const char *file, break; } } - if (outconf->tag != NULL && outconf->tag_found == 0 && - tag_exists(outconf->tag)) - outconf->tag_found = 1; - if (mandoc_msg_getmin() < MANDOCERR_STYLE) - check_xr(); + if (conf->output.tag != NULL && conf->output.tag_found == 0 && + tag_exists(conf->output.tag)) + conf->output.tag_found = 1; + + if (mandoc_msg_getmin() < MANDOCERR_STYLE) { + if (basepaths.sz == 0) + manpath_base(&basepaths); + check_xr(&basepaths); + } else if (mandoc_msg_getmin() < MANDOCERR_WARNING) + check_xr(&conf->manpath); } static void -check_xr(void) +check_xr(struct manpaths *paths) { - static struct manpaths paths; struct mansearch search; struct mandoc_xr *xr; size_t sz; - if (paths.sz == 0) - manpath_base(&paths); - for (xr = mandoc_xr_get(); xr != NULL; xr = xr->next) { if (xr->line == -1) continue; @@ -973,9 +977,9 @@ check_xr(void) search.outkey = NULL; search.argmode = ARG_NAME; search.firstmatch = 1; - if (mansearch(&search, &paths, 1, &xr->name, NULL, &sz)) + if (mansearch(&search, paths, 1, &xr->name, NULL, &sz)) continue; - if (fs_search(&search, &paths, xr->name, NULL, &sz) != -1) + if (fs_search(&search, paths, xr->name, NULL, &sz) != -1) continue; if (xr->count == 1) mandoc_msg(MANDOCERR_XR_BAD, xr->line, diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index a2a1b4d..3d57bad 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.131 2020/04/04 20:23:06 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.132 2020/10/16 17:22:39 schwarze Exp $ */ /* * Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -167,7 +167,12 @@ print_man_node(MAN_ARGS) if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) return; - html_fillmode(h, n->flags & NODE_NOFILL ? ROFF_nf : ROFF_fi); + if ((n->flags & NODE_NOFILL) == 0) + html_fillmode(h, ROFF_fi); + else if (html_fillmode(h, ROFF_nf) == ROFF_nf && + n->tok != ROFF_fi && n->flags & NODE_LINE && + (n->prev == NULL || n->prev->tok != MAN_YS)) + print_endline(h); child = 1; switch (n->type) { @@ -251,13 +256,6 @@ print_man_node(MAN_ARGS) } if (t != NULL) print_stagq(h, t); - - if (n->flags & NODE_NOFILL && n->tok != MAN_YS && - (n->next != NULL && n->next->flags & NODE_LINE)) { - /* In .nf = <pre>, print even empty lines. */ - h->col++; - print_endline(h); - } } static void diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 3bf25ad..3755550 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.188 2020/03/13 00:31:05 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.189 2021/06/28 19:49:57 schwarze Exp $ */ /* * Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> @@ -1019,10 +1019,6 @@ print_man_foot(struct termp *p, const struct roff_meta *meta) */ if ( ! p->mdocstyle) { - if (meta->hasbody) { - term_vspace(p); - term_vspace(p); - } mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); } else if (meta->os != NULL) { @@ -1141,9 +1137,5 @@ print_man_head(struct termp *p, const struct roff_meta *meta) */ term_vspace(p); - if ( ! p->mdocstyle) { - term_vspace(p); - term_vspace(p); - } free(title); } diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index 49aa390..fef8909 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_validate.c,v 1.124 2020/04/24 11:58:02 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.125 2020/10/30 13:24:26 schwarze Exp $ */ /* * Copyright (c) 2010, 2012-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -322,7 +322,7 @@ post_SH(CHKARGS) *cp = '_'; if (nc != NULL && nc->type == ROFFT_TEXT && strcmp(nc->string, tag) == 0) - tag_put(NULL, TAG_WEAK, n); + tag_put(NULL, TAG_STRONG, n); else tag_put(tag, TAG_FALLBACK, n); free(tag); diff --git a/usr.bin/mandoc/mandoc.1 b/usr.bin/mandoc/mandoc.1 index 78c5a4c..6df390c 100644 --- a/usr.bin/mandoc/mandoc.1 +++ b/usr.bin/mandoc/mandoc.1 @@ -1,6 +1,6 @@ -.\" $OpenBSD: mandoc.1,v 1.173 2020/09/01 18:24:09 schwarze Exp $ +.\" $OpenBSD: mandoc.1,v 1.178 2021/07/04 15:38:08 schwarze Exp $ .\" -.\" Copyright (c) 2012, 2014-2020 Ingo Schwarze <schwarze@openbsd.org> +.\" Copyright (c) 2012, 2014-2021 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 1 2020 $ +.Dd $Mdocdate: July 4 2021 $ .Dt MANDOC 1 .Os .Sh NAME @@ -301,8 +301,8 @@ Format input files in .Xr mdoc 7 output style. -Specifically, this suppresses the two additional blank lines near the -top and the bottom of each page, and it implies +This prints the operating system name rather than the page title +on the right side of the footer line, and it implies .Fl O Cm indent Ns =5 . One useful application is for checking that .Fl T Cm man @@ -922,14 +922,6 @@ generated by CVS or .Ic NetBSD keyword substitution as conventionally used in these operating systems. -.It Sy "referenced manual not found" -.Pq mdoc -An -.Ic \&Xr -macro references a manual page that is not found in the base system. -The path to look for base system manuals is configurable at compile -time and defaults to -.Pa /usr/share/man : /usr/X11R6/man . .El .Ss Style suggestions .Bl -ohang @@ -1016,6 +1008,35 @@ list contains two consecutive entries describing the same .Ic \&Er number. +.It Sy "referenced manual not found" +.Pq mdoc +An +.Ic \&Xr +macro references a manual page that was not found. +When running with +.Fl W Cm base , +the search is restricted to the base system, by default to +.Pa /usr/share/man : Ns Pa /usr/X11R6/man . +This path can be configured at compile time using the +.Dv MANPATH_BASE +preprocessor macro. +When running with +.Fl W Cm style , +the search is done along the full search path as described in the +.Xr man 1 +manual page, respecting the +.Fl m +and +.Fl M +command line options, the +.Ev MANPATH +environment variable, the +.Xr man.conf 5 +file and falling back to the default of +.Pa /usr/share/man : Ns Pa /usr/X11R6/man : Ns Pa /usr/local/man , +also configurable at compile time using the +.Dv MANPATH_DEFAULT +preprocessor macro. .It Sy "trailing delimiter" .Pq mdoc The last argument of an @@ -1045,6 +1066,9 @@ An request occurs even though the document already switched to no-fill mode and did not switch back to fill mode yet. It has no effect. +.It Sy "input text line longer than 80 bytes" +Consider breaking the input text line +at one of the blank characters before column 80. .It Sy "verbatim \(dq--\(dq, maybe consider using \e(em" .Pq mdoc Even though the ASCII output device renders an em-dash as @@ -2290,6 +2314,26 @@ or macro or of an undefined macro. The macro is ignored, and its arguments are handled as if they were a text line. +.It Sy "skipping tbl in -Tman mode" +.Pq mdoc , tbl +An input file contains the +.Ic \&TS +macro. +This message is only generated in +.Fl T Cm man +output mode, where +.Xr tbl 7 +input is not supported. +.It Sy "skipping eqn in -Tman mode" +.Pq mdoc , eqn +An input file contains the +.Ic \&EQ +macro. +This message is only generated in +.Fl T Cm man +output mode, where +.Xr eqn 7 +input is not supported. .El .Ss Bad command line arguments .Bl -ohang diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c index 0b2d301..265393d 100644 --- a/usr.bin/mandoc/mandoc.c +++ b/usr.bin/mandoc/mandoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.c,v 1.85 2020/01/19 16:16:32 schwarze Exp $ */ +/* $OpenBSD: mandoc.c,v 1.86 2020/10/24 22:52:34 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> @@ -201,7 +201,18 @@ mandoc_escape(const char **end, const char **start, int *sz) case 'O': case 'V': case 'Y': - gly = (*start)[-1] == 'f' ? ESCAPE_FONT : ESCAPE_IGNORE; + case '*': + switch ((*start)[-1]) { + case 'f': + gly = ESCAPE_FONT; + break; + case '*': + gly = ESCAPE_DEVICE; + break; + default: + gly = ESCAPE_IGNORE; + break; + } switch (**start) { case '(': if ((*start)[-1] == 'O') @@ -236,13 +247,6 @@ mandoc_escape(const char **end, const char **start, int *sz) break; } break; - case '*': - if (strncmp(*start, "(.T", 3) != 0) - abort(); - gly = ESCAPE_DEVICE; - *start = ++*end; - *sz = 2; - break; /* * These escapes are of the form \X'Y', where 'X' is the trigger @@ -457,6 +461,9 @@ mandoc_escape(const char **end, const char **start, int *sz) + 1 == *sz) gly = ESCAPE_UNICODE; break; + case ESCAPE_DEVICE: + assert(*sz == 2 && (*start)[0] == '.' && (*start)[1] == 'T'); + break; default: break; } diff --git a/usr.bin/mandoc/mandoc.css b/usr.bin/mandoc/mandoc.css index 3c4ea18..2b19ba6 100644 --- a/usr.bin/mandoc/mandoc.css +++ b/usr.bin/mandoc/mandoc.css @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.css,v 1.33 2019/06/02 16:50:46 schwarze Exp $ */ +/* $OpenBSD: mandoc.css,v 1.35 2021/03/30 19:23:50 schwarze Exp $ */ /* * Standard style sheet for mandoc(1) -Thtml and man.cgi(8). * @@ -31,6 +31,7 @@ td { vertical-align: top; ul, ol, dl { margin-top: 0em; margin-bottom: 0em; } li, dt { margin-top: 1em; } +pre { font-family: inherit; } .permalink { border-bottom: thin dotted; color: inherit; @@ -135,12 +136,12 @@ h2.Ss { margin-top: 1.2em; vertical-align: top; } .Bl-tag > dd { clear: right; + column-count: 1; /* Force block formatting context. */ width: 100%; margin-top: 0em; margin-left: 0em; margin-bottom: 0.6em; - vertical-align: top; - overflow: auto; } + vertical-align: top; } .Bl-compact { margin-top: 0em; } .Bl-compact > dd { margin-bottom: 0em; } diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h index 3d1a3f9..1aef8c2 100644 --- a/usr.bin/mandoc/mandoc.h +++ b/usr.bin/mandoc/mandoc.h @@ -1,6 +1,6 @@ -/* $OpenBSD: mandoc.h,v 1.211 2020/09/01 18:24:09 schwarze Exp $ */ +/* $OpenBSD: mandoc.h,v 1.214 2021/07/04 15:38:08 schwarze Exp $ */ /* - * Copyright (c) 2012-2020 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2012-2021 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * * Permission to use, copy, modify, and distribute this software for any @@ -54,7 +54,6 @@ enum mandocerr { MANDOCERR_ARCH_BAD, /* unknown architecture: Dt ... arch */ MANDOCERR_OS_ARG, /* operating system explicitly specified: Os ... */ MANDOCERR_RCS_MISSING, /* RCS id missing */ - MANDOCERR_XR_BAD, /* referenced manual not found: Xr name sec */ MANDOCERR_STYLE, /* ===== start of style suggestions ===== */ @@ -68,10 +67,12 @@ enum mandocerr { MANDOCERR_BX, /* consider using OS macro: macro */ MANDOCERR_ER_ORDER, /* errnos out of order: Er ... */ MANDOCERR_ER_REP, /* duplicate errno: Er ... */ + MANDOCERR_XR_BAD, /* referenced manual not found: Xr name sec */ MANDOCERR_DELIM, /* trailing delimiter: macro ... */ MANDOCERR_DELIM_NB, /* no blank before trailing delimiter: macro ... */ MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping: fi */ MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping: nf */ + MANDOCERR_TEXT_LONG, /* input text line longer than 80 bytes */ MANDOCERR_DASHDASH, /* verbatim "--", maybe consider using \(em */ MANDOCERR_FUNC, /* function name without markup: name() */ MANDOCERR_SPACE_EOL, /* whitespace at end of input line */ @@ -244,6 +245,8 @@ enum mandocerr { MANDOCERR_TBLOPT_EQN, /* eqn delim option in tbl: arg */ MANDOCERR_TBLLAYOUT_MOD, /* unsupported tbl layout modifier: m */ MANDOCERR_TBLMACRO, /* ignoring macro in table: macro */ + MANDOCERR_TBL_TMAN, /* skipping tbl in -Tman mode */ + MANDOCERR_EQN_TMAN, /* skipping eqn in -Tman mode */ MANDOCERR_BADARG, /* ===== start of bad invocations ===== */ diff --git a/usr.bin/mandoc/mandoc_msg.c b/usr.bin/mandoc/mandoc_msg.c index d40b7e5..26306da 100644 --- a/usr.bin/mandoc/mandoc_msg.c +++ b/usr.bin/mandoc/mandoc_msg.c @@ -1,6 +1,6 @@ -/* $OpenBSD: mandoc_msg.c,v 1.10 2020/09/01 18:24:10 schwarze Exp $ */ +/* $OpenBSD: mandoc_msg.c,v 1.13 2021/07/04 15:38:09 schwarze Exp $ */ /* - * Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2014-2021 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * * Permission to use, copy, modify, and distribute this software for any @@ -53,7 +53,6 @@ static const char *const type_message[MANDOCERR_MAX] = { "unknown architecture", "operating system explicitly specified", "RCS id missing", - "referenced manual not found", "generic style suggestion", @@ -67,10 +66,12 @@ static const char *const type_message[MANDOCERR_MAX] = { "consider using OS macro", "errnos out of order", "duplicate errno", + "referenced manual not found", "trailing delimiter", "no blank before trailing delimiter", "fill mode already enabled, skipping", "fill mode already disabled, skipping", + "input text line longer than 80 bytes", "verbatim \"--\", maybe consider using \\(em", "function name without markup", "whitespace at end of input line", @@ -242,6 +243,8 @@ static const char *const type_message[MANDOCERR_MAX] = { "eqn delim option in tbl", "unsupported tbl layout modifier", "ignoring macro in table", + "skipping tbl in -Tman mode", + "skipping eqn in -Tman mode", /* bad command line arguments */ NULL, diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index fcff005..e6dbfbe 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,6 +1,6 @@ -/* $OpenBSD: mdoc_html.c,v 1.215 2020/04/19 15:15:54 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.217 2021/03/30 19:23:50 schwarze Exp $ */ /* - * Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2014-2021 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * * Permission to use, copy, modify, and distribute this software for any @@ -347,12 +347,11 @@ print_mdoc_node(MDOC_ARGS) if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) return; - if (n->flags & NODE_NOFILL) { - html_fillmode(h, ROFF_nf); - if (n->flags & NODE_LINE) - print_endline(h); - } else + if ((n->flags & NODE_NOFILL) == 0) html_fillmode(h, ROFF_fi); + else if (html_fillmode(h, ROFF_nf) == ROFF_nf && + n->tok != ROFF_fi && n->flags & NODE_LINE) + print_endline(h); child = 1; n->flags &= ~NODE_ENDED; @@ -929,7 +928,7 @@ mdoc_sx_pre(MDOC_ARGS) static int mdoc_bd_pre(MDOC_ARGS) { - char buf[16]; + char buf[20]; struct roff_node *nn; int comp; @@ -966,6 +965,9 @@ mdoc_bd_pre(MDOC_ARGS) strcmp(n->norm->Bd.offs, "left") != 0) (void)strlcat(buf, " Bd-indent", sizeof(buf)); + if (n->norm->Bd.type == DISP_literal) + (void)strlcat(buf, " Li", sizeof(buf)); + print_otag_id(h, TAG_DIV, buf, n); return 1; } diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index 25d59a5..a2baf55 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,6 +1,6 @@ -/* $OpenBSD: mdoc_man.c,v 1.134 2020/02/27 01:25:57 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.135 2021/07/04 15:38:09 schwarze Exp $ */ /* - * Copyright (c) 2011-2020 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011-2021 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -658,7 +658,20 @@ print_node(DECL_ARGS) do_sub = 1; n->flags &= ~NODE_ENDED; - if (n->type == ROFFT_TEXT) { + switch (n->type) { + case ROFFT_EQN: + case ROFFT_TBL: + mandoc_msg(n->type == ROFFT_EQN ? MANDOCERR_EQN_TMAN : + MANDOCERR_TBL_TMAN, n->line, n->pos, NULL); + outflags |= MMAN_PP | MMAN_sp | MMAN_nl; + print_word("The"); + print_line(".B \\-T man", MMAN_nl); + print_word("output mode does not support"); + print_word(n->type == ROFFT_EQN ? "eqn(7)" : "tbl(7)"); + print_word("input."); + outflags |= MMAN_PP | MMAN_sp | MMAN_nl; + return; + case ROFFT_TEXT: /* * Make sure that we don't happen to start with a * control character at the start of a line. @@ -678,19 +691,18 @@ print_node(DECL_ARGS) outflags &= ~(MMAN_spc | MMAN_spc_force); else if (outflags & MMAN_Sm) outflags |= MMAN_spc; - } else if (n->tok < ROFF_MAX) { - (*roff_man_acts[n->tok])(meta, n); - return; - } else { - /* - * Conditionally run the pre-node action handler for a - * node. - */ + break; + default: + if (n->tok < ROFF_MAX) { + (*roff_man_acts[n->tok])(meta, n); + return; + } act = mdoc_man_act(n->tok); cond = act->cond == NULL || (*act->cond)(meta, n); if (cond && act->pre != NULL && (n->end == ENDBODY_NOT || n->child != NULL)) do_sub = (*act->pre)(meta, n); + break; } /* diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 34668bf..e27de2e 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_validate.c,v 1.302 2020/04/26 21:29:45 schwarze Exp $ */ +/* $OpenBSD: mdoc_validate.c,v 1.303 2020/10/30 13:24:26 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> @@ -2602,7 +2602,7 @@ post_section(POST_ARGS) if ((nch = n->child) != NULL && nch->type == ROFFT_TEXT && strcmp(nch->string, tag) == 0) - tag_put(NULL, TAG_WEAK, n); + tag_put(NULL, TAG_STRONG, n); else tag_put(tag, TAG_FALLBACK, n); free(tag); diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index a6a25de..223dc82 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.190 2020/04/24 11:58:02 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.191 2021/06/27 17:57:13 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> @@ -152,6 +152,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) struct buf *firstln, *lastln, *thisln, *loop; char *cp; size_t pos; /* byte number in the ln buffer */ + size_t spos; /* at the start of the current line parse */ int line_result, result; int of; int lnn; /* line number in the real file */ @@ -178,6 +179,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) curp->filenc & MPARSE_LATIN1) curp->filenc = preconv_cue(&blk, i); } + spos = pos; while (i < blk.sz && (start || blk.buf[i] != '\0')) { @@ -277,7 +279,8 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) of = 0; rerun: - line_result = roff_parseln(curp->roff, curp->line, &ln, &of); + line_result = roff_parseln(curp->roff, curp->line, + &ln, &of, start && spos == 0 ? pos : 0); /* Process options. */ diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 07c977d..484664f 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.c,v 1.248 2020/08/27 12:58:00 schwarze Exp $ */ +/* $OpenBSD: roff.c,v 1.249 2021/06/27 17:57:13 schwarze Exp $ */ /* * Copyright (c) 2010-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -1822,7 +1822,7 @@ roff_parsetext(struct roff *r, struct buf *buf, int pos, int *offs) } int -roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) +roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs, size_t len) { enum roff_tok t; int e; @@ -1833,6 +1833,14 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) ppos = pos = *offs; + if (len > 80 && r->tbl == NULL && r->eqn == NULL && + (r->man->flags & ROFF_NOFILL) == 0 && + strchr(" .\\", buf->buf[pos]) == NULL && + buf->buf[pos] != r->control && + strcspn(buf->buf, " ") < 80) + mandoc_msg(MANDOCERR_TEXT_LONG, ln, (int)len - 1, + "%.20s...", buf->buf + pos); + /* Handle in-line equation delimiters. */ if (r->tbl == NULL && diff --git a/usr.bin/mandoc/tbl_data.c b/usr.bin/mandoc/tbl_data.c index b2556d9..93039de 100644 --- a/usr.bin/mandoc/tbl_data.c +++ b/usr.bin/mandoc/tbl_data.c @@ -1,7 +1,7 @@ -/* $OpenBSD: tbl_data.c,v 1.40 2020/01/11 20:48:13 schwarze Exp $ */ +/* $OpenBSD: tbl_data.c,v 1.42 2021/05/18 13:22:37 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2011,2015,2017,2018,2019 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011,2015,2017-2019,2021 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -44,6 +44,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, struct tbl_dat *dat, *pdat; struct tbl_cell *cp; struct tbl_span *pdp; + const char *ccp; int sv; /* @@ -52,8 +53,11 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, */ sv = *pos; - while (p[*pos] != '\0' && p[*pos] != tbl->opts.tab) - (*pos)++; + ccp = p + sv; + while (*ccp != '\0' && *ccp != tbl->opts.tab) + if (*ccp++ == '\\') + mandoc_escape(&ccp, NULL, NULL); + *pos = ccp - p; /* Advance to the next layout cell, skipping spanners. */ @@ -242,10 +246,11 @@ tbl_data(struct tbl_node *tbl, int ln, const char *p, int pos) struct tbl_cell *cp; struct tbl_span *sp; - rp = (sp = tbl->last_span) == NULL ? tbl->first_row : - sp->pos == TBL_SPAN_DATA && sp->layout->next != NULL ? - sp->layout->next : sp->layout; - + for (sp = tbl->last_span; sp != NULL; sp = sp->prev) + if (sp->pos == TBL_SPAN_DATA) + break; + rp = sp == NULL ? tbl->first_row : + sp->layout->next == NULL ? sp->layout : sp->layout->next; assert(rp != NULL); if (p[1] == '\0') { diff --git a/usr.bin/mandoc/tbl_html.c b/usr.bin/mandoc/tbl_html.c index cbc4bfa..4dda78a 100644 --- a/usr.bin/mandoc/tbl_html.c +++ b/usr.bin/mandoc/tbl_html.c @@ -1,7 +1,7 @@ -/* $OpenBSD: tbl_html.c,v 1.28 2019/03/17 18:20:07 schwarze Exp $ */ +/* $OpenBSD: tbl_html.c,v 1.30 2021/05/16 23:16:22 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2014,2015,2017,2018,2021 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -117,6 +117,7 @@ print_tbl(struct html *h, const struct tbl_span *sp) const char *hspans, *vspans, *halign, *valign; const char *bborder, *lborder, *rborder; char hbuf[4], vbuf[4]; + enum mandoc_esc save_font; int i; if (h->tblt == NULL) @@ -238,8 +239,17 @@ print_tbl(struct html *h, const struct tbl_span *sp) "vertical-align", valign, "text-align", halign, "border-right-style", rborder); - if (dp->string != NULL) + if (dp->string != NULL) { + save_font = h->metac; + if (dp->layout->flags & TBL_CELL_BOLD) + html_setfont(h, ESCAPE_FONTBOLD); + else if (dp->layout->flags & TBL_CELL_ITALIC) + html_setfont(h, ESCAPE_FONTITALIC); + if (dp->layout->pos == TBL_CELL_LONG) + print_text(h, "\\[u2003]"); /* em space */ print_text(h, dp->string); + html_setfont(h, save_font); + } } print_tagq(h, tt); diff --git a/usr.bin/mandoc/tbl_term.c b/usr.bin/mandoc/tbl_term.c index 238bf7a..8f2d67c 100644 --- a/usr.bin/mandoc/tbl_term.c +++ b/usr.bin/mandoc/tbl_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tbl_term.c,v 1.61 2020/01/11 16:24:33 schwarze Exp $ */ +/* $OpenBSD: tbl_term.c,v 1.62 2020/10/25 18:21:07 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2020 Ingo Schwarze <schwarze@openbsd.org> @@ -188,17 +188,6 @@ term_tbl(struct termp *tp, const struct tbl_span *sp) tblcalc(&tp->tbl, sp, tp->tcol->offset, tp->tcol->rmargin); - /* Tables leak .ta settings to subsequent text. */ - - term_tab_set(tp, NULL); - coloff = sp->opts->opts & (TBL_OPT_BOX | TBL_OPT_DBOX) || - sp->opts->lvert; - for (ic = 0; ic < sp->opts->cols; ic++) { - coloff += tp->tbl.cols[ic].width; - term_tab_iset(coloff); - coloff += tp->tbl.cols[ic].spacing; - } - /* Center the table as a whole. */ offset = tp->tcol->offset; diff --git a/usr.bin/mandoc/term_tag.c b/usr.bin/mandoc/term_tag.c index 86ad01e..2d44650 100644 --- a/usr.bin/mandoc/term_tag.c +++ b/usr.bin/mandoc/term_tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term_tag.c,v 1.5 2020/07/21 15:08:49 schwarze Exp $ */ +/* $OpenBSD: term_tag.c,v 1.6 2021/02/19 19:49:49 kn Exp $ */ /* * Copyright (c) 2015,2016,2018,2019,2020 Ingo Schwarze <schwarze@openbsd.org> * @@ -45,7 +45,8 @@ static struct tag_files tag_files; * but for simplicity, create it anyway. */ struct tag_files * -term_tag_init(const char *outfilename, const char *tagfilename) +term_tag_init(const char *outfilename, const char *suffix, + const char *tagfilename) { struct sigaction sa; int ofd; /* In /tmp/, dup(2)ed to stdout. */ @@ -83,9 +84,9 @@ term_tag_init(const char *outfilename, const char *tagfilename) /* Create both temporary output files. */ if (outfilename == NULL) { - (void)strlcpy(tag_files.ofn, "/tmp/man.XXXXXXXXXX", - sizeof(tag_files.ofn)); - if ((ofd = mkstemp(tag_files.ofn)) == -1) { + (void)snprintf(tag_files.ofn, sizeof(tag_files.ofn), + "/tmp/man.XXXXXXXXXX%s", suffix); + if ((ofd = mkstemps(tag_files.ofn, strlen(suffix))) == -1) { mandoc_msg(MANDOCERR_MKSTEMP, 0, 0, "%s: %s", tag_files.ofn, strerror(errno)); goto fail; diff --git a/usr.bin/mandoc/term_tag.h b/usr.bin/mandoc/term_tag.h index fc692d7..8809df2 100644 --- a/usr.bin/mandoc/term_tag.h +++ b/usr.bin/mandoc/term_tag.h @@ -1,4 +1,4 @@ -/* $OpenBSD: term_tag.h,v 1.3 2020/07/21 15:08:49 schwarze Exp $ */ +/* $OpenBSD: term_tag.h,v 1.4 2021/02/19 19:49:49 kn Exp $ */ /* * Copyright (c) 2015, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org> * @@ -28,7 +28,7 @@ struct tag_files { }; -struct tag_files *term_tag_init(const char *, const char *); +struct tag_files *term_tag_init(const char *, const char *, const char *); void term_tag_write(struct roff_node *, size_t); int term_tag_close(void); void term_tag_unlink(void); |