[BACK]Return to man_macro.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/man_macro.c, Revision 1.94

1.94    ! schwarze    1: /*     $Id: man_macro.c,v 1.93 2015/01/24 01:58:33 schwarze Exp $ */
1.1       kristaps    2: /*
1.65      schwarze    3:  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.93      schwarze    4:  * Copyright (c) 2012, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
1.79      schwarze    5:  * Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
1.1       kristaps    6:  *
                      7:  * Permission to use, copy, modify, and distribute this software for any
1.14      kristaps    8:  * purpose with or without fee is hereby granted, provided that the above
                      9:  * copyright notice and this permission notice appear in all copies.
1.1       kristaps   10:  *
1.14      kristaps   11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     14:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     15:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     16:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     17:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       kristaps   18:  */
1.30      kristaps   19: #include "config.h"
1.88      schwarze   20:
                     21: #include <sys/types.h>
1.30      kristaps   22:
1.1       kristaps   23: #include <assert.h>
                     24: #include <ctype.h>
                     25: #include <stdlib.h>
                     26: #include <string.h>
                     27:
1.58      kristaps   28: #include "man.h"
1.46      kristaps   29: #include "mandoc.h"
1.57      kristaps   30: #include "libmandoc.h"
1.1       kristaps   31: #include "libman.h"
                     32:
1.34      kristaps   33: enum   rew {
                     34:        REW_REWIND,
                     35:        REW_NOHALT,
1.40      kristaps   36:        REW_HALT
1.34      kristaps   37: };
1.19      kristaps   38:
1.91      schwarze   39: static void             blk_close(MACRO_PROT_ARGS);
                     40: static void             blk_exp(MACRO_PROT_ARGS);
                     41: static void             blk_imp(MACRO_PROT_ARGS);
                     42: static void             in_line_eoln(MACRO_PROT_ARGS);
