=================================================================== RCS file: /cvs/mandoc/man.c,v retrieving revision 1.121 retrieving revision 1.124 diff -u -p -r1.121 -r1.124 --- mandoc/man.c 2013/11/10 22:54:40 1.121 +++ mandoc/man.c 2014/01/06 00:53:33 1.124 @@ -1,6 +1,8 @@ -/* $Id: man.c,v 1.121 2013/11/10 22:54:40 schwarze Exp $ */ +/* $Id: man.c,v 1.124 2014/01/06 00:53:33 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons + * Copyright (c) 2013, 2014 Ingo Schwarze + * Copyright (c) 2011 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -97,7 +99,7 @@ man_free(struct man *man) struct man * -man_alloc(struct roff *roff, struct mparse *parse) +man_alloc(struct roff *roff, struct mparse *parse, int quick) { struct man *p; @@ -105,6 +107,7 @@ man_alloc(struct roff *roff, struct mparse *parse) man_hash_init(); p->parse = parse; + p->quick = quick; p->roff = roff; man_alloc1(p); @@ -479,7 +482,7 @@ man_ptext(struct man *man, int line, char *buf, int of */ assert(i); - if (mandoc_eos(buf, (size_t)i, 0)) + if (mandoc_eos(buf, (size_t)i)) man->last->flags |= MAN_EOS; return(man_descope(man, line, offs)); @@ -603,6 +606,12 @@ man_pmacro(struct man *man, int ln, char *buf, int off assert(man_macros[tok].fp); if ( ! (*man_macros[tok].fp)(man, tok, ln, ppos, &offs, buf)) goto err; + + /* In quick mode (for mandocdb), abort after the NAME section. */ + + if (man->quick && MAN_SH == tok && + strcmp(man->last->prev->child->string, "NAME")) + return(2); /* * We weren't in a block-line scope when entering the