svn commit: r279527 - in head: contrib/mdocml usr.bin/man

Baptiste Daroussin bapt at FreeBSD.org
Mon Mar 2 16:59:03 UTC 2015


Author: bapt
Date: Mon Mar  2 16:58:57 2015
New Revision: 279527
URL: https://svnweb.freebsd.org/changeset/base/279527

Log:
  Update mandoc to cvs snaphot from 20150302
  
  Use the new unsupp warning level to detect the unsupported manpages in man(1)

Added:
  head/contrib/mdocml/Makefile.local
     - copied unchanged from r279526, vendor/mdocml/dist/Makefile.local
  head/contrib/mdocml/compat_strtonum.c
     - copied unchanged from r279526, vendor/mdocml/dist/compat_strtonum.c
  head/contrib/mdocml/test-strtonum.c
     - copied unchanged from r279526, vendor/mdocml/dist/test-strtonum.c
Modified:
  head/contrib/mdocml/LICENSE
  head/contrib/mdocml/Makefile
  head/contrib/mdocml/Makefile.depend
  head/contrib/mdocml/TODO
  head/contrib/mdocml/apropos.1
  head/contrib/mdocml/cgi.c
  head/contrib/mdocml/chars.c
  head/contrib/mdocml/chars.in
  head/contrib/mdocml/compat_fts.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_term.c
  head/contrib/mdocml/example.style.css
  head/contrib/mdocml/gmdiff
  head/contrib/mdocml/html.c
  head/contrib/mdocml/libman.h
  head/contrib/mdocml/libmandoc.h
  head/contrib/mdocml/libmdoc.h
  head/contrib/mdocml/libroff.h
  head/contrib/mdocml/main.c
  head/contrib/mdocml/main.h
  head/contrib/mdocml/man-cgi.css
  head/contrib/mdocml/man.1
  head/contrib/mdocml/man.7
  head/contrib/mdocml/man.c
  head/contrib/mdocml/man.h
  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/mandoc.1
  head/contrib/mdocml/mandoc.3
  head/contrib/mdocml/mandoc.c
  head/contrib/mdocml/mandoc.db.5
  head/contrib/mdocml/mandoc.h
  head/contrib/mdocml/mandoc_char.7
  head/contrib/mdocml/mandoc_escape.3
  head/contrib/mdocml/mandoc_headers.3
  head/contrib/mdocml/mandocdb.c
  head/contrib/mdocml/manpage.c
  head/contrib/mdocml/mansearch.c
  head/contrib/mdocml/mdoc.7
  head/contrib/mdocml/mdoc.c
  head/contrib/mdocml/mdoc.h
  head/contrib/mdocml/mdoc_argv.c
  head/contrib/mdocml/mdoc_html.c
  head/contrib/mdocml/mdoc_macro.c
  head/contrib/mdocml/mdoc_man.c
  head/contrib/mdocml/mdoc_term.c
  head/contrib/mdocml/mdoc_validate.c
  head/contrib/mdocml/msec.c
  head/contrib/mdocml/out.c
  head/contrib/mdocml/preconv.c
  head/contrib/mdocml/read.c
  head/contrib/mdocml/roff.7
  head/contrib/mdocml/roff.c
  head/contrib/mdocml/st.in
  head/contrib/mdocml/style.css
  head/contrib/mdocml/tbl.3
  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_opts.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_ps.c
  head/contrib/mdocml/tree.c
  head/usr.bin/man/man.sh
Directory Properties:
  head/contrib/mdocml/   (props changed)

Modified: head/contrib/mdocml/LICENSE
==============================================================================
--- head/contrib/mdocml/LICENSE	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/LICENSE	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,16 +1,17 @@
-$Id: LICENSE,v 1.5 2014/12/11 07:56:24 schwarze Exp $
+$Id: LICENSE,v 1.7 2015/02/16 14:56:22 schwarze Exp $
 
 With the exceptions noted below, all code and documentation
 contained in the mdocml toolkit is protected by the Copyright
 of the following developers:
 
 Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps at bsd.lv>
-Copyright (c) 2010, 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze at openbsd.org>
+Copyright (c) 2010-2015 Ingo Schwarze <schwarze at openbsd.org>
 Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger <joerg at netbsd.org>
 Copyright (c) 2013 Franco Fichtner <franco at lastsummer.de>
 Copyright (c) 1999, 2004 Marc Espie <espie at openbsd.org>
-Copyright (c) 1998, 2010 Todd C. Miller <Todd.Miller at courtesan.com>
+Copyright (c) 1998, 2004, 2010 Todd C. Miller <Todd.Miller at courtesan.com>
 Copyright (c) 2008 Otto Moerbeek <otto at drijf.net>
+Copyright (c) 2004 Ted Unangst <tedu at openbsd.org>
 Copyright (c) 2003, 2007, 2008, 2014 Jason McIntyre <jmc at openbsd.org>
 
 See the individual source files for information about who contributed

Modified: head/contrib/mdocml/Makefile
==============================================================================
--- head/contrib/mdocml/Makefile	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/Makefile	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.453 2014/12/09 09:14:33 schwarze Exp $
+# $Id: Makefile,v 1.456 2015/02/16 16:23:54 schwarze Exp $
 #
 # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps at bsd.lv>
 # Copyright (c) 2011, 2013, 2014 Ingo Schwarze <schwarze at openbsd.org>
@@ -15,6 +15,8 @@
 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
+VERSION = 1.13.2
+
 # === LIST OF FILES ====================================================
 
 TESTSRCS	 = test-dirent-namlen.c \
