=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.139 retrieving revision 1.140 diff -u -p -r1.139 -r1.140 --- mandoc/roff.c 2011/05/24 14:00:39 1.139 +++ mandoc/roff.c 2011/05/24 15:22:14 1.140 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.139 2011/05/24 14:00:39 kristaps Exp $ */ +/* $Id: roff.c,v 1.140 2011/05/24 15:22:14 kristaps Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2011 Ingo Schwarze @@ -853,17 +853,12 @@ roff_cond_sub(ROFF_ARGS) */ if (ROFF_MAX == (t = roff_parse(r, *bufp, &pos))) { - /* - * Jump through hoops to detect a \}, because it could - * be (say) \\}, which is something completely - * different. - */ ep = &(*bufp)[pos]; for ( ; NULL != (ep = strchr(ep, '\\')); ep++) { ep++; if ('}' != *ep) continue; - *--ep = '\0'; + *ep = '&'; roff_ccond(r, ROFF_ccond, bufp, szp, ln, pos, pos + 2, offs); break; @@ -887,36 +882,27 @@ roff_cond_sub(ROFF_ARGS) ln, ppos, pos, offs)); } - /* ARGSUSED */ static enum rofferr roff_cond_text(ROFF_ARGS) { - char *ep, *st; + char *ep; enum roffrule rr; rr = r->last->rule; + roffnode_cleanscope(r); - /* - * We display the value of the text if out current evaluation - * scope permits us to do so. - */ - - /* FIXME: use roff_ccond? */ - - st = &(*bufp)[pos]; - if (NULL == (ep = strstr(st, "\\}"))) { - roffnode_cleanscope(r); - return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); + ep = &(*bufp)[pos]; + for ( ; NULL != (ep = strchr(ep, '\\')); ep++) { + ep++; + if ('}' != *ep) + continue; + *ep = '&'; + roff_ccond(r, ROFF_ccond, bufp, szp, + ln, pos, pos + 2, offs); } - - if (ep == st || (ep > st && '\\' != *(ep - 1))) - roffnode_pop(r); - - roffnode_cleanscope(r); return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT); } - static enum roffrule roff_evalcond(const char *v, int *pos)