=================================================================== RCS file: /cvs/mandoc/man.c,v retrieving revision 1.136 retrieving revision 1.142 diff -u -p -r1.136 -r1.142 --- mandoc/man.c 2014/08/01 17:27:44 1.136 +++ mandoc/man.c 2014/11/03 23:18:39 1.142 @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.136 2014/08/01 17:27:44 schwarze Exp $ */ +/* $Id: man.c,v 1.142 2014/11/03 23:18:39 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze @@ -16,9 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include @@ -121,7 +119,8 @@ int man_parseln(struct man *man, int ln, char *buf, int offs) { - man->flags |= MAN_NEWLINE; + if (man->last->type != MAN_EQN || ln > man->last->line) + man->flags |= MAN_NEWLINE; return (roff_getcontrol(man->roff, buf, &offs) ? man_pmacro(man, ln, buf, offs) : @@ -186,10 +185,11 @@ man_node_append(struct man *man, struct man_node *p) assert(p->parent); p->parent->nchild++; - if ( ! man_valid_pre(man, p)) - return(0); - switch (p->type) { + case MAN_BLOCK: + if (p->tok == MAN_SH || p->tok == MAN_SS) + man->flags &= ~MAN_LITERAL; + break; case MAN_HEAD: assert(MAN_BLOCK == p->parent->type); p->parent->head = p; @@ -315,6 +315,21 @@ man_word_alloc(struct man *man, int line, int pos, con return(1); } +void +man_word_append(struct man *man, const char *word) +{ + struct man_node *n; + char *addstr, *newstr; + + n = man->last; + addstr = roff_strdup(man->roff, word); + mandoc_asprintf(&newstr, "%s %s", n->string, addstr); + free(addstr); + free(n->string); + n->string = newstr; + man->next = MAN_NEXT_SIBLING; +} + /* * Free all of the resources held by a node. This does NOT unlink a * node from its context; for that, see man_node_unlink(). @@ -346,6 +361,8 @@ man_addeqn(struct man *man, const struct eqn *ep) n = man_node_alloc(man, ep->ln, ep->pos, MAN_EQN, MAN_MAX); n->eqn = ep; + if (ep->ln > man->last->line) + n->flags |= MAN_LINE; if ( ! man_node_append(man, n)) return(0); @@ -471,13 +488,6 @@ man_pmacro(struct man *man, int ln, char *buf, int off enum mant tok; int i, ppos; int bline; - - if ('"' == buf[offs]) { - mandoc_msg(MANDOCERR_COMMENT_BAD, man->parse, - ln, offs, NULL); - return(1); - } else if ('\0' == buf[offs]) - return(1); ppos = offs;