@@ -31,6 +33,7 @@ TESTSRCS	 = test-dirent-namlen.c \
 		   test-strlcpy.c \
 		   test-strptime.c \
 		   test-strsep.c \
+		   test-strtonum.c \
 		   test-wchar.c
 
 SRCS		 = att.c \
@@ -46,6 +49,7 @@ SRCS		 = att.c \
 		   compat_strlcat.c \
 		   compat_strlcpy.c \
 		   compat_strsep.c \
+		   compat_strtonum.c \
 		   demandoc.c \
 		   eqn.c \
 		   eqn_html.c \
@@ -189,7 +193,8 @@ COMPAT_OBJS	 = compat_fgetln.o \
 		   compat_strcasestr.o \
 		   compat_strlcat.o \
 		   compat_strlcpy.o \
-		   compat_strsep.o
+		   compat_strsep.o \
+		   compat_strtonum.o
 
 MANDOC_HTML_OBJS = eqn_html.o \
 		   html.o \
@@ -211,6 +216,7 @@ BASE_OBJS	 = $(MANDOC_HTML_OBJS) \
 		   $(MANDOC_MAN_OBJS) \
 		   $(MANDOC_TERM_OBJS) \
 		   main.o \
+		   manpath.o \
 		   out.o \
 		   tree.o
 
@@ -218,8 +224,7 @@ MAIN_OBJS	 = $(BASE_OBJS)
 
 DB_OBJS		 = mandocdb.o \
 		   mansearch.o \
-		   mansearch_const.o \
-		   manpath.o
+		   mansearch_const.o
 
 CGI_OBJS	 = $(MANDOC_HTML_OBJS) \
 		   cgi.o \
@@ -308,10 +313,12 @@ base-install: base-build
 	mkdir -p $(DESTDIR)$(MANDIR)/man3
 	mkdir -p $(DESTDIR)$(MANDIR)/man7
 	$(INSTALL_PROGRAM) mandoc demandoc $(DESTDIR)$(BINDIR)
