Hi naddy,

Christian Weisgerber wrote on Sat, Apr 03, 2010 at 03:11:26AM +0200:

> Here's the list of ports that pull in <bsd.man.mk> to format their
> man pages, but mandoc(1) errors out:
> 
> benchmarks/smtp-benchmark
>   smtpsend.8:38:1: error: blank line disallowed
> devel/ctm
>   ctm.1:42:1: error: blank line disallowed
> mail/smtp-vilter
>   smtp-vilter.8:186:1: error: blank line disallowed
> mail/movemail
>   movemail.1:61:1: error: blank line disallowed
> net/cnupm
>   cnupmstat.8:52:1: error: blank line disallowed
> sysutils/openpoppassd
>   openpoppassd.8:35:1: error: blank line disallowed

> x11/scrotwm
>   scrotwm_es.1:21:2: error: NAME section must be first

These should be converted to warnings, it is still possible to
continue parsing, and the result will probably be more or less
reasonable.

See below for a diff; Kristaps: OK?

All the same, the first block of pages should be reported upstream.
Blank lines are not valid syntax in mdoc(7) except in literal context.
The authors might consider using .Pp instead.  That might not be what
they want in some cases, but it will in many.

Yours,
  Ingo


Remaining:

> games/sudoku-solver
>   sudoku-solver.6:33:2: error: too many list types
> misc/omconsole
>   omconsole.1:36:5: error: requires line arguments > 0 (has 0)
> net/openvpn_bsdauth
>   openvpn_bsdauth.8:22:16: error: multi-line scope breaks multi-line
>   scope of Xo
> net/ipcalc
>   ipcalc.1:70:2: error: multi-line scope breaks multi-line scope of It
> net/bluetooth-tools
>   btkey.1:123:2: error: bad child for parent context
> sysutils/tabled
>   tabled.8:53:2: error: too many list types
> sysutils/pftop
>   pftop.8:146:2: error: multi-line scope breaks multi-line scope of It
> sysutils/login_ldap
>   login_ldap.8:283:2: error: multi-line scope breaks multi-line scope of
>   It
> sysutils/login_fingerprint
>   login_fingerprint.8:72:2: error: multi-line scope breaks multi-line
>   scope of It
> textproc/sgmlformat
>   instant.1:0:1: error: document has no title/section
> x11/sclock
>   sclock.1:0:1: error: document has no title/section


Index: mdoc.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc.c,v
retrieving revision 1.37
diff -u -p -r1.37 mdoc.c
--- mdoc.c      2 Apr 2010 12:39:47 -0000       1.37
+++ mdoc.c      3 Apr 2010 12:16:22 -0000
@@ -596,8 +596,12 @@ parsetext(struct mdoc *m, int line, char
        for (i = 0; ' ' == buf[i]; i++)
                /* Skip leading whitespace. */ ;
 
-       if ('\0' == buf[i])
-               return(mdoc_perr(m, line, 0, ENOBLANK));
+       if ('\0' == buf[i]) {
+               if ( ! mdoc_pwarn(m, line, 0, ENOBLANK))
+                       return(0);
+               if ( ! mdoc_elem_alloc(m, line, 0, MDOC_Pp, NULL))
+                       return(0);
+       }
 
        /*
         * Break apart a free-form line into tokens.  Spaces are
Index: mdoc_validate.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/mdoc_validate.c,v
retrieving revision 1.44
diff -u -p -r1.44 mdoc_validate.c
--- mdoc_validate.c     2 Apr 2010 12:39:47 -0000       1.44
+++ mdoc_validate.c     3 Apr 2010 12:16:22 -0000
@@ -1306,8 +1306,9 @@ post_sh_head(POST_ARGS)
         * non-CUSTOM has a conventional order to be followed.
         */
 
-       if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)
-               return(mdoc_nerr(mdoc, mdoc->last, ESECNAME));
+       if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed &&
+           ! mdoc_nwarn(mdoc, mdoc->last, ESECNAME))
+               return(0);
        if (SEC_CUSTOM == sec)
                return(1);
        if (sec == mdoc->lastnamed)

Reply via email to