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

Annotation of mandoc/man_macro.c, Revision 1.93

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

CVSweb