+	ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_MAN)
 	$(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
 	$(INSTALL_LIB) man.h mandoc.h mandoc_aux.h mdoc.h \
 		$(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_MAN) mandoc.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
+	$(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
 	$(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \
 		mchars_alloc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
 	$(INSTALL_MAN) man.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MAN}.7
@@ -330,12 +337,10 @@ db-install: base-build
 	mkdir -p $(DESTDIR)$(MANDIR)/man5
 	mkdir -p $(DESTDIR)$(MANDIR)/man8
 	ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_APROPOS)
-	ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_MAN)
 	ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_WHATIS)
 	ln -f $(DESTDIR)$(BINDIR)/mandoc \
 		$(DESTDIR)$(SBINDIR)/$(BINM_MAKEWHATIS)
 	$(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1
-	$(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
 	ln -f $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1 \
 		$(DESTDIR)$(MANDIR)/man1/$(BINM_WHATIS).1
 	$(INSTALL_MAN) mansearch.3 $(DESTDIR)$(MANDIR)/man3
@@ -377,7 +382,7 @@ demandoc: $(DEMANDOC_OBJS) libmandoc.a
 
 www-install: www
 	mkdir -p $(HTDOCDIR)/snapshots
-	$(INSTALL_DATA) $(WWW_MANS) style.css $(HTDOCDIR)/man
+	$(INSTALL_DATA) $(WWW_MANS) style.css $(HTDOCDIR)
 	$(INSTALL_DATA) $(WWW_OBJS) $(HTDOCDIR)/snapshots
 	$(INSTALL_DATA) mdocml.tar.gz \
 		$(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz

Modified: head/contrib/mdocml/Makefile.depend
==============================================================================
--- head/contrib/mdocml/Makefile.depend	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/Makefile.depend	Mon Mar  2 16:58:57 2015	(r279527)
@@ -11,6 +11,7 @@ compat_strcasestr.o: compat_strcasestr.c
 compat_strlcat.o: compat_strlcat.c config.h
 compat_strlcpy.o: compat_strlcpy.c config.h
 compat_strsep.o: compat_strsep.c config.h
+compat_strtonum.o: compat_strtonum.c config.h
 demandoc.o: demandoc.c config.h man.h mdoc.h mandoc.h
 eqn.o: eqn.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
 eqn_html.o: eqn_html.c config.h mandoc.h out.h html.h
@@ -39,7 +40,7 @@ mdoc_macro.o: mdoc_macro.c config.h mdoc
 mdoc_man.o: mdoc_man.c config.h mandoc.h mandoc_aux.h out.h man.h mdoc.h main.h
 mdoc_term.o: mdoc_term.c config.h mandoc.h mandoc_aux.h out.h term.h mdoc.h main.h
 mdoc_validate.o: mdoc_validate.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h
-msec.o: msec.c config.h libmandoc.h msec.in
+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.h mandoc_aux.h libmandoc.h mdoc.h man.h
@@ -69,4 +70,5 @@ test-strlcat.o: test-strlcat.c
 test-strlcpy.o: test-strlcpy.c
 test-strptime.o: test-strptime.c
 test-strsep.o: test-strsep.c
+test-strtonum.o: test-strtonum.c
 test-wchar.o: test-wchar.c

Copied: head/contrib/mdocml/Makefile.local (from r279526, vendor/mdocml/dist/Makefile.local)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/mdocml/Makefile.local	Mon Mar  2 16:58:57 2015	(r279527, copy of r279526, vendor/mdocml/dist/Makefile.local)
@@ -0,0 +1,30 @@
+BUILD_TARGETS	= base-build
+INSTALL_TARGETS	= base-install db-install
+CFLAGS		= -g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -I/usr/local/include
+DBLIB		= -L/usr/local/lib -lsqlite3
+STATIC		= -static
+PREFIX		= /usr/local
+BINDIR		= /usr/local/bin
+SBINDIR		= /usr/local/sbin
+INCLUDEDIR	= /usr/local/include/mandoc
+LIBDIR		= /usr/local/lib/mandoc
+MANDIR		= /usr/local/man
+EXAMPLEDIR	= /usr/local/share/examples/mandoc
+WWWPREFIX	= /var/www
+HTDOCDIR	= /var/www/htdocs
+CGIBINDIR	= /var/www/cgi-bin
+BINM_APROPOS	= apropos
+BINM_MAN	= man
+BINM_WHATIS	= whatis
+BINM_MAKEWHATIS	= makewhatis
+MANM_MAN	= man
+MANM_MDOC	= mdoc
+MANM_ROFF	= roff
+MANM_EQN	= eqn
+MANM_TBL	= tbl
+INSTALL		= install
+INSTALL_PROGRAM	= install -m 0555
+INSTALL_LIB	= install -m 0444
+INSTALL_MAN	= install -m 0444
+INSTALL_DATA	= install -m 0444
+MAIN_OBJS	= $(BASE_OBJS) $(DB_OBJS)

Modified: head/contrib/mdocml/TODO
==============================================================================
--- head/contrib/mdocml/TODO	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/TODO	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,6 +1,6 @@
 ************************************************************************
 * Official mandoc TODO.
-* $Id: TODO,v 1.195 2014/12/13 13:14:39 schwarze Exp $
+* $Id: TODO,v 1.201 2015/02/20 13:47:28 schwarze Exp $
 ************************************************************************
 
 Many issues are annotated for difficulty as follows:
@@ -60,7 +60,7 @@ are mere guesses, and some may be wrong.
 - .fc (field control)
   found by naddy@ in xloadimage(1)
   loc **  exist ***  algo *  size *  imp *
-  
+
 - .nr third argument (auto-increment step size, requires \n+)
   found by bentley@ in sbcl(1)  Mon, 9 Dec 2013 18:36:57 -0700
   loc *  exist *  algo *  size *  imp **
@@ -69,31 +69,37 @@ are mere guesses, and some may be wrong.
   reported by brad@  Sat, 15 Jan 2011 15:45:23 -0500
   loc ***  exist ***  algo ***  size **  imp *
 
-- .ta (tab settings) occurs in ircbug(1) and probably gnats(1)
-  reported by brad@  Sat, 15 Jan 2011 15:50:51 -0500
+- .ta (tab settings)
+  #1 most important issue naddy@ Mon, 16 Feb 2015 20:59:17 +0100
+  ircbug(1) gnats(1) reported by brad@  Sat, 15 Jan 2011 15:50:51 -0500
   also Tcl_NewStringObj(3) via wiz@  Wed, 5 Mar 2014 22:27:43 +0100
   also posix2time(3) Carsten Kunze  Mon, 1 Dec 2014 13:03:10 +0100
   loc **  exist ***  algo **  size **  imp ***
 
 - .ti (temporary indent)
-  found by naddy@ in xloadimage(1)
+  found by naddy@ in xloadimage(1) [devel/libvstr] vstr(3)
   found by bentley@ in nmh(1)  Mon, 23 Apr 2012 13:38:28 -0600
   loc **  exist **  algo **  size *  imp ** (parser reorg helps a lot)
 
-- .while and .shift 
+- .while and .shift
   found by jca@ in ratpoison(1)  Sun, 30 Jun 2013 12:01:09 +0200
   loc *  exist **  algo **  size **  imp **
 
 - \h horizontal move
-  found in cclive(1) and nasm(1) asciidoc/DocBook output
+  #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)
+  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
@@ -105,10 +111,6 @@ are mere guesses, and some may be wrong.
 
 --- missing mdoc features ----------------------------------------------
 
-- fix bad block nesting involving multiple identical explicit blocks
-  see the OpenBSD mdoc_macro.c 1.47 commit message
-  loc *  exist ***  algo ***  size *  imp **
-
 - .Bl -column .Xo support is missing
   ultimate goal:
   restore .Xr and .Dv to
@@ -255,6 +257,10 @@ are mere guesses, and some may be wrong.
 
 --- compatibility checks -----------------------------------------------
 
+- write a configure check for [[:<:]] support and provide some
+  fallback for whatis(1) when it doesn't work;
+  Svyatoslav Mishyn  Wed, 17 Dec 2014 11:07:10 +0200
+
 - is .Bk implemented correctly in modern groff?
   sobrado@  Tue, 19 Apr 2011 22:12:55 +0200
 
@@ -347,6 +353,10 @@ are mere guesses, and some may be wrong.
   reminded by jmc@  Thu, 23 Sep 2010 18:13:39 +0059
   loc *  exist **  algo ***  size *  imp ***
 
+- a line starting with "\fB something" counts as starting with whitespace
+  and triggers a line break; found in audio/normalize-mp3(1)
+  loc **  exist *  algo **  size *  imp **
+
 - formatting /usr/local/man/man1/latex2man.1 with groff and mandoc
   reveals lots of bugs both in groff and mandoc...
   reported by bentley@  Wed, 22 May 2013 23:49:30 -0600
@@ -457,7 +467,7 @@ are mere guesses, and some may be wrong.
   loc *  exist *  algo *  size *  imp *
 
 - trailing whitespace must be ignored even when followed by a font escape,
-  see for example 
+  see for example
     makes
     \fBdig \fR
     operate in batch mode
@@ -531,7 +541,7 @@ are mere guesses, and some may be wrong.
   How does SQLITE_CONFIG_PAGECACHE actually work?  Document it!
   from kristaps@  Sat, 09 Aug 2014 13:51:36 +0200
 
-Several areas can be cleaned up to make mandoc even faster.  These are 
+Several areas can be cleaned up to make mandoc even faster.  These are
 
 - improve hashing mechanism for macros (quite important: performance)
 
@@ -540,7 +550,7 @@ Several areas can be cleaned up to make 
 - the PDF file is HUGE: this can be reduced by using relative offsets
 
 - instead of re-initialising the roff predefined-strings set before each
-  parse, create a read-only version the first time and copy it 
+  parse, create a read-only version the first time and copy it
   loc *  exist **  algo **  size *  imp **
 
 ************************************************************************
@@ -556,7 +566,7 @@ Several areas can be cleaned up to make 
 
 - 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.

Modified: head/contrib/mdocml/apropos.1
==============================================================================
--- head/contrib/mdocml/apropos.1	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/apropos.1	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,4 +1,4 @@
-.\"	$Id: apropos.1,v 1.36 2014/10/25 01:03:52 schwarze Exp $
+.\"	$Id: apropos.1,v 1.37 2015/02/16 16:23:54 schwarze Exp $
 .\"
 .\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps at bsd.lv>
 .\" Copyright (c) 2011, 2012, 2014 Ingo Schwarze <schwarze at 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: October 25 2014 $
+.Dd $Mdocdate: February 16 2015 $
 .Dt APROPOS 1
 .Os
 .Sh NAME
@@ -24,7 +24,7 @@
 .Nd search manual page databases
 .Sh SYNOPSIS
 .Nm
-.Op Fl acfhklVw
+.Op Fl acfhklw
 .Op Fl C Ar file
 .Op Fl M Ar path
 .Op Fl m Ar path
@@ -162,8 +162,6 @@ By default, pages from all sections are 
 See
 .Xr man 1
 for a listing of sections.
-.It Fl V
-Print version and exit.
 .It Fl w
 Instead of showing title lines, show the pathnames of the matching
 manual pages, just like

Modified: head/contrib/mdocml/cgi.c
==============================================================================
--- head/contrib/mdocml/cgi.c	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/cgi.c	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,4 +1,4 @@
-/*	$Id: cgi.c,v 1.102 2014/11/26 17:55:27 schwarze Exp $ */
+/*	$Id: cgi.c,v 1.104 2015/02/10 08:05:30 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps at bsd.lv>
  * Copyright (c) 2014 Ingo Schwarze <schwarze at usta.de>
@@ -58,10 +58,10 @@ static	void		 catman(const struct req *,
 static	void		 format(const struct req *, const char *);
 static	void		 html_print(const char *);
 static	void		 html_putchar(char);
-static	int 		 http_decode(char *);
+static	int		 http_decode(char *);
 static	void		 http_parse(struct req *, const char *);
 static	void		 http_print(const char *);
-static	void 		 http_putchar(char);
+static	void		 http_putchar(char);
 static	void		 http_printquery(const struct req *, const char *);
 static	void		 pathgen(struct req *);
 static	void		 pg_error_badrequest(const char *);
@@ -186,7 +186,7 @@ http_print(const char *p)
 static void
 html_print(const char *p)
 {
-	
+
 	if (NULL == p)
 		return;
 	while ('\0' != *p)
@@ -621,7 +621,7 @@ pg_searchres(const struct req *req, stru
 	for (i = 0; i < sz; i++) {
 		printf("<TR>\n"
 		       "<TD CLASS=\"title\">\n"
-		       "<A HREF=\"%s/%s/%s?", 
+		       "<A HREF=\"%s/%s/%s?",
 		    scriptname, req->q.manpath, r[i].file);
 		http_printquery(req, "&");
 		printf("\">");
@@ -701,7 +701,7 @@ catman(const struct req *req, const char
 	while (NULL != (p = fgetln(f, &len))) {
 		bold = italic = 0;
 		for (i = 0; i < (int)len - 1; i++) {
-			/* 
+			/*
 			 * This means that the catpage is out of state.
 			 * Ignore it and keep going (although the
 			 * catpage is bogus).
@@ -742,7 +742,7 @@ catman(const struct req *req, const char
 				continue;
 			}
 
-			/* 
+			/*
 			 * Handle funny behaviour troff-isms.
 			 * These grok'd from the original man2html.c.
 			 */
@@ -780,7 +780,7 @@ catman(const struct req *req, const char
 			}
 
 			/* Bold mode. */
-			
+
 			if (italic)
 				printf("</I>");
 			if ( ! bold)
@@ -791,9 +791,9 @@ catman(const struct req *req, const char
 			html_putchar(p[i]);
 		}
 
-		/* 
+		/*
 		 * Clean up the last character.
-		 * We can get to a newline; don't print that. 
+		 * We can get to a newline; don't print that.
 		 */
 
 		if (italic)
@@ -822,7 +822,6 @@ format(const struct req *req, const char
 	struct man	*man;
 	void		*vp;
 	char		*opts;
-	enum mandoclevel rc;
 	int		 fd;
 	int		 usepath;
 
@@ -832,18 +831,11 @@ format(const struct req *req, const char
 	}
 
 	mchars = mchars_alloc();
-	mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL,
+	mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_BADARG, NULL,
 	    mchars, req->q.manpath);
-	rc = mparse_readfd(mp, fd, file);
+	mparse_readfd(mp, fd, file);
 	close(fd);
 
-	if (rc >= MANDOCLEVEL_FATAL) {
-		fprintf(stderr, "fatal mandoc error: %s/%s\n",
-		    req->q.manpath, file);
-		pg_error_internal();
-		return;
-	}
-
 	usepath = strcmp(req->q.manpath, req->p[0]);
 	mandoc_asprintf(&opts,
 	    "fragment,man=%s?query=%%N&sec=%%S%s%s%s%s",
@@ -899,7 +891,7 @@ pg_show(struct req *req, const char *ful
 		pg_error_badrequest(
 		    "You did not specify a page to show.");
 		return;
-	} 
+	}
 	manpath = mandoc_strndup(fullpath, file - fullpath);
 	file++;
 
@@ -1064,7 +1056,7 @@ main(void)
 		    MAN_DIR, strerror(errno));
 		pg_error_internal();
 		return(EXIT_FAILURE);
-	} 
+	}
 
 	memset(&req, 0, sizeof(struct req));
 	pathgen(&req);

