From f9e4d0ae086987ed162fde69bc3ae4c3048ff293 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Wed, 9 Jun 2010 20:00:38 +0000 Subject: Make "sub" for conditionals run roffnode_cleanscope() before calling down to sub-arguments. From a bug report by Ulrich Spoerlein. --- roff.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/roff.c b/roff.c index 24aa46e6..3744c74d 100644 --- a/roff.c +++ b/roff.c @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.86 2010/06/01 11:47:28 kristaps Exp $ */ +/* $Id: roff.c,v 1.87 2010/06/09 20:00:38 kristaps Exp $ */ /* * Copyright (c) 2010 Kristaps Dzonsons * @@ -621,11 +621,21 @@ roff_cond_sub(ROFF_ARGS) { enum rofft t; enum roffrule rr; + struct roffnode *l; ppos = pos; rr = r->last->rule; - roff_cond_text(r, tok, bufp, szp, ln, ppos, pos, offs); + /* + * Clean out scope. If we've closed ourselves, then don't + * continue. + */ + + l = r->last; + roffnode_cleanscope(r); + + if (l != r->last) + return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); -- cgit v1.2.3-56-ge451