X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/cab6609efc2349c35b5726dd5a11139fcfff735d..ccfcc5247a1dcd27d5b8759547f16bdb451120e3:/mandoc-db.c diff --git a/mandoc-db.c b/mandoc-db.c index 1086a3fb..85d5036e 100644 --- a/mandoc-db.c +++ b/mandoc-db.c @@ -1,4 +1,4 @@ -/* $Id: mandoc-db.c,v 1.16 2011/05/03 10:08:09 kristaps Exp $ */ +/* $Id: mandoc-db.c,v 1.18 2011/05/04 08:21:17 kristaps Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * @@ -49,7 +49,9 @@ enum type { MANDOC_UTILITY, MANDOC_INCLUDES, MANDOC_VARIABLE, - MANDOC_STANDARD + MANDOC_STANDARD, + MANDOC_AUTHOR, + MANDOC_CONFIG }; #define MAN_ARGS DB *db, \ @@ -77,6 +79,8 @@ static int pman_node(MAN_ARGS); static void pmdoc(DB *, const char *, DBT *, size_t *, DBT *, DBT *, size_t *, struct mdoc *); static void pmdoc_node(MDOC_ARGS); +static void pmdoc_An(MDOC_ARGS); +static void pmdoc_Cd(MDOC_ARGS); static void pmdoc_Fd(MDOC_ARGS); static void pmdoc_In(MDOC_ARGS); static void pmdoc_Fn(MDOC_ARGS); @@ -106,9 +110,9 @@ static const pmdoc_nf mdocs[MDOC_MAX] = { NULL, /* El */ NULL, /* It */ NULL, /* Ad */ - NULL, /* An */ + pmdoc_An, /* An */ NULL, /* Ar */ - NULL, /* Cd */ + pmdoc_Cd, /* Cd */ NULL, /* Cm */ NULL, /* Dv */ NULL, /* Er */ @@ -526,6 +530,23 @@ dbt_append(DBT *key, size_t *ksz, const char *cp) dbt_appendb(key, ksz, cp, sz + 1); } +/* ARGSUSED */ +static void +pmdoc_An(MDOC_ARGS) +{ + uint32_t fl; + + if (SEC_AUTHORS != n->sec) + return; + + for (n = n->child; n; n = n->next) + if (MDOC_TEXT == n->type) + dbt_append(key, ksz, n->string); + + fl = MANDOC_AUTHOR; + memcpy(val->data, &fl, 4); +} + /* ARGSUSED */ static void pmdoc_Fd(MDOC_ARGS) @@ -572,6 +593,23 @@ pmdoc_Fd(MDOC_ARGS) memcpy(val->data, &fl, 4); } +/* ARGSUSED */ +static void +pmdoc_Cd(MDOC_ARGS) +{ + uint32_t fl; + + if (SEC_SYNOPSIS != n->sec) + return; + + for (n = n->child; n; n = n->next) + if (MDOC_TEXT == n->type) + dbt_append(key, ksz, n->string); + + fl = MANDOC_CONFIG; + memcpy(val->data, &fl, 4); +} + /* ARGSUSED */ static void pmdoc_In(MDOC_ARGS)