Modified: head/contrib/mdocml/chars.c
==============================================================================
--- head/contrib/mdocml/chars.c	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/chars.c	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,4 +1,4 @@
-/*	$Id: chars.c,v 1.65 2014/10/29 00:17:43 schwarze Exp $ */
+/*	$Id: chars.c,v 1.66 2015/02/17 20:37:16 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps at bsd.lv>
  * Copyright (c) 2011, 2014 Ingo Schwarze <schwarze at openbsd.org>
@@ -38,7 +38,7 @@ struct	ln {
 	int		  unicode;
 };
 
-#define	LINES_MAX	  330
+#define	LINES_MAX	  332
 
 #define CHAR(in, ch, code) \
 	{ NULL, (in), (ch), (code) },

Modified: head/contrib/mdocml/chars.in
==============================================================================
--- head/contrib/mdocml/chars.in	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/chars.in	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,4 +1,4 @@
-/*	$Id: chars.in,v 1.49 2014/11/06 22:28:36 schwarze Exp $ */
+/*	$Id: chars.in,v 1.52 2015/02/17 20:37:16 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps at bsd.lv>
  * Copyright (c) 2014 Ingo Schwarze <schwarze at openbsd.org>
@@ -70,8 +70,10 @@ CHAR("ti",			"~",		126)
 /* Quotes. */
 CHAR("Bq",			",,",		8222)
 CHAR("bq",			",",		8218)
