diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-04-08 07:06:15 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-04-08 07:06:15 +0000 |
commit | d2b8bc33bc90db15fc9ea4e53cfc51baa3167a47 (patch) | |
tree | f80042c997f861446eb0c5ccb38833dc09cbcf42 | |
parent | 22cc08db2d7a9dd7b80cd0a8cff26bc3d9bfabcf (diff) | |
download | mandoc-d2b8bc33bc90db15fc9ea4e53cfc51baa3167a47.tar.gz mandoc-d2b8bc33bc90db15fc9ea4e53cfc51baa3167a47.tar.zst mandoc-d2b8bc33bc90db15fc9ea4e53cfc51baa3167a47.zip |
Properly checked in Ingo Schwarze' prologue/body-breaking patch, which I'd munged.
-rw-r--r-- | mdoc.c | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.121 2010/04/06 11:33:00 kristaps Exp $ */ +/* $Id: mdoc.c,v 1.122 2010/04/08 07:06:15 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -348,19 +348,20 @@ int mdoc_macro(struct mdoc *m, enum mdoct tok, int ln, int pp, int *pos, char *buf) { - assert(tok < MDOC_MAX); - /* - * If we're in the prologue, deny "body" macros. Similarly, if - * we're in the body, deny prologue calls. - */ + + /* If we're in the body, deny prologue calls. */ + if (MDOC_PROLOGUE & mdoc_macros[tok].flags && - MDOC_PBODY & m->flags) { + MDOC_PBODY & m->flags) + return(mdoc_perr(m, ln, pp, EPROLBODY)); + + /* If we're in the prologue, deny "body" macros. */ + + if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && + ! (MDOC_PBODY & m->flags)) { if ( ! mdoc_pwarn(m, ln, pp, EBODYPROL)) return(0); - /* - * FIXME: do this in mdoc_action.c. - */ if (NULL == m->meta.title) m->meta.title = mandoc_strdup("unknown"); if (NULL == m->meta.vol) @@ -371,9 +372,6 @@ mdoc_macro(struct mdoc *m, enum mdoct tok, m->meta.date = time(NULL); m->flags |= MDOC_PBODY; } - if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && - ! (MDOC_PBODY & m->flags)) - return(mdoc_perr(m, ln, pp, EBODYPROL)); return((*mdoc_macros[tok].fp)(m, tok, ln, pp, pos, buf)); } |