1.82      schwarze   43: static int              man_args(struct man *, int,
1.60      kristaps   44:                                int *, char *, char **);
1.19      kristaps   45:
1.91      schwarze   46: static void             rew_scope(enum man_type,
1.33      kristaps   47:                                struct man *, enum mant);
1.82      schwarze   48: static enum rew         rew_dohalt(enum mant, enum man_type,
1.19      kristaps   49:                                const struct man_node *);
1.82      schwarze   50: static enum rew         rew_block(enum mant, enum man_type,
1.21      kristaps   51:                                const struct man_node *);
1.19      kristaps   52:
                     53: const  struct man_macro __man_macros[MAN_MAX] = {
1.31      kristaps   54:        { in_line_eoln, MAN_NSCOPED }, /* br */
1.66      schwarze   55:        { in_line_eoln, MAN_BSCOPE }, /* TH */
                     56:        { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SH */
                     57:        { blk_imp, MAN_BSCOPE | MAN_SCOPED }, /* SS */
                     58:        { blk_imp, MAN_BSCOPE | MAN_SCOPED | MAN_FSCOPED }, /* TP */
                     59:        { blk_imp, MAN_BSCOPE }, /* LP */
                     60:        { blk_imp, MAN_BSCOPE }, /* PP */
                     61:        { blk_imp, MAN_BSCOPE }, /* P */
                     62:        { blk_imp, MAN_BSCOPE }, /* IP */
                     63:        { blk_imp, MAN_BSCOPE }, /* HP */
1.90      schwarze   64:        { in_line_eoln, MAN_SCOPED | MAN_JOIN }, /* SM */
                     65:        { in_line_eoln, MAN_SCOPED | MAN_JOIN }, /* SB */
1.19      kristaps   66:        { in_line_eoln, 0 }, /* BI */
                     67:        { in_line_eoln, 0 }, /* IB */
                     68:        { in_line_eoln, 0 }, /* BR */
                     69:        { in_line_eoln, 0 }, /* RB */
1.90      schwarze   70:        { in_line_eoln, MAN_SCOPED | MAN_JOIN }, /* R */
                     71:        { in_line_eoln, MAN_SCOPED | MAN_JOIN }, /* B */
                     72:        { in_line_eoln, MAN_SCOPED | MAN_JOIN }, /* I */
1.19      kristaps   73:        { in_line_eoln, 0 }, /* IR */
                     74:        { in_line_eoln, 0 }, /* RI */
1.31      kristaps   75:        { in_line_eoln, MAN_NSCOPED }, /* sp */
1.66      schwarze   76:        { in_line_eoln, MAN_BSCOPE }, /* nf */
                     77:        { in_line_eoln, MAN_BSCOPE }, /* fi */
1.92      schwarze   78:        { blk_close, MAN_BSCOPE }, /* RE */
1.74      kristaps   79:        { blk_exp, MAN_BSCOPE | MAN_EXPLICIT }, /* RS */
1.23      kristaps   80:        { in_line_eoln, 0 }, /* DT */
1.28      kristaps   81:        { in_line_eoln, 0 }, /* UC */
1.29      kristaps   82:        { in_line_eoln, 0 }, /* PD */
1.45      joerg      83:        { in_line_eoln, 0 }, /* AT */
1.49      kristaps   84:        { in_line_eoln, 0 }, /* in */
1.53      kristaps   85:        { in_line_eoln, 0 }, /* ft */
1.71      kristaps   86:        { in_line_eoln, 0 }, /* OP */
1.72      schwarze   87:        { in_line_eoln, MAN_BSCOPE }, /* EX */
                     88:        { in_line_eoln, MAN_BSCOPE }, /* EE */
1.76      schwarze   89:        { blk_exp, MAN_BSCOPE | MAN_EXPLICIT }, /* UR */
1.92      schwarze   90:        { blk_close, MAN_BSCOPE }, /* UE */
1.81      schwarze   91:        { in_line_eoln, 0 }, /* ll */
1.19      kristaps   92: };
1.9       kristaps   93:
1.19      kristaps   94: const  struct man_macro * const man_macros = __man_macros;
1.1       kristaps   95:
                     96:
1.91      schwarze   97: void
1.83      schwarze   98: man_unscope(struct man *man, const struct man_node *to)
1.1       kristaps   99: {
1.55      kristaps  100:        struct man_node *n;
1.1       kristaps  101:
1.83      schwarze  102:        to = to->parent;
                    103:        n = man->last;
                    104:        while (n != to) {
1.87      schwarze  105:
                    106:                /* Reached the end of the document? */
                    107:
                    108:                if (to == NULL && ! (n->flags & MAN_VALID)) {
                    109:                        if (man->flags & (MAN_BLINE | MAN_ELINE) &&
                    110:                            man_macros[n->tok].flags & MAN_SCOPED) {
                    111:                                mandoc_vmsg(MANDOCERR_BLK_LINE,
                    112:                                    man->parse, n->line, n->pos,
                    113:                                    "EOF breaks %s",
                    114:                                    man_macronames[n->tok]);
                    115:                                if (man->flags & MAN_ELINE)
                    116:                                        man->flags &= ~MAN_ELINE;
                    117:                                else {
                    118:                                        assert(n->type == MAN_HEAD);
                    119:                                        n = n->parent;
                    120:                                        man->flags &= ~MAN_BLINE;
                    121:                                }
                    122:                                man->last = n;
                    123:                                n = n->parent;
                    124:                                man_node_delete(man, man->last);
                    125:                                continue;
                    126:                        }
                    127:                        if (n->type == MAN_BLOCK &&
                    128:                            man_macros[n->tok].flags & MAN_EXPLICIT)
                    129:                                mandoc_msg(MANDOCERR_BLK_NOEND,
                    130:                                    man->parse, n->line, n->pos,
                    131:                                    man_macronames[n->tok]);
                    132:                }
                    133:
1.55      kristaps  134:                /*
1.83      schwarze  135:                 * We might delete the man->last node
                    136:                 * in the post-validation phase.
                    137:                 * Save a pointer to the parent such that
                    138:                 * we know where to continue the iteration.
1.55      kristaps  139:                 */
1.89      schwarze  140:
1.83      schwarze  141:                man->last = n;
                    142:                n = n->parent;
1.91      schwarze  143:                man_valid_post(man);
1.19      kristaps  144:        }
1.89      schwarze  145:
                    146:        /*
                    147:         * If we ended up at the parent of the node we were
                    148:         * supposed to rewind to, that means the target node
                    149:         * got deleted, so add the next node we parse as a child
                    150:         * of the parent instead of as a sibling of the target.
                    151:         */
                    152:
                    153:        man->next = (man->last == to) ?
                    154:            MAN_NEXT_CHILD : MAN_NEXT_SIBLING;
1.19      kristaps  155: }
1.1       kristaps  156:
1.34      kristaps  157: static enum rew
1.33      kristaps  158: rew_block(enum mant ntok, enum man_type type, const struct man_node *n)
1.21      kristaps  159: {
                    160:
1.91      schwarze  161:        if (type == MAN_BLOCK && ntok == n->parent->tok &&
                    162:            n->parent->type == MAN_BODY)
1.21      kristaps  163:                return(REW_REWIND);
                    164:        return(ntok == n->tok ? REW_HALT : REW_NOHALT);
                    165: }
                    166:
1.19      kristaps  167: /*
                    168:  * There are three scope levels: scoped to the root (all), scoped to the
                    169:  * section (all less sections), and scoped to subsections (all less
                    170:  * sections and subsections).
                    171:  */
1.82      schwarze  172: static enum rew
1.33      kristaps  173: rew_dohalt(enum mant tok, enum man_type type, const struct man_node *n)
1.19      kristaps  174: {
1.34      kristaps  175:        enum rew         c;
1.1       kristaps  176:
1.38      kristaps  177:        /* We cannot progress beyond the root ever. */
1.19      kristaps  178:        if (MAN_ROOT == n->type)
                    179:                return(REW_HALT);
1.38      kristaps  180:
1.19      kristaps  181:        assert(n->parent);
1.38      kristaps  182:
                    183:        /* Normal nodes shouldn't go to the level of the root. */
1.19      kristaps  184:        if (MAN_ROOT == n->parent->type)
                    185:                return(REW_REWIND);
1.38      kristaps  186:
                    187:        /* Already-validated nodes should be closed out. */
1.19      kristaps  188:        if (MAN_VALID & n->flags)
                    189:                return(REW_NOHALT);
                    190:
1.38      kristaps  191:        /* First: rewind to ourselves. */
1.73      schwarze  192:        if (type == n->type && tok == n->tok) {
                    193:                if (MAN_EXPLICIT & man_macros[n->tok].flags)
                    194:                        return(REW_HALT);
                    195:                else
                    196:                        return(REW_REWIND);
                    197:        }
1.21      kristaps  198:
1.82      schwarze  199:        /*
1.38      kristaps  200:         * Next follow the implicit scope-smashings as defined by man.7:
                    201:         * section, sub-section, etc.
                    202:         */
                    203:
1.19      kristaps  204:        switch (tok) {
1.82      schwarze  205:        case MAN_SH:
1.19      kristaps  206:                break;
1.82      schwarze  207:        case MAN_SS:
1.20      kristaps  208:                /* Rewind to a section, if a block. */
1.21      kristaps  209:                if (REW_NOHALT != (c = rew_block(MAN_SH, type, n)))
                    210:                        return(c);
                    211:                break;
1.82      schwarze  212:        case MAN_RS:
1.73      schwarze  213:                /* Preserve empty paragraphs before RS. */
                    214:                if (0 == n->nchild && (MAN_P == n->tok ||
                    215:                    MAN_PP == n->tok || MAN_LP == n->tok))
                    216:                        return(REW_HALT);
1.21      kristaps  217:                /* Rewind to a subsection, if a block. */
                    218:                if (REW_NOHALT != (c = rew_block(MAN_SS, type, n)))
                    219:                        return(c);
                    220:                /* Rewind to a section, if a block. */
                    221:                if (REW_NOHALT != (c = rew_block(MAN_SH, type, n)))
                    222:                        return(c);
1.19      kristaps  223:                break;
                    224:        default:
1.21      kristaps  225:                /* Rewind to an offsetter, if a block. */
                    226:                if (REW_NOHALT != (c = rew_block(MAN_RS, type, n)))
                    227:                        return(c);
1.20      kristaps  228:                /* Rewind to a subsection, if a block. */
1.21      kristaps  229:                if (REW_NOHALT != (c = rew_block(MAN_SS, type, n)))
                    230:                        return(c);
1.20      kristaps  231:                /* Rewind to a section, if a block. */
1.21      kristaps  232:                if (REW_NOHALT != (c = rew_block(MAN_SH, type, n)))
                    233:                        return(c);
1.19      kristaps  234:                break;
1.3       kristaps  235:        }
1.1       kristaps  236:
1.19      kristaps  237:        return(REW_NOHALT);
                    238: }
1.9       kristaps  239:
1.19      kristaps  240: /*
                    241:  * Rewinding entails ascending the parse tree until a coherent point,
                    242:  * for example, the `SH' macro will close out any intervening `SS'
                    243:  * scopes.  When a scope is closed, it must be validated and actioned.
                    244:  */
1.91      schwarze  245: static void
1.75      schwarze  246: rew_scope(enum man_type type, struct man *man, enum mant tok)
1.19      kristaps  247: {
                    248:        struct man_node *n;
1.34      kristaps  249:        enum rew         c;
1.7       kristaps  250:
1.75      schwarze  251:        for (n = man->last; n; n = n->parent) {
1.82      schwarze  252:                /*
1.19      kristaps  253:                 * Whether we should stop immediately (REW_HALT), stop
                    254:                 * and rewind until this point (REW_REWIND), or keep
                    255:                 * rewinding (REW_NOHALT).
                    256:                 */
                    257:                c = rew_dohalt(tok, type, n);
                    258:                if (REW_HALT == c)
1.91      schwarze  259:                        return;
1.19      kristaps  260:                if (REW_REWIND == c)
1.7       kristaps  261:                        break;
1.6       kristaps  262:        }
1.1       kristaps  263:
1.82      schwarze  264:        /*
1.38      kristaps  265:         * Rewind until the current point.  Warn if we're a roff
                    266:         * instruction that's mowing over explicit scopes.
                    267:         */
1.19      kristaps  268:
1.91      schwarze  269:        man_unscope(man, n);
1.19      kristaps  270: }
                    271:
1.6       kristaps  272:
1.36      kristaps  273: /*
                    274:  * Close out a generic explicit macro.
                    275:  */
1.91      schwarze  276: void
1.21      kristaps  277: blk_close(MACRO_PROT_ARGS)
                    278: {
1.82      schwarze  279:        enum mant                ntok;
1.21      kristaps  280:        const struct man_node   *nn;
1.93      schwarze  281:        char                    *p;
                    282:        int                      nrew, target;
1.21      kristaps  283:
1.93      schwarze  284:        nrew = 1;
1.21      kristaps  285:        switch (tok) {
1.82      schwarze  286:        case MAN_RE:
1.21      kristaps  287:                ntok = MAN_RS;
1.93      schwarze  288:                if ( ! man_args(man, line, pos, buf, &p))
                    289:                        break;
                    290:                for (nn = man->last->parent; nn; nn = nn->parent)
                    291:                        if (nn->tok == ntok && nn->type == MAN_BLOCK)
                    292:                                nrew++;
                    293:                target = strtol(p, &p, 10);
                    294:                if (*p != '\0')
                    295:                        mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse,
                    296:                            line, p - buf, "RE ... %s", p);
                    297:                if (target == 0)
                    298:                        target = 1;
                    299:                nrew -= target;
                    300:                if (nrew < 1) {
                    301:                        mandoc_vmsg(MANDOCERR_RE_NOTOPEN, man->parse,
                    302:                            line, ppos, "RE %d", target);
                    303:                        return;
                    304:                }
1.76      schwarze  305:                break;
1.82      schwarze  306:        case MAN_UE:
1.76      schwarze  307:                ntok = MAN_UR;
1.21      kristaps  308:                break;
                    309:        default:
                    310:                abort();
                    311:                /* NOTREACHED */
                    312:        }
                    313:
1.75      schwarze  314:        for (nn = man->last->parent; nn; nn = nn->parent)
1.93      schwarze  315:                if (nn->tok == ntok && nn->type == MAN_BLOCK && ! --nrew)
1.21      kristaps  316:                        break;
                    317:
1.91      schwarze  318:        if (nn == NULL) {
1.84      schwarze  319:                mandoc_msg(MANDOCERR_BLK_NOTOPEN, man->parse,
                    320:                    line, ppos, man_macronames[tok]);
1.91      schwarze  321:                rew_scope(MAN_BLOCK, man, MAN_PP);
1.82      schwarze  322:        } else
1.83      schwarze  323:                man_unscope(man, nn);
1.21      kristaps  324: }
                    325:
1.91      schwarze  326: void
1.35      kristaps  327: blk_exp(MACRO_PROT_ARGS)
                    328: {
1.73      schwarze  329:        struct man_node *n;
1.59      kristaps  330:        int              la;
1.35      kristaps  331:        char            *p;
                    332:
1.91      schwarze  333:        rew_scope(MAN_BLOCK, man, tok);
                    334:        man_block_alloc(man, line, ppos, tok);
                    335:        man_head_alloc(man, line, ppos, tok);
1.35      kristaps  336:
                    337:        for (;;) {
                    338:                la = *pos;
1.75      schwarze  339:                if ( ! man_args(man, line, pos, buf, &p))
1.35      kristaps  340:                        break;
1.91      schwarze  341:                man_word_alloc(man, line, la, p);
1.35      kristaps  342:        }
                    343:
1.75      schwarze  344:        assert(man);
1.35      kristaps  345:        assert(tok != MAN_MAX);
                    346:
1.91      schwarze  347:        for (n = man->last; n; n = n->parent)
                    348:                if (n->tok == tok) {
                    349:                        assert(n->type == MAN_HEAD);
                    350:                        man_unscope(man, n);
                    351:                        break;
                    352:                }
1.73      schwarze  353:
1.91      schwarze  354:        man_body_alloc(man, line, ppos, tok);
1.35      kristaps  355: }
                    356:
1.19      kristaps  357: /*
                    358:  * Parse an implicit-block macro.  These contain a MAN_HEAD and a
                    359:  * MAN_BODY contained within a MAN_BLOCK.  Rules for closing out other
                    360:  * scopes, such as `SH' closing out an `SS', are defined in the rew
                    361:  * routines.
                    362:  */
1.91      schwarze  363: void
1.19      kristaps  364: blk_imp(MACRO_PROT_ARGS)
                    365: {
1.59      kristaps  366:        int              la;
1.19      kristaps  367:        char            *p;
1.25      kristaps  368:        struct man_node *n;
1.19      kristaps  369:
1.91      schwarze  370:        rew_scope(MAN_BODY, man, tok);
                    371:        rew_scope(MAN_BLOCK, man, tok);
                    372:        man_block_alloc(man, line, ppos, tok);
                    373:        man_head_alloc(man, line, ppos, tok);
1.75      schwarze  374:        n = man->last;
1.25      kristaps  375:
1.19      kristaps  376:        /* Add line arguments. */
1.3       kristaps  377:
1.19      kristaps  378:        for (;;) {
                    379:                la = *pos;
1.75      schwarze  380:                if ( ! man_args(man, line, pos, buf, &p))
1.19      kristaps  381:                        break;
1.91      schwarze  382:                man_word_alloc(man, line, la, p);
1.6       kristaps  383:        }
                    384:
1.19      kristaps  385:        /* Close out head and open body (unless MAN_SCOPE). */
                    386:
1.91      schwarze  387:        if (man_macros[tok].flags & MAN_SCOPED) {
1.27      kristaps  388:                /* If we're forcing scope (`TP'), keep it open. */
1.91      schwarze  389:                if (man_macros[tok].flags & MAN_FSCOPED) {
1.75      schwarze  390:                        man->flags |= MAN_BLINE;
1.91      schwarze  391:                        return;
1.75      schwarze  392:                } else if (n == man->last) {
                    393:                        man->flags |= MAN_BLINE;
1.91      schwarze  394:                        return;
1.27      kristaps  395:                }
                    396:        }
1.91      schwarze  397:        rew_scope(MAN_HEAD, man, tok);
                    398:        man_body_alloc(man, line, ppos, tok);
1.4       kristaps  399: }
                    400:
1.91      schwarze  401: void
1.19      kristaps  402: in_line_eoln(MACRO_PROT_ARGS)
1.3       kristaps  403: {
1.59      kristaps  404:        int              la;
1.19      kristaps  405:        char            *p;
                    406:        struct man_node *n;
1.3       kristaps  407:
1.91      schwarze  408:        man_elem_alloc(man, line, ppos, tok);
1.75      schwarze  409:        n = man->last;
1.3       kristaps  410:
1.19      kristaps  411:        for (;;) {
                    412:                la = *pos;
1.75      schwarze  413:                if ( ! man_args(man, line, pos, buf, &p))
1.19      kristaps  414:                        break;
1.90      schwarze  415:                if (man_macros[tok].flags & MAN_JOIN &&
                    416:                    man->last->type == MAN_TEXT)
                    417:                        man_word_append(man, p);
1.91      schwarze  418:                else
                    419:                        man_word_alloc(man, line, la, p);
1.19      kristaps  420:        }
1.78      schwarze  421:
                    422:        /*
                    423:         * Append MAN_EOS in case the last snipped argument
                    424:         * ends with a dot, e.g. `.IR syslog (3).'
                    425:         */
                    426:
                    427:        if (n != man->last &&
1.80      schwarze  428:            mandoc_eos(man->last->string, strlen(man->last->string)))
1.78      schwarze  429:                man->last->flags |= MAN_EOS;
1.3       kristaps  430:
1.31      kristaps  431:        /*
                    432:         * If no arguments are specified and this is MAN_SCOPED (i.e.,
                    433:         * next-line scoped), then set our mode to indicate that we're
                    434:         * waiting for terms to load into our context.
                    435:         */
                    436:
1.91      schwarze  437:        if (n == man->last && man_macros[tok].flags & MAN_SCOPED) {
                    438:                assert( ! (man_macros[tok].flags & MAN_NSCOPED));
1.75      schwarze  439:                man->flags |= MAN_ELINE;
1.91      schwarze  440:                return;
1.31      kristaps  441:        }
1.64      kristaps  442:
1.91      schwarze  443:        assert(man->last->type != MAN_ROOT);
1.75      schwarze  444:        man->next = MAN_NEXT_SIBLING;
1.82      schwarze  445:
1.19      kristaps  446:        /*
1.31      kristaps  447:         * Rewind our element scope.  Note that when TH is pruned, we'll
                    448:         * be back at the root, so make sure that we don't clobber as
                    449:         * its sibling.
1.19      kristaps  450:         */
1.3       kristaps  451:
1.75      schwarze  452:        for ( ; man->last; man->last = man->last->parent) {
                    453:                if (man->last == n)
1.19      kristaps  454:                        break;
1.75      schwarze  455:                if (man->last->type == MAN_ROOT)
1.19      kristaps  456:                        break;
1.91      schwarze  457:                man_valid_post(man);
1.19      kristaps  458:        }
1.3       kristaps  459:
1.75      schwarze  460:        assert(man->last);
1.3       kristaps  461:
                    462:        /*
1.82      schwarze  463:         * Same here regarding whether we're back at the root.
1.3       kristaps  464:         */
                    465:
1.91      schwarze  466:        if (man->last->type != MAN_ROOT)
                    467:                man_valid_post(man);
1.19      kristaps  468: }
1.3       kristaps  469:
                    470:
1.91      schwarze  471: void
1.75      schwarze  472: man_macroend(struct man *man)
1.19      kristaps  473: {
1.22      kristaps  474:
1.91      schwarze  475:        man_unscope(man, man->first);
1.19      kristaps  476: }
1.3       kristaps  477:
1.60      kristaps  478: static int
1.75      schwarze  479: man_args(struct man *man, int line, int *pos, char *buf, char **v)
1.60      kristaps  480: {
                    481:        char     *start;
                    482:
                    483:        assert(*pos);
                    484:        *v = start = buf + *pos;
                    485:        assert(' ' != *start);
                    486:
                    487:        if ('\0' == *start)
                    488:                return(0);
                    489:
1.75      schwarze  490:        *v = mandoc_getarg(man->parse, v, line, pos);
1.60      kristaps  491:        return(1);
                    492: }

CVSweb