-CHAR("lq",			"``",		8220)
-CHAR("rq",			"\'\'",		8221)
+CHAR("lq",			"\"",		8220)
+CHAR("rq",			"\"",		8221)
+CHAR("Lq",			"``",		8220)
+CHAR("Rq",			"''",		8221)
 CHAR("oq",			"`",		8216)
 CHAR("cq",			"\'",		8217)
 CHAR("aq",			"\'",		39)
@@ -91,30 +93,30 @@ CHAR("ra",			">",		10217)
 CHAR("bv",			"|",		9130)
 CHAR("braceex",			"|",		9130)
 CHAR("bracketlefttp",		"|",		9121)
-CHAR("bracketleftbp",		"|",		9123)
+CHAR("bracketleftbt",		"|",		9123)
 CHAR("bracketleftex",		"|",		9122)
 CHAR("bracketrighttp",		"|",		9124)
-CHAR("bracketrightbp",		"|",		9126)
+CHAR("bracketrightbt",		"|",		9126)
 CHAR("bracketrightex",		"|",		9125)
 CHAR("lt",			",-",		9127)
 CHAR("bracelefttp",		",-",		9127)
 CHAR("lk",			"{",		9128)
 CHAR("braceleftmid",		"{",		9128)
 CHAR("lb",			"`-",		9129)
-CHAR("braceleftbp",		"`-",		9129)
+CHAR("braceleftbt",		"`-",		9129)
 CHAR("braceleftex",		"|",		9130)
 CHAR("rt",			"-.",		9131)
 CHAR("bracerighttp",		"-.",		9131)
 CHAR("rk",			"}",		9132)
 CHAR("bracerightmid",		"}",		9132)
 CHAR("rb",			"-\'",		9133)
-CHAR("bracerightbp",		"-\'",		9133)
+CHAR("bracerightbt",		"-\'",		9133)
 CHAR("bracerightex",		"|",		9130)
 CHAR("parenlefttp",		"/",		9115)
-CHAR("parenleftbp",		"\\",		9117)
+CHAR("parenleftbt",		"\\",		9117)
 CHAR("parenleftex",		"|",		9116)
 CHAR("parenrighttp",		"\\",		9118)
-CHAR("parenrightbp",		"/",		9120)
+CHAR("parenrightbt",		"/",		9120)
 CHAR("parenrightex",		"|",		9119)
 
 /* Greek characters. */
@@ -281,10 +283,10 @@ CHAR("!=",			"!=",		8800)
 CHAR("==",			"==",		8801)
 CHAR("ne",			"!==",		8802)
 CHAR("=~",			"=~",		8773)
-CHAR("-~",			"-~",		8771)
+CHAR("|=",			"-~",		8771)
 CHAR("ap",			"~",		8764)
 CHAR("~~",			"~~",		8776)
-CHAR("~=",			"~=",		8780)
+CHAR("~=",			"~=",		8776)
 CHAR("pt",			"oc",		8733)
 CHAR("es",			"{}",		8709)
 CHAR("mo",			"E",		8712)
@@ -357,7 +359,7 @@ CHAR("Fn",			",\bf",		402)
 CHAR("ba",			"|",		124)
 CHAR("br",			"|",		9474)
 CHAR("ul",			"_",		95)
