=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc.c,v retrieving revision 1.75 retrieving revision 1.76 diff -c -r1.75 -r1.76 *** src/usr.bin/mandoc/mdoc.c 2010/12/29 00:47:30 1.75 --- src/usr.bin/mandoc/mdoc.c 2011/01/01 17:38:11 1.76 *************** *** 1,4 **** ! /* $Id: mdoc.c,v 1.75 2010/12/29 00:47:30 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze --- 1,4 ---- ! /* $Id: mdoc.c,v 1.76 2011/01/01 17:38:11 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze *************** *** 289,303 **** /* If we're in the body, deny prologue calls. */ if (MDOC_PROLOGUE & mdoc_macros[tok].flags && ! MDOC_PBODY & m->flags) ! return(mdoc_pmsg(m, line, ppos, MANDOCERR_BADBODY)); /* If we're in the prologue, deny "body" macros. */ if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && ! (MDOC_PBODY & m->flags)) { ! if ( ! mdoc_pmsg(m, line, ppos, MANDOCERR_BADPROLOG)) ! return(0); if (NULL == m->meta.msec) m->meta.msec = mandoc_strdup("1"); if (NULL == m->meta.title) --- 289,304 ---- /* If we're in the body, deny prologue calls. */ if (MDOC_PROLOGUE & mdoc_macros[tok].flags && ! MDOC_PBODY & m->flags) { ! mdoc_pmsg(m, line, ppos, MANDOCERR_BADBODY); ! return(1); ! } /* If we're in the prologue, deny "body" macros. */ if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && ! (MDOC_PBODY & m->flags)) { ! mdoc_pmsg(m, line, ppos, MANDOCERR_BADPROLOG); if (NULL == m->meta.msec) m->meta.msec = mandoc_strdup("1"); if (NULL == m->meta.title) *************** *** 647,659 **** if ('\\' == buf[offs] && '.' == buf[offs + 1] && ! '"' == buf[offs + 2]) ! return(mdoc_pmsg(m, line, offs, MANDOCERR_BADCOMMENT)); /* No text before an initial macro. */ ! if (SEC_NONE == m->lastnamed) ! return(mdoc_pmsg(m, line, offs, MANDOCERR_NOTEXT)); assert(m->last); n = m->last; --- 648,664 ---- if ('\\' == buf[offs] && '.' == buf[offs + 1] && ! '"' == buf[offs + 2]) { ! mdoc_pmsg(m, line, offs, MANDOCERR_BADCOMMENT); ! return(1); ! } /* No text before an initial macro. */ ! if (SEC_NONE == m->lastnamed) { ! mdoc_pmsg(m, line, offs, MANDOCERR_NOTEXT); ! return(1); ! } assert(m->last); n = m->last; *************** *** 728,739 **** *end = '\0'; if (ws) ! if ( ! mdoc_pmsg(m, line, (int)(ws-buf), MANDOCERR_EOLNSPACE)) ! return(0); if ('\0' == buf[offs] && ! (MDOC_LITERAL & m->flags)) { ! if ( ! mdoc_pmsg(m, line, (int)(c-buf), MANDOCERR_NOBLANKLN)) ! return(0); /* * Insert a `sp' in the case of a blank line. Technically, --- 733,742 ---- *end = '\0'; if (ws) ! mdoc_pmsg(m, line, (int)(ws-buf), MANDOCERR_EOLNSPACE); if ('\0' == buf[offs] && ! (MDOC_LITERAL & m->flags)) { ! mdoc_pmsg(m, line, (int)(c-buf), MANDOCERR_NOBLANKLN); /* * Insert a `sp' in the case of a blank line. Technically, *************** *** 833,840 **** */ if ('\0' == buf[i] && ' ' == buf[i - 1]) ! if ( ! mdoc_pmsg(m, ln, i - 1, MANDOCERR_EOLNSPACE)) ! goto err; /* * If an initial macro or a list invocation, divert directly --- 836,842 ---- */ if ('\0' == buf[i] && ' ' == buf[i - 1]) ! mdoc_pmsg(m, ln, i - 1, MANDOCERR_EOLNSPACE); /* * If an initial macro or a list invocation, divert directly