Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jul 2017 19:34:38 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321810 - in head: contrib/mdocml usr.bin/mandoc
Message-ID:  <201707311934.v6VJYcMx002466@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Mon Jul 31 19:34:38 2017
New Revision: 321810
URL: https://svnweb.freebsd.org/changeset/base/321810

Log:
  Update mandoc to 1.14.2

Added:
  head/contrib/mdocml/compat_recallocarray.c
     - copied unchanged from r321808, vendor/mdocml/dist/compat_recallocarray.c
  head/contrib/mdocml/mandoc_xr.c
     - copied unchanged from r321808, vendor/mdocml/dist/mandoc_xr.c
  head/contrib/mdocml/mandoc_xr.h
     - copied unchanged from r321808, vendor/mdocml/dist/mandoc_xr.h
  head/contrib/mdocml/test-recallocarray.c
     - copied unchanged from r321808, vendor/mdocml/dist/test-recallocarray.c
Modified:
  head/contrib/mdocml/INSTALL
  head/contrib/mdocml/LICENSE
  head/contrib/mdocml/Makefile
  head/contrib/mdocml/Makefile.depend
  head/contrib/mdocml/NEWS
  head/contrib/mdocml/TODO
  head/contrib/mdocml/apropos.1
  head/contrib/mdocml/att.c
  head/contrib/mdocml/cgi.c
  head/contrib/mdocml/chars.c
  head/contrib/mdocml/config.h
  head/contrib/mdocml/configure
  head/contrib/mdocml/configure.local.example
  head/contrib/mdocml/demandoc.c
  head/contrib/mdocml/eqn.7
  head/contrib/mdocml/eqn.c
  head/contrib/mdocml/eqn_html.c
  head/contrib/mdocml/eqn_term.c
  head/contrib/mdocml/gmdiff
  head/contrib/mdocml/html.c
  head/contrib/mdocml/html.h
  head/contrib/mdocml/lib.c
  head/contrib/mdocml/libmandoc.h
  head/contrib/mdocml/libroff.h
  head/contrib/mdocml/main.c
  head/contrib/mdocml/man.7
  head/contrib/mdocml/man.c
  head/contrib/mdocml/man.options.1
  head/contrib/mdocml/man_html.c
  head/contrib/mdocml/man_macro.c
  head/contrib/mdocml/man_term.c
  head/contrib/mdocml/man_validate.c
  head/contrib/mdocml/manconf.h
  head/contrib/mdocml/mandoc.1
  head/contrib/mdocml/mandoc.3
  head/contrib/mdocml/mandoc.c
  head/contrib/mdocml/mandoc.css
  head/contrib/mdocml/mandoc.h
  head/contrib/mdocml/mandoc_aux.c
  head/contrib/mdocml/mandoc_aux.h
  head/contrib/mdocml/mandoc_char.7
  head/contrib/mdocml/mandoc_escape.3
  head/contrib/mdocml/mandoc_headers.3
  head/contrib/mdocml/mandoc_html.3
  head/contrib/mdocml/mandocd.c
  head/contrib/mdocml/mandocdb.c
  head/contrib/mdocml/manpath.c
  head/contrib/mdocml/mansearch.c
  head/contrib/mdocml/mdoc.7
  head/contrib/mdocml/mdoc.c
  head/contrib/mdocml/mdoc_html.c
  head/contrib/mdocml/mdoc_man.c
  head/contrib/mdocml/mdoc_markdown.c
  head/contrib/mdocml/mdoc_term.c
  head/contrib/mdocml/mdoc_validate.c
  head/contrib/mdocml/msec.in
  head/contrib/mdocml/out.c
  head/contrib/mdocml/out.h
  head/contrib/mdocml/read.c
  head/contrib/mdocml/roff.7
  head/contrib/mdocml/roff.c
  head/contrib/mdocml/roff.h
  head/contrib/mdocml/roff_html.c
  head/contrib/mdocml/roff_int.h
  head/contrib/mdocml/roff_term.c
  head/contrib/mdocml/roff_validate.c
  head/contrib/mdocml/soelim.1
  head/contrib/mdocml/st.c
  head/contrib/mdocml/st.in
  head/contrib/mdocml/tbl.7
  head/contrib/mdocml/tbl.c
  head/contrib/mdocml/tbl_data.c
  head/contrib/mdocml/tbl_html.c
  head/contrib/mdocml/tbl_layout.c
  head/contrib/mdocml/tbl_term.c
  head/contrib/mdocml/term.c
  head/contrib/mdocml/term.h
  head/contrib/mdocml/term_ascii.c
  head/contrib/mdocml/term_tab.c
  head/contrib/mdocml/tree.c
  head/usr.bin/mandoc/Makefile
Directory Properties:
  head/contrib/mdocml/   (props changed)

Modified: head/contrib/mdocml/INSTALL
==============================================================================
--- head/contrib/mdocml/INSTALL	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/INSTALL	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,22 +1,24 @@
-$Id: INSTALL,v 1.18 2017/02/08 12:24:10 schwarze Exp $
+$Id: INSTALL,v 1.20 2017/07/28 14:57:56 schwarze Exp $
 
-About mdocml, the portable mandoc distribution
-----------------------------------------------
-The mandoc manpage compiler toolset is a suite of tools compiling
-mdoc(7), the roff(7) macro language of choice for BSD manual pages,
-and man(7), the predominant historical language for UNIX manuals.
+About the portable mandoc distribution
+--------------------------------------
+The mandoc manpage compiler toolset (formerly called "mdocml")
+is a suite of tools compiling mdoc(7), the roff(7) macro language
+of choice for BSD manual pages, and man(7), the predominant
+historical language for UNIX manuals.
+
 It includes a man(1) manual viewer and additional tools.
-For general information, see <http://mdocml.bsd.lv/>.
+For general information, see <http://mandoc.bsd.lv/>.
 
 In case you have questions or want to provide feedback, read
-<http://mdocml.bsd.lv/contact.html>.  Consider subscribing to the
+<http://mandoc.bsd.lv/contact.html>.  Consider subscribing to the
 discuss@ mailing list mentioned on that page.  If you intend to
 help with the development of mandoc, consider subscribing to the
 tech@ mailing list, too.
 
 Enjoy using the mandoc toolset!
 
-Ingo Schwarze, Karlsruhe, February 2017
+Ingo Schwarze, Karlsruhe, July 2017
 
 
 Installation