-CHAR("rl",			"-",		8254)
+CHAR("rn",			"-",		8254)
 CHAR("bb",			"|",		166)
 CHAR("sl",			"/",		47)
 CHAR("rs",			"\\",		92)

Modified: head/contrib/mdocml/compat_fts.c
==============================================================================
--- head/contrib/mdocml/compat_fts.c	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/compat_fts.c	Mon Mar  2 16:58:57 2015	(r279527)
@@ -6,8 +6,8 @@ int dummy;
 
 #else
 
-/*	$Id: compat_fts.c,v 1.6 2014/12/11 18:20:07 schwarze Exp $	*/
-/*	$OpenBSD: fts.c,v 1.49 2014/11/23 00:14:22 guenther Exp $	*/
+/*	$Id: compat_fts.c,v 1.8 2015/02/07 07:53:01 schwarze Exp $	*/
+/*	$OpenBSD: fts.c,v 1.50 2015/01/16 16:48:51 deraadt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -38,7 +38,6 @@ int dummy;
  * SUCH DAMAGE.
  */
 
-#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
@@ -51,6 +50,8 @@ int dummy;
 #include <unistd.h>
 #include "compat_fts.h"
 
+#define MAXIMUM(a, b)	(((a) > (b)) ? (a) : (b))
+
 static FTSENT	*fts_alloc(FTS *, const char *, size_t);
 static FTSENT	*fts_build(FTS *);
 static void	 fts_lfree(FTSENT *);
