From 819bef7bd125bbccd7a5753c6207e68f6b2a427e Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 4 Apr 2010 20:14:36 +0000 Subject: When the prologue lacks required information, do not error out, but warn, set up some default values, and prod on. Unbreaking the ports build for textproc/sgmlformat; reported by naddy@, thanks. --- usr.bin/mandoc/mdoc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 13f3683450d..92f99390328 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.38 2010/04/03 16:24:17 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.39 2010/04/04 20:14:35 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -22,6 +22,7 @@ #include #include #include +#include #include "libmdoc.h" #include "libmandoc.h" @@ -350,8 +351,19 @@ mdoc_macro(struct mdoc *m, enum mdoct tok, MDOC_PBODY & m->flags) return(mdoc_perr(m, ln, pp, EPROLBODY)); if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && - ! (MDOC_PBODY & m->flags)) - return(mdoc_perr(m, ln, pp, EBODYPROL)); + ! (MDOC_PBODY & m->flags)) { + if ( ! mdoc_pwarn(m, ln, pp, EBODYPROL)) + return(0); + if (NULL == m->meta.title) + m->meta.title = mandoc_strdup("unknown"); + if (NULL == m->meta.vol) + m->meta.vol = mandoc_strdup("local"); + if (NULL == m->meta.os) + m->meta.os = mandoc_strdup("local"); + if (0 == m->meta.date) + m->meta.date = time(NULL); + m->flags |= MDOC_PBODY; + } return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf)); } -- cgit v1.2.3