@@ -25,7 +27,7 @@ Before manually installing mandoc on your system, plea
 whether the newest version of mandoc is already installed by default
 or available via a binary package or a ports system.  A list of the
 latest bundled and ported versions of mandoc for various operating
-systems is maintained at <http://mdocml.bsd.lv/ports.html>.
+systems is maintained at <http://mandoc.bsd.lv/ports.html>.
 
 Regarding how packages and ports are maintained for your operating
 system, please consult your operating system documentation.
@@ -35,7 +37,7 @@ To install mandoc manually, the following steps are ne
 run the command "echo BUILD_CGI=1 >> configure.local".
 Then run "cp cgi.h.example cgi.h" and edit cgi.h as desired.
 
-2. If you also want to build the new catman(8) utility, run the
+2. If you also want to build the catman(8) utility, run the
 command "echo BUILD_CATMAN=1 >> configure.local".  Note that it
 is unlikely to be a drop-in replacement providing the same
 functionality as your system's "catman", if your operating
@@ -75,7 +77,7 @@ command like "make DESTDIR=... install".  Read the *-i
 in the "Makefile" to understand how DESTDIR is used.
 
 9. Run the command "sudo makewhatis" to build mandoc.db(5) databases
-in all the directory trees configured in step 6.  Whenever installing
+in all the directory trees configured in step 3.  Whenever installing
 new manual pages, re-run makewhatis(8) to update the databases, or
 apropos(1) will not find the new pages.
 

Modified: head/contrib/mdocml/LICENSE
==============================================================================
--- head/contrib/mdocml/LICENSE	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/LICENSE	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,7 +1,7 @@
-$Id: LICENSE,v 1.15 2017/02/21 00:37:03 schwarze Exp $
+$Id: LICENSE,v 1.17 2017/06/23 15:58:14 schwarze Exp $
 
 With the exceptions noted below, all code and documentation
-contained in the mdocml toolkit is protected by the Copyright
+contained in the mandoc toolkit is protected by the Copyright
 of the following developers:
 
 Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -13,7 +13,7 @@ Copyright (c) 2016 Ed Maste <emaste@freebsd.org>
 Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
 Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
 Copyright (c) 1998, 2004, 2010 Todd C. Miller <Todd.Miller@courtesan.com>
-Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
+Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
 Copyright (c) 2004 Ted Unangst <tedu@openbsd.org>
 Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
 Copyright (c) 2003, 2007, 2008, 2014 Jason McIntyre <jmc@openbsd.org>
@@ -22,7 +22,7 @@ See the individual source files for information about 
 to which file during which years.
 
 
-The mdocml distribution as a whole is distributed by its developers
+The mandoc distribution as a whole is distributed by its developers
 under the following license:
 
 Permission to use, copy, modify, and distribute this software for any

Modified: head/contrib/mdocml/Makefile
==============================================================================
--- head/contrib/mdocml/Makefile	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/Makefile	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.512 2017/05/07 17:31:45 schwarze Exp $
+# $Id: Makefile,v 1.516 2017/07/20 16:24:53 schwarze Exp $
 #
 # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
 # Copyright (c) 2011, 2013-2017 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.
 
-VERSION = 1.14.1
+VERSION = 1.14.2
 
 # === LIST OF FILES ====================================================
 
@@ -38,6 +38,7 @@ TESTSRCS	 = test-be32toh.c \
 		   test-progname.c \
 		   test-recvmsg.c \
 		   test-reallocarray.c \
+		   test-recallocarray.c \
 		   test-rewb-bsd.c \
 		   test-rewb-sysv.c \
 		   test-sandbox_init.c \
@@ -64,6 +65,7 @@ SRCS		 = att.c \
 		   compat_ohash.c \
 		   compat_progname.c \
 		   compat_reallocarray.c \
+		   compat_recallocarray.c \
 		   compat_strcasestr.c \
 		   compat_stringlist.c \
 		   compat_strlcat.c \
@@ -92,6 +94,7 @@ SRCS		 = att.c \
 		   mandoc.c \
 		   mandoc_aux.c \
 		   mandoc_ohash.c \
+		   mandoc_xr.c \
 		   mandocd.c \
 		   mandocdb.c \
 		   manpath.c \
@@ -178,6 +181,7 @@ DISTFILES	 = INSTALL \
 		   mandoc_html.3 \
 		   mandoc_malloc.3 \
 		   mandoc_ohash.h \
+		   mandoc_xr.h \
 		   mandocd.8 \
 		   mansearch.3 \
 		   mansearch.h \
@@ -227,6 +231,7 @@ LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
 		   mandoc.o \
 		   mandoc_aux.o \
 		   mandoc_ohash.o \
+		   mandoc_xr.o \
 		   msec.o \
 		   preconv.o \
 		   read.o
@@ -240,6 +245,7 @@ COMPAT_OBJS	 = compat_err.o \
 		   compat_ohash.o \
 		   compat_progname.o \
 		   compat_reallocarray.o \
+		   compat_recallocarray.o \
 		   compat_strcasestr.o \
 		   compat_strlcat.o \
 		   compat_strlcpy.o \
@@ -341,9 +347,6 @@ WWW_MANS	 = apropos.1.html \
 		   mdoc.h.html \
 		   roff.h.html
 
-WWW_OBJS	 = mdocml.tar.gz \
-		   mdocml.sha256
-
 # === USER CONFIGURATION ===============================================
 
 include Makefile.local
@@ -354,7 +357,7 @@ all: mandoc demandoc soelim $(BUILD_TARGETS) Makefile.
 
 install: base-install $(INSTALL_TARGETS)
 
-www: $(WWW_OBJS) $(WWW_MANS)
+www: $(WWW_MANS)
 
 $(WWW_MANS): mandoc
 
@@ -372,10 +375,10 @@ clean:
 	rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS)
 	rm -f mandoc $(MAIN_OBJS)
 	rm -f man.cgi $(CGI_OBJS)
-	rm -f mandocd catman $(MANDOCD_OBJS)
+	rm -f mandocd catman catman.o $(MANDOCD_OBJS)
 	rm -f demandoc $(DEMANDOC_OBJS)
 	rm -f soelim $(SOELIM_OBJS)
-	rm -f $(WWW_MANS) $(WWW_OBJS)
+	rm -f $(WWW_MANS) mandoc.tar.gz mandoc.sha256
 	rm -rf *.dSYM
 
 base-install: mandoc demandoc soelim
@@ -509,13 +512,7 @@ soelim: $(SOELIM_OBJS)
 # --- maintainer targets ---
 
 www-install: www
