summaryrefslogtreecommitdiffstats
path: root/man.c
diff options
context:
space:
mode:
Diffstat (limited to 'man.c')
-rw-r--r--man.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/man.c b/man.c
index fbf02e74..dbdaddf5 100644
--- a/man.c
+++ b/man.c
@@ -1,6 +1,7 @@
/* $Id$ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
* 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 +98,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 +106,7 @@ man_alloc(struct roff *roff, struct mparse *parse)
man_hash_init();
p->parse = parse;
+ p->quick = quick;
p->roff = roff;
man_alloc1(p);
@@ -604,6 +606,12 @@ man_pmacro(struct man *man, int ln, char *buf, int offs)
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
* above-parsed macro, so return.