@@ -62,10 +63,12 @@ static unsigned short	 fts_stat(FTS *, F
 static int	 fts_safe_changedir(FTS *, FTSENT *, int, const char *);
 
 #define	ISDOT(a)	(a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
-#define	MAX(a,b)	(((a)>(b))?(a):(b))
 #ifndef	O_DIRECTORY
 #define	O_DIRECTORY	0
 #endif
+#ifndef	O_CLOEXEC
+#define	O_CLOEXEC	0
+#endif
 
 #define	CLR(opt)	(sp->fts_options &= ~(opt))
 #define	ISSET(opt)	(sp->fts_options & (opt))
@@ -97,7 +100,7 @@ fts_open(char * const *argv, int options
 	 * Start out with 1K of path space, and enough, in any case,
 	 * to hold the user's paths.
 	 */
-	if (fts_palloc(sp, MAX(fts_maxarglen(argv), PATH_MAX)))
+	if (fts_palloc(sp, MAXIMUM(fts_maxarglen(argv), PATH_MAX)))
 		goto mem1;
 
 	/* Allocate/initialize root's parent. */

Copied: head/contrib/mdocml/compat_strtonum.c (from r279526, vendor/mdocml/dist/compat_strtonum.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/mdocml/compat_strtonum.c	Mon Mar  2 16:58:57 2015	(r279527, copy of r279526, vendor/mdocml/dist/compat_strtonum.c)
@@ -0,0 +1,76 @@
+#include "config.h"
+
+#if HAVE_STRTONUM
+
+int dummy;
+
+#else
+
+/*	$Id: compat_strtonum.c,v 1.1 2015/02/16 14:56:22 schwarze Exp $	*/
+/*	$OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $	*/
+
+/*
+ * Copyright (c) 2004 Ted Unangst and Todd Miller
+ * All rights reserved.
+ *
+ * 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 <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#define	INVALID		1
+#define	TOOSMALL	2
+#define	TOOLARGE	3
+
+long long
+strtonum(const char *numstr, long long minval, long long maxval,
+    const char **errstrp)
+{
+	long long ll = 0;
+	int error = 0;
+	char *ep;
+	struct errval {
+		const char *errstr;
+		int err;
+	} ev[4] = {
+		{ NULL,		0 },
+		{ "invalid",	EINVAL },
+		{ "too small",	ERANGE },
+		{ "too large",	ERANGE },
+	};
+
+	ev[0].err = errno;
+	errno = 0;
+	if (minval > maxval) {
+		error = INVALID;
+	} else {
+		ll = strtoll(numstr, &ep, 10);
+		if (numstr == ep || *ep != '\0')
+			error = INVALID;
+		else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
+			error = TOOSMALL;
+		else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
+			error = TOOLARGE;
+	}
+	if (errstrp != NULL)
+		*errstrp = ev[error].errstr;
+	errno = ev[error].err;
+	if (error)
+		ll = 0;
+
+	return (ll);
+}
+
+#endif /* !HAVE_STRTONUM */

Modified: head/contrib/mdocml/config.h
==============================================================================
--- head/contrib/mdocml/config.h	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/config.h	Mon Mar  2 16:58:57 2015	(r279527)
@@ -19,6 +19,7 @@
 #define HAVE_STRLCPY 1
 #define HAVE_STRPTIME 1
 #define HAVE_STRSEP 1
+#define HAVE_STRTONUM 1
 #define HAVE_WCHAR 1
 #define HAVE_SQLITE3 1
 #define HAVE_SQLITE3_ERRSTR 0

Modified: head/contrib/mdocml/configure
==============================================================================
--- head/contrib/mdocml/configure	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/configure	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2014 Ingo Schwarze <schwarze at openbsd.org>
+# Copyright (c) 2014, 2015 Ingo Schwarze <schwarze at 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
@@ -31,10 +31,6 @@ echo "config.log: writing..."
 # Initialize all variables here,
 # such that nothing can leak in from the environment.
 
-VERSION="1.13.2"
-echo "VERSION=\"${VERSION}\"" 1>&2
-echo "VERSION=\"${VERSION}\"" 1>&3
-
 OSNAME=
 
 CC=`printf "all:\\n\\t at echo \\\$(CC)\\n" | make -f -`
@@ -56,6 +52,7 @@ HAVE_STRLCAT=
 HAVE_STRLCPY=
 HAVE_STRPTIME=
 HAVE_STRSEP=
+HAVE_STRTONUM=
 HAVE_WCHAR=
 
 HAVE_SQLITE3=
@@ -70,6 +67,7 @@ INCLUDEDIR=
 LIBDIR=
 MANDIR=
 EXAMPLEDIR=
+HOMEBREWDIR=
 
 WWWPREFIX="/var/www"
 HTDOCDIR=
@@ -176,6 +174,7 @@ runtest strlcat		STRLCAT		|| true
 runtest strlcpy		STRLCPY		|| true
 runtest strptime	STRPTIME	|| true
 runtest strsep		STRSEP		|| true
+runtest strtonum	STRTONUM	|| true
 runtest wchar		WCHAR		|| true
 
 # --- sqlite3 ---
@@ -274,8 +273,8 @@ __HEREDOC__
 [ ${HAVE_FGETLN} -eq 0 ] && echo "#include <stdio.h>"
 
 echo
-echo "#define VERSION \"${VERSION}\""
 [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
+[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
 
 cat << __HEREDOC__
 #define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
@@ -289,6 +288,7 @@ cat << __HEREDOC__
 #define HAVE_STRLCPY ${HAVE_STRLCPY}
 #define HAVE_STRPTIME ${HAVE_STRPTIME}
 #define HAVE_STRSEP ${HAVE_STRSEP}
+#define HAVE_STRTONUM ${HAVE_STRTONUM}
 #define HAVE_WCHAR ${HAVE_WCHAR}
 #define HAVE_SQLITE3 ${HAVE_SQLITE3}
 #define HAVE_SQLITE3_ERRSTR ${HAVE_SQLITE3_ERRSTR}
@@ -341,6 +341,9 @@ __HEREDOC__
 [ ${HAVE_STRSEP} -eq 0 ] && \
 	echo "extern	char	 *strsep(char **, const char *);"
 
+[ ${HAVE_STRTONUM} -eq 0 ] && \
+	echo "extern	long long strtonum(const char *, long long, long long, const char **);"
+
 echo
 echo "#endif /* MANDOC_CONFIG_H */"
 
@@ -379,7 +382,6 @@ INSTALL_TARGETS="base-install"
 [ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
 
 cat << __HEREDOC__
-VERSION		= ${VERSION}
 BUILD_TARGETS	= ${BUILD_TARGETS}
 INSTALL_TARGETS	= ${INSTALL_TARGETS}
 CFLAGS		= ${CFLAGS}

Modified: head/contrib/mdocml/configure.local.example
==============================================================================
--- head/contrib/mdocml/configure.local.example	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/configure.local.example	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,6 +1,6 @@
-# $Id: configure.local.example,v 1.2 2014/12/09 09:14:33 schwarze Exp $
+# $Id: configure.local.example,v 1.6 2015/02/16 14:56:22 schwarze Exp $
 #
-# Copyright (c) 2014 Ingo Schwarze <schwarze at openbsd.org>
+# Copyright (c) 2014, 2015 Ingo Schwarze <schwarze at 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
@@ -74,6 +74,21 @@ LIBDIR="${PREFIX}/lib/mandoc"
 MANDIR="${PREFIX}/man"
 EXAMPLEDIR="${PREFIX}/share/examples/mandoc"
 
+# The man(1) utility needs to know where the manuals reside.
+# We know of two ways to tell it: via manpath(1) or man.conf(5).
+# The latter is used by OpenBSD and NetBSD, the former by most
+# other systems.
+
+# Force usage of manpath(1).
+# If it is not installed or not operational,
+# man(1), makewhatis(8), and apropos(1) will not work properly.
+HAVE_MANPATH=1
+
+# Force usage of man.conf(5).
+# If it does not exist or contains no valid configuration,
+# man(1), makewhatis(8), and apropos(1) will not work properly.
+HAVE_MANPATH=0
+
 # Some distributions may want to avoid naming conflicts among manuals.
 # If you want to change the names of installed section 7 manual pages,
 # the following alternative names are suggested.
@@ -87,6 +102,15 @@ MANM_ROFF="mandoc_roff"		# default is "r
 MANM_EQN="mandoc_eqn"		# default is "eqn"
 MANM_TBL="mandoc_tbl"		# default is "tbl"
 
+# Some distributions may want to avoid naming conflicts
+# with another man(1) utility.
+# If you want to change the name of the binary program,
+# the following alternative name is suggested.
+# Using a different name is possible as well.
+# This changes the name of the installed section 1 manual page as well.
+
+BINM_MAN=mman			# default is "man"
+
 # It is possible to change the utility program used for installation
 # and the modes files are installed with.  The defaults are:
 
@@ -121,38 +145,29 @@ DBLIB="-L/usr/local/lib -lsqlite3"
 
 CFLAGS="${CFLAGS} -I/usr/local/include"
 
-# The man(1) utility needs to know where the manuals reside.
-# We know of two ways to tell it: via manpath(1) or man.conf(5).
-# The latter is used by OpenBSD and NetBSD, the former by most
-# other systems.
-
-# Force usage of manpath(1).
-# If it is not installed or not operational,
-# makewhatis(8) and apropos(1) will not work properly.
-
-HAVE_MANPATH=1
-
-# Force usage of man.conf(5).
-# If it does not exist or contains no valid configuration,
-# makewhatis(8) and apropos(1) will not work properly.
-
-HAVE_MANPATH=0
-
 # Some distributions may want to avoid naming conflicts
-# with groff, man-db, or other tools.
-# If you want to change the names of binary programs,
+# with another implementation of apropos(1) and makewhatis(8).
+# If you want to change the names of the binary programs,
 # the following alternative names are suggested.
 # Using other names is possible as well.
 # This changes the names of the installed section 1 and section 8
 # manual pages as well.
-# It is possible to set only one or a few of these variables,
+# It is possible to set only one or two of these variables,
 # there is no need to copy the whole block.
 
 BINM_APROPOS=mapropos		# default is "apropos"
-BINM_MAN=mman			# default is "man"
 BINM_WHATIS=mwhatis		# default is "whatis"
 BINM_MAKEWHATIS=mandocdb	# default is "makewhatis"
 
+# When using the "homebrew" package manager on Mac OS X, the actual
+# manuals are located in a so-called "cellar" and only symlinked
+# into the manual trees.  To allow mandoc to follow such symlinks,
+# you have to specify the physical location of the cellar as returned
+# by realpath(3), for example:
+
+PREFIX="/usr/local"
+HOMEBREWDIR="${PREFIX}/Cellar"
+
 # --- user settings related man.cgi ------------------------------------
 
 # By default, building man.cgi(8) is disabled.  To enable it, copy
@@ -211,6 +226,7 @@ HAVE_STRLCAT=0
 HAVE_STRLCPY=0
 HAVE_STRPTIME=0
 HAVE_STRSEP=0
+HAVE_STRTONUM=0
 
 HAVE_SQLITE3=0
 HAVE_SQLITE3_ERRSTR=0

Modified: head/contrib/mdocml/demandoc.c
==============================================================================
--- head/contrib/mdocml/demandoc.c	Mon Mar  2 16:49:45 2015	(r279526)
+++ head/contrib/mdocml/demandoc.c	Mon Mar  2 16:58:57 2015	(r279527)
@@ -1,4 +1,4 @@
-/*	$Id: demandoc.c,v 1.12 2014/10/28 17:36:19 schwarze Exp $ */
+/*	$Id: demandoc.c,v 1.15 2015/02/10 08:05:30 schwarze Exp $ */
 /*
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps at bsd.lv>
  *
@@ -44,11 +44,12 @@ main(int argc, char *argv[])
 {
 	struct mparse	*mp;
 	struct mchars	*mchars;
-	int		 ch, i, list;
+	int		 ch, fd, i, list;
 	extern int	 optind;
 
-	progname = strrchr(argv[0], '/');
-	if (progname == NULL)
+	if (argc < 1)
+		progname = "demandoc";
+	else if ((progname = strrchr(argv[0], '/')) == NULL)
 		progname = argv[0];
 	else
 		++progname;
@@ -78,15 +79,19 @@ main(int argc, char *argv[])
 	argv += optind;
 
 	mchars = mchars_alloc();
-	mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_FATAL, NULL, mchars, NULL);
+	mp = mparse_alloc(MPARSE_SO, MANDOCLEVEL_BADARG, NULL, mchars, NULL);
 	assert(mp);
 
-	if (0 == argc)
+	if (argc < 1)
 		pmandoc(mp, STDIN_FILENO, "<stdin>", list);
 
 	for (i = 0; i < argc; i++) {
 		mparse_reset(mp);
-		pmandoc(mp, -1, argv[i], list);
+		if (mparse_open(mp, &fd, argv[i]) != MANDOCLEVEL_OK) {
+			perror(argv[i]);
+			continue;
+		}
+		pmandoc(mp, fd, argv[i], list);
 	}
 
 	mparse_free(mp);
@@ -108,16 +113,12 @@ pmandoc(struct mparse *mp, int fd, const
 	struct man	*man;
 	int		 line, col;
 
-	if (mparse_readfd(mp, fd, fn) >= MANDOCLEVEL_FATAL) {
-		fprintf(stderr, "%s: Parse failure\n", fn);
-		return;
-	}
-
+	mparse_readfd(mp, fd, fn);
 	mparse_result(mp, &mdoc, &man, NULL);
 	line = 1;
 	col = 0;
 
-	if (mdoc) 
+	if (mdoc)
 		pmdoc(mdoc_node(mdoc), &line, &col, list);
 	else if (man)
 		pman(man_node(man), &line, &col, list);
@@ -167,7 +168,7 @@ again:
 		end = p - 1;
 
 		while (end > start)
-			if ('.' == *end || ',' == *end || 
+			if ('.' == *end || ',' == *end ||
 					'\'' == *end || '"' == *end ||
 					')' == *end || '!' == *end ||
 					'?' == *end || ':' == *end ||
@@ -199,7 +200,7 @@ again:
 	/*
 	 * Print the input word, skipping any special characters.
 	 */
-	while ('\0' != *p) 
+	while ('\0' != *p)
 		if ('\\' == *p) {
 			p++;
 			esc = mandoc_escape(&p, NULL, NULL);
@@ -220,7 +221,7 @@ pline(int line, int *linep, int *col, in
 
 	/*
 	 * Print out as many lines as needed to reach parity with the
-	 * original input. 
+	 * original input.
 	 */
 
 	while (*linep < line) {
@@ -240,7 +241,7 @@ pmdoc(const struct mdoc_node *p, int *li
 			pline(p->line, line, col, list);
 		if (MDOC_TEXT == p->type)
 			pstring(p->string, p->pos, col, list);
-		if (p->child) 
+		if (p->child)
 			pmdoc(p->child, line, col, list);
 	}
 }
@@ -254,7 +255,7 @@ pman(const struct man_node *p, int *line

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


More information about the svn-src-head mailing list