-	mkdir -p $(HTDOCDIR)/snapshots
 	$(INSTALL_DATA) $(WWW_MANS) mandoc.css $(HTDOCDIR)
-	$(INSTALL_DATA) $(WWW_OBJS) $(HTDOCDIR)/snapshots
-	$(INSTALL_DATA) mdocml.tar.gz \
-		$(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz
-	$(INSTALL_DATA) mdocml.sha256 \
-		$(HTDOCDIR)/snapshots/mdocml-$(VERSION).sha256
 
 depend: config.h
 	mkdep -f Makefile.depend $(CFLAGS) $(SRCS)
@@ -542,24 +539,25 @@ regress-distcheck:
 		! -name '*.out_ascii' \
 		! -name '*.out_utf8' \
 		! -name '*.out_html' \
+		! -name '*.out_markdown' \
 		! -name '*.out_lint' \
 		! -path regress/regress.pl \
 		! -path regress/regress.pl.1
 
-dist: mdocml.sha256
+dist: mandoc.sha256
 
-mdocml.sha256: mdocml.tar.gz
-	sha256 mdocml.tar.gz > $@
+mandoc.sha256: mandoc.tar.gz
+	sha256 mandoc.tar.gz > $@
 
-mdocml.tar.gz: $(DISTFILES)
+mandoc.tar.gz: $(DISTFILES)
 	ls regress/*/*/*.mandoc_* && exit 1 || true
-	mkdir -p .dist/mdocml-$(VERSION)/
-	$(INSTALL) -m 0644 $(DISTFILES) .dist/mdocml-$(VERSION)
-	cp -pR regress .dist/mdocml-$(VERSION)
-	find .dist/mdocml-$(VERSION)/regress \
+	mkdir -p .dist/mandoc-$(VERSION)/
+	$(INSTALL) -m 0644 $(DISTFILES) .dist/mandoc-$(VERSION)
+	cp -pR regress .dist/mandoc-$(VERSION)
+	find .dist/mandoc-$(VERSION)/regress \
 	    -type d -name CVS -print0 | xargs -0 rm -rf
-	chmod 755 .dist/mdocml-$(VERSION)/configure
-	( cd .dist/ && tar zcf ../$@ mdocml-$(VERSION) )
+	chmod 755 .dist/mandoc-$(VERSION)/configure
+	( cd .dist/ && tar zcf ../$@ mandoc-$(VERSION) )
 	rm -rf .dist/
 
 # === SUFFIX RULES =====================================================

Modified: head/contrib/mdocml/Makefile.depend
==============================================================================
--- head/contrib/mdocml/Makefile.depend	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/Makefile.depend	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@
-att.o: att.c config.h roff.h mdoc.h libmdoc.h
+att.o: att.c config.h mandoc.h roff.h mdoc.h libmdoc.h
 catman.o: catman.c config.h compat_fts.h
 cgi.o: cgi.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h main.h manconf.h mansearch.h cgi.h
 chars.o: chars.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h libmandoc.h
@@ -11,6 +11,7 @@ compat_mkdtemp.o: compat_mkdtemp.c config.h
 compat_ohash.o: compat_ohash.c config.h compat_ohash.h
 compat_progname.o: compat_progname.c config.h
 compat_reallocarray.o: compat_reallocarray.c config.h
+compat_recallocarray.o: compat_recallocarray.c config.h
 compat_strcasestr.o: compat_strcasestr.c config.h
 compat_stringlist.o: compat_stringlist.c config.h compat_stringlist.h
 compat_strlcat.o: compat_strlcat.c config.h
@@ -24,44 +25,45 @@ dba_read.o: dba_read.c mandoc_aux.h mansearch.h dba_ar
 dba_write.o: dba_write.c config.h dba_write.h
 dbm.o: dbm.c config.h mansearch.h dbm_map.h dbm.h
 dbm_map.o: dbm_map.c config.h mansearch.h dbm_map.h dbm.h
-demandoc.o: demandoc.c config.h roff.h man.h mdoc.h mandoc.h
-eqn.o: eqn.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
+demandoc.o: demandoc.c config.h mandoc.h roff.h man.h mdoc.h
+eqn.o: eqn.c config.h mandoc_aux.h mandoc.h roff.h libmandoc.h libroff.h
 eqn_html.o: eqn_html.c config.h mandoc.h out.h html.h
 eqn_term.o: eqn_term.c config.h mandoc.h out.h term.h
 html.o: html.c config.h mandoc_aux.h mandoc.h roff.h out.h html.h manconf.h main.h
-lib.o: lib.c config.h roff.h mdoc.h libmdoc.h lib.in
-main.o: main.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h tag.h main.h manconf.h mansearch.h
+lib.o: lib.c config.h mandoc.h roff.h mdoc.h libmdoc.h lib.in
+main.o: main.c config.h mandoc_aux.h mandoc.h mandoc_xr.h roff.h mdoc.h man.h tag.h main.h manconf.h mansearch.h
 man.o: man.c config.h mandoc_aux.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
-man_html.o: man_html.c config.h mandoc_aux.h roff.h man.h out.h html.h main.h
+man_html.o: man_html.c config.h mandoc_aux.h mandoc.h roff.h man.h out.h html.h main.h
 man_macro.o: man_macro.c config.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
 man_term.o: man_term.c config.h mandoc_aux.h mandoc.h roff.h man.h out.h term.h main.h
 man_validate.o: man_validate.c config.h mandoc_aux.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h
-mandoc.o: mandoc.c config.h mandoc.h mandoc_aux.h libmandoc.h
+mandoc.o: mandoc.c config.h mandoc_aux.h mandoc.h roff.h libmandoc.h
 mandoc_aux.o: mandoc_aux.c config.h mandoc.h mandoc_aux.h
 mandoc_ohash.o: mandoc_ohash.c mandoc_aux.h mandoc_ohash.h compat_ohash.h
+mandoc_xr.o: mandoc_xr.c mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc_xr.h
 mandocd.o: mandocd.c config.h mandoc.h roff.h mdoc.h man.h main.h manconf.h
 mandocdb.o: mandocdb.c config.h compat_fts.h mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc.h roff.h mdoc.h man.h manconf.h mansearch.h dba_array.h dba.h
 manpath.o: manpath.c config.h mandoc_aux.h manconf.h
 mansearch.o: mansearch.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h manconf.h mansearch.h dbm.h
 mdoc.o: mdoc.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
 mdoc_argv.o: mdoc_argv.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
-mdoc_html.o: mdoc_html.c config.h mandoc_aux.h roff.h mdoc.h out.h html.h main.h
+mdoc_html.o: mdoc_html.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h out.h html.h main.h
 mdoc_macro.o: mdoc_macro.c config.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
 mdoc_man.o: mdoc_man.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h out.h main.h
 mdoc_markdown.o: mdoc_markdown.c mandoc_aux.h mandoc.h roff.h mdoc.h main.h
 mdoc_state.o: mdoc_state.c mandoc.h roff.h mdoc.h libmandoc.h libmdoc.h
 mdoc_term.o: mdoc_term.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h out.h term.h tag.h main.h
-mdoc_validate.o: mdoc_validate.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
+mdoc_validate.o: mdoc_validate.c config.h mandoc_aux.h mandoc.h mandoc_xr.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
 msec.o: msec.c config.h mandoc.h libmandoc.h msec.in
 out.o: out.c config.h mandoc_aux.h mandoc.h out.h
 preconv.o: preconv.c config.h mandoc.h libmandoc.h
-read.o: read.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h libmandoc.h roff_int.h
+read.o: read.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h libmandoc.h
 roff.o: roff.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h roff.h libmandoc.h roff_int.h libroff.h predefs.in
-roff_html.o: roff_html.c roff.h out.h html.h
-roff_term.o: roff_term.c roff.h out.h term.h
+roff_html.o: roff_html.c mandoc.h roff.h out.h html.h
+roff_term.o: roff_term.c mandoc.h roff.h out.h term.h
 roff_validate.o: roff_validate.c mandoc.h roff.h libmandoc.h roff_int.h
 soelim.o: soelim.c config.h compat_stringlist.h
-st.o: st.c config.h roff.h mdoc.h libmdoc.h st.in
+st.o: st.c config.h mandoc.h roff.h mdoc.h libmdoc.h st.in
 tag.o: tag.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h tag.h
 tbl.o: tbl.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
 tbl_data.o: tbl_data.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h

Modified: head/contrib/mdocml/NEWS
==============================================================================
--- head/contrib/mdocml/NEWS	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/NEWS	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,7 +1,93 @@
-$Id: NEWS,v 1.21 2017/02/21 00:37:03 schwarze Exp $
+$Id: NEWS,v 1.26 2017/07/28 14:57:56 schwarze Exp $
 
-This file lists the most important changes in the mdocml.bsd.lv distribution.
+This file lists the most important changes in the mandoc.bsd.lv distribution.
 
+Changes in version 1.14.2, released on July 28, 2017
+
+    --- MAJOR NEW FEATURES ---
+ * New mdoc(7) -Tmarkdown output mode.
+ * For -Thtml, implement internal hyperlinks pointing to authoritative
+   definitions of various syntax elements, similar to the ctags(1)-like
+   less(1) :t internal searching in terminal mode.
+ * Provide a superset of the functionality of the former mdoclint(1)
+   utility and a new -Wstyle message level with several new messages,
+   including validity checking of .Xr cross references.
+ * tbl(7): Implement automatic line breaking inside individual table
+   cells, and several other formatting improvements.
+ * eqn(7): Complete rewrite of the lexer, resulting in several bugfixes.
+ * Continue parser unification, in particular allowing generation
+   of syntax tree nodes on the roff(7) level, allowing implementation
+   of many additional roff requests.
+    --- REMOVED FUNCTIONALITY ---
+ * Delete the manpage(1) utility.  It was never enabled in any release.
+ * Delete the -Txhtml command line option.  It has been an obsolete
+   alias for the -Thtml output mode for more than two years.
+    --- MINOR NEW FEATURES ---
+ * -Tlint now puts parser messages on stdout instead of stderr,
+   making commands like "man -l -Tlint *.1" useful.
+ * mdoc(7): Various .Lk formatting improvements.
+ * mdoc(7) -Thtml: Better CSS for .Bl lists.
+ * man(7): Implement the .MT/.ME block macro (mailto hyperlink).
+ * man(7): Implement the .DT macro (restore default tab positions).
+ * man(7): Improved support for manuals generated with reStructuredText
+   by partial support for the \n[an-margin] number register.
+ * man(7) -Thtml: Support deep linking to .SH and .SS headers.
+ * tbl(7): Implement the "allbox" table option.
+ * tbl(7): Implement the column spacing and the 'w' (minimum column
+   width) layout modifiers.
+ * tbl(7): Significant improvements of the manual page.
+ * eqn(7): Much improved font selection, including recognition of
+   well-known function names, and a few other formatting improvements.
+ * eqn(7) -Thtml: Use <mn> and <mo> in addition to <mi>.
+ * roff(7): Implement the .ce (centering), .mc (margin character),
+   .rj (right justify), .ta (define tab stops), .ti (temporary indent),
+   .als (macro alias), .ec and .eo (escape character control),
+   .po (page offset), and .rn (macro rename) requests.
+ * roff(7) .am: Implement appending to mdoc(7) and man(7) macros.
+ * roff(7): implement the \h (horizontol motion), \l (horizontal
+   line drawing), and \p (break output line) escape sequences,
+   and also several additional character escape sequences.
+ * roff(7): Implement the 'd' conditional (macro or string defined).
+ * man.cgi(8) now uses pledge(2), too.
+ * regress.pl(1): simpler user interface, better summary output,
+   simpler code, and no more recursion.
+    --- THANKS TO ---
+ * Anthony Bentley (OpenBSD) for the implementation of .MT/.ME,
+   reports of many bugs and missing features, and suggestions
+   for a number of feature and documentation improvements.
+ * Sebastien Marie (OpenBSD) for two source code patches and
+   for some useful discussions.
+ * Florian Obser (OpenBSD) for a bugfix patch and a bug report.
+ * Jonathan Gray (OpenBSD) for several bug reports from afl(1)
+   and several more from static analysis tools.
+ * Theo Buehler (OpenBSD) for several bug reports, most from afl(1).
+ * Jason McIntyre (OpenBSD) for many useful discussions about a
+   wide variety of topics, lots of continuous testing, a number of
+   bug reports, and some suggestions for messages and documentation.
+ * Thomas Klausner (NetBSD) for lots of help while migrating
+   mdoclint(1) functionality to mandoc -Tlint, for suggesting
+   several useful new messages, and for release testing.
+ * Reyk Floeter (OpenBSD) and Vsevolod Stakhov (FreeBSD) for
+   suggesting a markdown output mode.
+ * Thomas Guettler for suggesting -Thtml internal hyperlinks.
+ * Yuri Pankov (Illumos) for inspiring new warning messages and
+   for extensive release testing.
+ * Anton Lindqvist and TJ Townsend (both OpenBSD) and Jan Stary
+   for multiple bug reports.
+ * Leah Neukirchen (Void Linux) for bug reports and release testing.
+ * Michael Stapelberg (Debian) for suggesting feature improvements
+   and for release testing.
+ * Martin Natano and Theo de Raadt (both OpenBSD), Andreas Voegele,
+   Gabriel Guzman, Gonzalo Tornaria, Markus Waldeck, and Raf Czlonka
+   for bug reports.
+ * Antoine Jacoutot (OpenBSD) and Steffen Nurpmeso for suggesting
+   feature improvements.
+ * Dag-Erling Smoergrav (FreeBSD) for inspiring new warning messages.
+ * Ted Unangst and Marc Espie (OpenBSD) for providing useful ideas.
+ * Svyatoslav Mishyn (Crux Linux) for release testing.
+ * Carsten Kunze (Heirloom roff) for help keeping mandoc and groff
+   compatible and for committing some of my patches to groff.
+
 Changes in version 1.14.1, released on February 21, 2017
 
     --- MAJOR NEW FEATURES ---
@@ -274,11 +360,11 @@ Changes in version 1.13.3, released on March 13, 2015
  * New -Wunsupp message level.
     --- POTENTIONALLY SECURITY RELEVANT BUGFIXES ---
  * Fix a potential write buffer overrun on incomplete string conditionals.
-   http://mdocml.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.241
+   http://mandoc.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.241
  * Fix a potential write buffer overrun on backslash at EOF in a conditional.
-   http://mdocml.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.247
+   http://mandoc.bsd.lv/cgi-bin/cvsweb/roff.c#rev1.247
  * Fix a use after free sometimes hit when validation deletes a block.
-   http://mdocml.bsd.lv/cgi-bin/cvsweb/mdoc_macro.c#rev1.180
+   http://mandoc.bsd.lv/cgi-bin/cvsweb/mdoc_macro.c#rev1.180
     --- MAJOR FUNCTIONALLY RELEVANT BUGFIXES ---
  * Let man(1) show manuals for the current architecture by default,
    and support the MACHINE environment variable.
@@ -889,4 +975,4 @@ Changes in version 1.9.15, released on February 18, 20
  * and column lengths handled correctly.
 
 For older releases, see the ChangeLog files
-in http://mdocml.bsd.lv/snapshots/ .
+in http://mandoc.bsd.lv/snapshots/ .

Modified: head/contrib/mdocml/TODO
==============================================================================
--- head/contrib/mdocml/TODO	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/TODO	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,6 +1,6 @@
 ************************************************************************
 * Official mandoc TODO.
-* $Id: TODO,v 1.237 2017/05/16 19:06:30 schwarze Exp $
+* $Id: TODO,v 1.246 2017/07/24 11:15:12 schwarze Exp $
 ************************************************************************
 
 Many issues are annotated for difficulty as follows:
@@ -65,21 +65,10 @@ are mere guesses, and some may be wrong.
   found by jca@ in ratpoison(1)  Sun, 30 Jun 2013 12:01:09 +0200
   loc *  exist **  algo **  size **  imp **
 
-- \h horizontal move
-  #2 most important issue naddy@  Mon, 16 Feb 2015 20:59:17 +0100
-  found in cclive(1) nasm(1) bogofilter(1) asciidoc/DocBook output
-  bentley@ on discuss@  Sat, 21 Sep 2013 22:29:34 -0600
-  naddy@  Thu, 4 Dec 2014 16:26:41 +0100
-  loc **  exist **  algo **  size *  imp *** (parser reorg helps a lot)
-
 - \n+ and \n- numerical register increment and decrement
   found by bentley@ in sbcl(1)  Mon, 9 Dec 2013 18:36:57 -0700
   loc *  exist *  algo *  size *  imp **
 
-- \n(.$ macro argument count number register; ocserv(8) by autogen
-  found by sthen@  Thu, 19 Feb 2015 22:03:01 +0000
-  loc *  exist **  algo *  size *  imp **
-
 - \w'' improve width measurements
   would not be very useful without an expression parser, see below
   needed for Tcl_NewStringObj(3) via wiz@  Wed, 5 Mar 2014 22:27:43 +0100
@@ -183,22 +172,6 @@ are mere guesses, and some may be wrong.
 
 --- missing tbl features -----------------------------------------------
 
-- horizontal lines in the layout still consume data cells
-  and can be mixed with actual data on the same table line
-  synaptics(4) found by tedu@  Mon, 17 Aug 2015 21:17:42 -0400
-  loc **  exist **  algo **  size **  imp ***
-
-- break long text into lines inside cells
-  net/lftp(1) from jirib via bentley@ Sep 13, 2016
-
-- layout l1 for a column of max text width 3 reduces the following
-  inter-column spacing for groff, but not for mandoc
-  net/lftp(1) from jirib via bentley@ Sep 13, 2016
-
-- the "w" layout option is ignored
-  synaptics(4) found by tedu@  Mon, 17 Aug 2015 21:17:42 -0400
-  loc *  exist *  algo *  size *  imp **
-
 - the "s" layout column specifier is used for placement of data
   into columns, but ignored during column width calculations
   synaptics(4) found by tedu@  Mon, 17 Aug 2015 21:17:42 -0400
@@ -240,6 +213,16 @@ are mere guesses, and some may be wrong.
   see User's Guide (Second Edition) page 5 section 15.
   loc **  exist **  algo **  size **  imp **
 
+- GNU eqn converts some operators to special characters, for example,
+  input HYPHEN-MINUS becomes output \(mi, unless it is part of a
+  quoted word.  mandoc(1) only does this when the operator is
+  surrounded by blanks, not when it is part of an unquoted word.
+  Also, check whether there are more such cases (e.g., +?).
+  reported by bentley@  20 Jun 2017 02:04:29 -0600
+
+- Primes, opprime, and '
+  bentley@  Thu, 13 Jul 2017 23:14:20 -0600
+
 --- missing misc features ----------------------------------------------
 
 - italic correction (\/) in PostScript mode
@@ -359,6 +342,12 @@ are mere guesses, and some may be wrong.
   .Vt vs .Vt/.Va vs .Ft/.Va vs .Ft/.Fa ...
   from kristaps@  Tue, 08 Jun 2010 11:13:32 +0200
 
+- implicit whitespace around inline equations
+  example code:  where '$times$' denotes matrix multiplication
+  must not have an HTML line break, nor a blank, before <math>
+  partial solution: html.c {"math", HTML_NLINSIDE | HTML_INDENT},
+  bentley@  Thu, 13 Jul 2017 19:00:59 -0600
+
 - in enclosures, mandoc sometimes fancies a bogus end of sentence
   reminded by jmc@  Thu, 23 Sep 2010 18:13:39 +0059
   loc *  exist **  algo ***  size *  imp ***
@@ -421,9 +410,6 @@ are mere guesses, and some may be wrong.
   Steffen Nurpmeso  Sat, 08 Nov 2014 13:34:59 +0100
   loc *  exist **  algo **  size *  imp **
 
-- .Lk formatting for long links with line breaks
-  Franco Fichtner  8 Oct 2013 00:33:42 +0200
-
 - In .Bl -enum -width 0n, groff continues one the same line after
   the number, mandoc breaks the line.
   mail to kristaps@  Mon, 20 Jul 2009 02:21:39 +0200
@@ -450,16 +436,6 @@ are mere guesses, and some may be wrong.
   Probably, this should be fixed somewhere in termp_it_pre(), not sure.
   loc *  exist **  algo **  size *  imp **
 
-- .Nx 1.0a
-  should be "NetBSD 1.0A", not "NetBSD 1.0a",
-  see OpenBSD ccdconfig(8).
-  loc *  exist *  algo *  size *  imp **
-
-- In .Bl -tag, if a tag exceeds the right margin and must be continued
-  on the next line, it must be indented by -width, not width+1;
-  see "rule block|pass" in OpenBSD ifconfig(8).
-  loc *  exist ***  algo **  size *  imp **
-
 - When the -width string contains macros, the macros must be rendered
   before measuring the width, for example
     .Bl -tag -width ".Dv message"
@@ -495,15 +471,24 @@ are mere guesses, and some may be wrong.
 * warning issues
 ************************************************************************
 
-- provide a way in mandoc(1) to warn about broken .Xr links;
-  probably cannot be on by default in -Tlint because it needs
-  to access the manpath and mandoc.db(3) after parsing.
-  asked for by jmc@ Fri, 4 Dec 2015 22:39:40 +0000
+- style message about macros inside .Bd -literal and .Dl, in particular
+  font changing macros like .Cm, .Ar, .Fa (from the mdoclint TODO)
 
+- style message about mismatches between the section number in the
+  file name (if it is known) and the section number in .Dt
+  (from the mdoclint TODO)
+
+- style message about NULL without .Dv (from the mdoclint TODO)
+
+- style message about error constants without .Er (from the mdoclint TODO)
+
 - warn when .Sh or .Ss contain other macros
   Steffen Nurpmeso, savannah.gnu.org/bugs/index.php?45034
   loc *  exist *  algo *  size *  imp **
 
+- style message about violations of the convention
+  .An name Aq Mt localpart@domain in AUTHORS (from the mdoclint TODO)
+
 - warn about attempts to call non-callable macros
   Steffen Nurpmeso  Tue, 11 Nov 2014 22:55:16 +0100
   Note that formatting is inconsistent in groff.
@@ -512,25 +497,25 @@ are mere guesses, and some may be wrong.
   all over mdoc_macro.c and all subtly different.
   loc **  exist **  algo **  size **  imp **
 
+- style message about suspicious uses of - vs. \- vs. \(mi
+  e.g. -1 is likely wrong (from the mdoclint TODO)
+
+- warn about punctuation - e.g. ',' and ';' - at the beginning
+  of a text line, if it is likely intended to follow the preceding
+  output without intervening whitespace, in particular after a
+  macro line (from the mdoclint TODO)
+
 - mandoc_special does not really check the escape sequence,
   but just the overall format
   loc **  exist **  algo ***  size **  imp **
 
-- integrate mdoclint into mandoc ("end-of-line whitespace" thread)
-  from jmc@  Mon, 13 Jul 2009 17:12:09 +0100
-  from kristaps@  Mon, 13 Jul 2009 18:34:53 +0200
-  from jmc@  Mon, 13 Jul 2009 17:45:37 +0059
-  from kristaps@  Mon, 13 Jul 2009 19:02:03 +0200
-  (mostly done, check what remains)
-
-- -Tlint parser errors and warnings to stdout
-  to tech@mdocml, naddy@  Wed, 28 Sep 2011 11:21:46 +0200
-  wait!  kristaps@  Sun, 02 Oct 2011 17:12:52 +0200
-
 ************************************************************************
 * documentation issues
 ************************************************************************
 
+- dashes, hyphens, and minus signs in manual pages
+  jmc@ Fri, 28 Mar 2014 07:19:27 +0000
+
 - mark macros as: page structure domain, manual domain, general text domain
   is this useful?
 
@@ -543,11 +528,6 @@ are mere guesses, and some may be wrong.
 * performance issues
 ************************************************************************
 
-- Why are we using MAP_SHARED, not MAP_PRIVATE for mmap(2)?
-  from kristaps@  Sat, 09 Aug 2014 13:51:36 +0200
-
-Several areas can be cleaned up to make mandoc even faster.  These are
-
 - the PDF file is HUGE: this can be reduced by using relative offsets
 
 ************************************************************************
@@ -565,13 +545,13 @@ Several areas can be cleaned up to make mandoc even fa
   same-line from different-line input.  That plainly doesn't work
   with user-defined macros, leading to random breakage.
 
+- Is it possible to further simplify ENDBODY_SPACE?
+
 - Find better ways to prevent endless loops
   in roff(7) macro and string expansion.
 
-- Finish cleanup of date handling.
-  Decide which formats should be recognized where.
-  Update both mdoc(7) and man(7) documentation.
-  Triggered by  Tim van der Molen  Tue, 22 Feb 2011 20:30:45 +0100
+- make buffers for parsing functions const
+  christos@ via wiz@  Fri, 18 Dec 2015 17:10:01 +0100
 
 - struct mparse refactoring
   Steffen Nurpmeso  Thu, 04 Sep 2014 12:50:00 +0200

Modified: head/contrib/mdocml/apropos.1
==============================================================================
--- head/contrib/mdocml/apropos.1	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/apropos.1	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@
-.\"	$Id: apropos.1,v 1.45 2017/03/27 18:51:36 schwarze Exp $
+.\"	$Id: apropos.1,v 1.46 2017/07/04 23:40:01 schwarze Exp $
 .\"
 .\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
 .\" Copyright (c) 2011, 2012, 2014, 2017 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: March 27 2017 $
+.Dd $Mdocdate: July 4 2017 $
 .Dt APROPOS 1
 .Os
 .Sh NAME
@@ -407,7 +407,7 @@ variables:
 .Dl $ apropos \-s 3 Va=optind \-a Va=optarg
 .Pp
 Do exactly the same as calling
-.Xr whatis 1
+.Nm whatis
 with the argument
 .Qq ssh :
 .Pp

Modified: head/contrib/mdocml/att.c
==============================================================================
--- head/contrib/mdocml/att.c	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/att.c	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@
-/*	$Id: att.c,v 1.15 2015/10/06 18:32:19 schwarze Exp $ */
+/*	$Id: att.c,v 1.16 2017/06/24 14:38:32 schwarze Exp $ */
 /*
  * Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
  *
@@ -19,6 +19,7 @@
 #include <sys/types.h>
 #include <string.h>
 
+#include "mandoc.h"
 #include "roff.h"
 #include "mdoc.h"
 #include "libmdoc.h"

Modified: head/contrib/mdocml/cgi.c
==============================================================================
--- head/contrib/mdocml/cgi.c	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/cgi.c	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@
-/*	$Id: cgi.c,v 1.154 2017/04/19 01:00:03 schwarze Exp $ */
+/*	$Id: cgi.c,v 1.156 2017/06/24 14:38:32 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@usta.de>
@@ -140,16 +140,16 @@ html_putchar(char c)
 {
 
 	switch (c) {
-	case ('"'):
+	case '"':
 		printf("&quot;");
 		break;
-	case ('&'):
+	case '&':
 		printf("&amp;");
 		break;
-	case ('>'):
+	case '>':
 		printf("&gt;");
 		break;
-	case ('<'):
+	case '<':
 		printf("&lt;");
 		break;
 	default:
@@ -832,7 +832,7 @@ resp_format(const struct req *req, const char *file)
 
 	mchars_alloc();
 	mp = mparse_alloc(MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1,
-	    MANDOCLEVEL_BADARG, NULL, req->q.manpath);
+	    MANDOCERR_MAX, NULL, MANDOC_OS_OTHER, req->q.manpath);
 	mparse_readfd(mp, fd, file);
 	close(fd);
 

Modified: head/contrib/mdocml/chars.c
==============================================================================
--- head/contrib/mdocml/chars.c	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/chars.c	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@
-/*	$Id: chars.c,v 1.70 2017/06/02 12:43:52 schwarze Exp $ */
+/*	$Id: chars.c,v 1.71 2017/06/14 20:57:07 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2011, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -61,6 +61,7 @@ static struct ln lines[] = {
 	{ "ba",			"|",		0x007c	},
 	{ "br",			"|",		0x2502	},
 	{ "ul",			"_",		0x005f	},
+	{ "ru",			"_",		0x005f	},
 	{ "rn",			"-",		0x203e	},
 	{ "bb",			"|",		0x00a6	},
 	{ "sl",			"/",		0x002f	},

Copied: head/contrib/mdocml/compat_recallocarray.c (from r321808, vendor/mdocml/dist/compat_recallocarray.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/mdocml/compat_recallocarray.c	Mon Jul 31 19:34:38 2017	(r321810, copy of r321808, vendor/mdocml/dist/compat_recallocarray.c)
@@ -0,0 +1,108 @@
+#include "config.h"
+
+#if HAVE_RECALLOCARRAY
+
+int dummy;
+
+#else
+
+/*	$Id: compat_recallocarray.c,v 1.1 2017/06/12 19:05:47 schwarze Exp $ */
+/*	$OpenBSD: malloc.c,v 1.225 2017/05/13 07:11:29 otto Exp $ */
+/*
+ * Copyright (c) 2017 Otto Moerbeek <otto@drijf.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
+ * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
+ */
+#define MUL_NO_OVERFLOW	((size_t)1 << (sizeof(size_t) * 4))
+
+/*
+ * Even though specified in POSIX, the PAGESIZE and PAGE_SIZE
+ * macros have very poor portability.  Since we only use this
+ * to avoid free() overhead for small shrinking, simply pick
+ * an arbitrary number.
+ */
+#define MALLOC_PAGESIZE         (1UL << 12)
+
+
+void *
+recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size)
+{
+	size_t oldsize, newsize;
+	void *newptr;
+
+	if (ptr == NULL)
+		return calloc(newnmemb, size);
+
+	if ((newnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+	    newnmemb > 0 && SIZE_MAX / newnmemb < size) {
+		errno = ENOMEM;
+		return NULL;
+	}
+	newsize = newnmemb * size;
+
+	if ((oldnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+	    oldnmemb > 0 && SIZE_MAX / oldnmemb < size) {
+		errno = EINVAL;
+		return NULL;
+	}
+	oldsize = oldnmemb * size;
+
+	/*
+	 * Don't bother too much if we're shrinking just a bit,
+	 * we do not shrink for series of small steps, oh well.
+	 */
+	if (newsize <= oldsize) {
+		size_t d = oldsize - newsize;
+
+		if (d < oldsize / 2 && d < MALLOC_PAGESIZE) {
+			memset((char *)ptr + newsize, 0, d);
+			return ptr;
+		}
+	}
+
+	newptr = malloc(newsize);
+	if (newptr == NULL)
+		return NULL;
+
+	if (newsize > oldsize) {
+		memcpy(newptr, ptr, oldsize);
+		memset((char *)newptr + oldsize, 0, newsize - oldsize);
+	} else
+		memcpy(newptr, ptr, newsize);
+
+	/*
+	 * At this point, the OpenBSD implementation calls
+	 * explicit_bzero() on the old memory before it is
+	 * freed.  Since explicit_bzero() is hard to implement
+	 * portably and we don't handle confidential data in
+	 * mandoc in the first place, simply free the memory
+	 * without clearing it.
+	 */
+
+	free(ptr);
+
+	return newptr;
+}
+
+#endif /* !HAVE_RECALLOCARRAY */

Modified: head/contrib/mdocml/config.h
==============================================================================
--- head/contrib/mdocml/config.h	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/config.h	Mon Jul 31 19:34:38 2017	(r321810)
@@ -10,14 +10,18 @@
 #define _GNU_SOURCE	/* See test-*.c what needs this. */
 #endif
 
+#include <sys/types.h>
 
 #define MAN_CONF_FILE "/etc/man.conf"
+#define MANPATH_BASE "/usr/share/man"
 #define MANPATH_DEFAULT "/usr/share/man:/usr/local/man"
 #define UTF8_LOCALE "en_US.UTF-8"
+#define HAVE_CMSG_XPG42 0
 #define HAVE_DIRENT_NAMLEN 1
 #define HAVE_ENDIAN 0
 #define HAVE_ERR 1
 #define HAVE_FTS 1
+#define HAVE_FTS_COMPARE_CONST 1
 #define HAVE_GETLINE 1
 #define HAVE_GETSUBOPT 1
 #define HAVE_ISBLANK 1
@@ -26,6 +30,7 @@
 #define HAVE_PLEDGE 0
 #define HAVE_PROGNAME 1
 #define HAVE_REALLOCARRAY 1
+#define HAVE_RECALLOCARRAY 0
 #define HAVE_REWB_BSD 1
 #define HAVE_REWB_SYSV 1
 #define HAVE_SANDBOX_INIT 0
@@ -40,10 +45,11 @@
 #define HAVE_VASPRINTF 1
 #define HAVE_WCHAR 1
 #define HAVE_OHASH 1
-#define HAVE_FTS_COMPARE_CONST 1
 
 #define BINM_APROPOS "apropos"
 #define BINM_MAKEWHATIS "makewhatis"
 #define BINM_MAN "man"
 #define BINM_SOELIM "soelim"
 #define BINM_WHATIS "whatis"
+
+extern	void	 *recallocarray(void *, size_t, size_t, size_t);

Modified: head/contrib/mdocml/configure
==============================================================================
--- head/contrib/mdocml/configure	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/configure	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $Id: configure,v 1.62 2017/03/04 16:36:29 schwarze Exp $
+# $Id: configure,v 1.64 2017/07/01 09:47:30 schwarze Exp $
 #
 # Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
 #
@@ -35,6 +35,7 @@ echo "config.log: writing..."
 
 SOURCEDIR=`dirname "$0"`
 
+MANPATH_BASE="/usr/share/man:/usr/X11R6/man"
 MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man"
 OSNAME=
 UTF8_LOCALE=
@@ -73,6 +74,7 @@ HAVE_PATH_MAX=
 HAVE_PLEDGE=
 HAVE_PROGNAME=
 HAVE_REALLOCARRAY=
+HAVE_RECALLOCARRAY=
 HAVE_RECVMSG=
 HAVE_REWB_BSD=
 HAVE_REWB_SYSV=
@@ -229,6 +231,7 @@ runtest pledge		PLEDGE		|| true
 runtest sandbox_init	SANDBOX_INIT	|| true
 runtest progname	PROGNAME	|| true
 runtest reallocarray	REALLOCARRAY	|| true
+runtest recallocarray	RECALLOCARRAY	|| true
 runtest rewb-bsd	REWB_BSD	|| true
 runtest rewb-sysv	REWB_SYSV	|| true
 runtest strcasestr	STRCASESTR	|| true
@@ -348,7 +351,8 @@ cat << __HEREDOC__
 
 __HEREDOC__
 
-[ ${HAVE_GETLINE} -eq 0 -o ${HAVE_REALLOCARRAY} -eq 0 -o \
+[ ${HAVE_GETLINE} -eq 0 -o \
+  ${HAVE_REALLOCARRAY} -eq 0 -o ${HAVE_RECALLOCARRAY} -eq 0 -o \
   ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 ] \
 	&& echo "#include <sys/types.h>"
 [ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
@@ -356,6 +360,7 @@ __HEREDOC__
 
 echo
 echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
+echo "#define MANPATH_BASE \"${MANPATH_BASE}\""
 echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
 [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
 [ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
@@ -383,6 +388,7 @@ cat << __HEREDOC__
 #define HAVE_PLEDGE ${HAVE_PLEDGE}
 #define HAVE_PROGNAME ${HAVE_PROGNAME}
 #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
+#define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
 #define HAVE_REWB_BSD ${HAVE_REWB_BSD}
 #define HAVE_REWB_SYSV ${HAVE_REWB_SYSV}
 #define HAVE_SANDBOX_INIT ${HAVE_SANDBOX_INIT}
@@ -433,6 +439,9 @@ fi
 
 [ ${HAVE_REALLOCARRAY} -eq 0 ] && \
 	echo "extern	void	 *reallocarray(void *, size_t, size_t);"
+
+[ ${HAVE_RECALLOCARRAY} -eq 0 ] && \
+	echo "extern	void	 *recallocarray(void *, size_t, size_t, size_t);"
 
 [ ${HAVE_STRCASESTR} -eq 0 ] && \
 	echo "extern	char	 *strcasestr(const char *, const char *);"

Modified: head/contrib/mdocml/configure.local.example
==============================================================================
--- head/contrib/mdocml/configure.local.example	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/configure.local.example	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@
-# $Id: configure.local.example,v 1.30 2017/03/04 16:36:29 schwarze Exp $
+# $Id: configure.local.example,v 1.33 2017/07/20 16:24:53 schwarze Exp $
 #
 # Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
 #
@@ -20,7 +20,7 @@
 # and put any of these settings into it if ./configure autodetection
 # fails or if you want to make different choices for other reasons.
 
-# If autodetection fails, please tell <tech@mdocml.bsd.lv>.
+# If autodetection fails, please tell <tech@mandoc.bsd.lv>.
 
 # We recommend that you write ./configure.local from scratch and
 # only put the lines there you need.  This file contains examples.
@@ -62,6 +62,11 @@ UTF8_LOCALE=en_US.UTF-8
 
 MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man"
 
+# Validation of cross references with mandoc -Tlint only looks
+# for manual pages in the following directories:
+
+MANPATH_BASE="/usr/share/man:/usr/X11R6/man"
+
 # In manual pages written in the mdoc(7) language, the operating system
 # version is displayed in the page footer line.  If an operating system
 # is specified as an argument to the .Os macro, that is always used.
@@ -292,6 +297,7 @@ HAVE_PATH_MAX=0
 HAVE_PLEDGE=0
 HAVE_PROGNAME=0
 HAVE_REALLOCARRAY=0
+HAVE_RECALLOCARRAY=0
 HAVE_REWB_BSD=0
 HAVE_REWB_SYSV=0
 HAVE_STRCASESTR=0

Modified: head/contrib/mdocml/demandoc.c
==============================================================================
--- head/contrib/mdocml/demandoc.c	Mon Jul 31 19:30:23 2017	(r321809)
+++ head/contrib/mdocml/demandoc.c	Mon Jul 31 19:34:38 2017	(r321810)
@@ -1,4 +1,4 @@

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707311934.v6VJYcMx002466>