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

Annotation of mandoc/man_macro.c, Revision 1.144

1.144   ! schwarze    1: /*     $Id: man_macro.c,v 1.143 2019/01/05 00:36:50 schwarze Exp $ */
1.1       kristaps    2: /*
1.65      schwarze    3:  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.143     schwarze    4:  * Copyright (c) 2012-2015, 2017-2019 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.101     schwarze   11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1.14      kristaps   12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1.101     schwarze   13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1.14      kristaps   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>
1.134     schwarze   25: #include <stdio.h>
1.1       kristaps   26: #include <stdlib.h>
                     27: #include <string.h>
                     28:
1.101     schwarze   29: #include "mandoc.h"
                     30: #include "roff.h"
1.58      kristaps   31: #include "man.h"
1.57      kristaps   32: #include "libmandoc.h"
1.106     schwarze   33: #include "roff_int.h"
1.1       kristaps   34: #include "libman.h"
                     35:
1.91      schwarze   36: static void             blk_close(MACRO_PROT_ARGS);
                     37: static void             blk_exp(MACRO_PROT_ARGS);
                     38: static void             blk_imp(MACRO_PROT_ARGS);
                     39: static void             in_line_eoln(MACRO_PROT_ARGS);
1.105     schwarze   40: static int              man_args(struct roff_man *, int,
1.60      kristaps   41:                                int *, char *, char **);
1.116     schwarze   42: static void             rew_scope(struct roff_man *, enum roff_tok);
1.19      kristaps   43:
1.127     schwarze   44: static const struct man_macro man_macros[MAN_MAX - MAN_TH] = {
1.133     schwarze   45:        { in_line_eoln, MAN_XSCOPE }, /* TH */
                     46:        { blk_imp, MAN_XSCOPE | MAN_BSCOPED }, /* SH */
                     47:        { blk_imp, MAN_XSCOPE | MAN_BSCOPED }, /* SS */
                     48:        { blk_imp, MAN_XSCOPE | MAN_BSCOPED }, /* TP */
                     49:        { blk_imp, MAN_XSCOPE | MAN_BSCOPED }, /* TQ */
                     50:        { blk_imp, MAN_XSCOPE }, /* LP */
                     51:        { blk_imp, MAN_XSCOPE }, /* PP */
                     52:        { blk_imp, MAN_XSCOPE }, /* P */
                     53:        { blk_imp, MAN_XSCOPE }, /* IP */
                     54:        { blk_imp, MAN_XSCOPE }, /* HP */
                     55:        { in_line_eoln, MAN_NSCOPED | MAN_ESCOPED | MAN_JOIN }, /* SM */
                     56:        { in_line_eoln, MAN_NSCOPED | MAN_ESCOPED | MAN_JOIN }, /* SB */
1.19      kristaps   57:        { in_line_eoln, 0 }, /* BI */
                     58:        { in_line_eoln, 0 }, /* IB */
                     59:        { in_line_eoln, 0 }, /* BR */
                     60:        { in_line_eoln, 0 }, /* RB */
1.133     schwarze   61:        { in_line_eoln, MAN_NSCOPED | MAN_ESCOPED | MAN_JOIN }, /* R */
                     62:        { in_line_eoln, MAN_NSCOPED | MAN_ESCOPED | MAN_JOIN }, /* B */
                     63:        { in_line_eoln, MAN_NSCOPED | MAN_ESCOPED | MAN_JOIN }, /* I */
1.19      kristaps   64:        { in_line_eoln, 0 }, /* IR */
                     65:        { in_line_eoln, 0 }, /* RI */
1.133     schwarze   66:        { blk_close, MAN_XSCOPE }, /* RE */
                     67:        { blk_exp, MAN_XSCOPE }, /* RS */
1.23      kristaps   68:        { in_line_eoln, 0 }, /* DT */
1.28      kristaps   69:        { in_line_eoln, 0 }, /* UC */
1.100     schwarze   70:        { in_line_eoln, MAN_NSCOPED }, /* PD */
1.45      joerg      71:        { in_line_eoln, 0 }, /* AT */
1.122     schwarze   72:        { in_line_eoln, MAN_NSCOPED }, /* in */
1.133     schwarze   73:        { blk_imp, MAN_XSCOPE }, /* SY */
                     74:        { blk_close, MAN_XSCOPE }, /* YS */
1.71      kristaps   75:        { in_line_eoln, 0 }, /* OP */
1.133     schwarze   76:        { in_line_eoln, MAN_XSCOPE }, /* EX */
                     77:        { in_line_eoln, MAN_XSCOPE }, /* EE */
                     78:        { blk_exp, MAN_XSCOPE }, /* UR */
                     79:        { blk_close, MAN_XSCOPE }, /* UE */
                     80:        { blk_exp, MAN_XSCOPE }, /* MT */
                     81:        { blk_close, MAN_XSCOPE }, /* ME */
1.19      kristaps   82: };
1.1       kristaps   83:
                     84:
1.127     schwarze   85: const struct man_macro *
                     86: man_macro(enum roff_tok tok)
                     87: {
                     88:        assert(tok >= MAN_TH && tok <= MAN_MAX);
                     89:        return man_macros + (tok - MAN_TH);
                     90: }
                     91:
1.91      schwarze   92: void
1.105     schwarze   93: man_unscope(struct roff_man *man, const struct roff_node *to)
1.1       kristaps   94: {
1.102     schwarze   95:        struct roff_node *n;
1.1       kristaps   96:
1.83      schwarze   97:        to = to->parent;
                     98:        n = man->last;
                     99:        while (n != to) {
1.87      schwarze  100:
                    101:                /* Reached the end of the document? */
                    102:
1.115     schwarze  103:                if (to == NULL && ! (n->flags & NODE_VALID)) {
1.87      schwarze  104:                        if (man->flags & (MAN_BLINE | MAN_ELINE) &&
1.133     schwarze  105:                            man_macro(n->tok)->flags &
                    106:                             (MAN_BSCOPED | MAN_NSCOPED)) {
1.135     schwarze  107:                                mandoc_msg(MANDOCERR_BLK_LINE,
                    108:                                    n->line, n->pos,
1.116     schwarze  109:                                    "EOF breaks %s", roff_name[n->tok]);
1.87      schwarze  110:                                if (man->flags & MAN_ELINE)
                    111:                                        man->flags &= ~MAN_ELINE;
                    112:                                else {
1.101     schwarze  113:                                        assert(n->type == ROFFT_HEAD);
1.87      schwarze  114:                                        n = n->parent;
                    115:                                        man->flags &= ~MAN_BLINE;
                    116:                                }
                    117:                                man->last = n;
                    118:                                n = n->parent;
1.106     schwarze  119:                                roff_node_delete(man, man->last);
1.87      schwarze  120:                                continue;
                    121:                        }
1.101     schwarze  122:                        if (n->type == ROFFT_BLOCK &&
1.127     schwarze  123:                            man_macro(n->tok)->fp == blk_exp)
1.87      schwarze  124:                                mandoc_msg(MANDOCERR_BLK_NOEND,
1.135     schwarze  125:                                    n->line, n->pos, "%s",
1.116     schwarze  126:                                    roff_name[n->tok]);
1.87      schwarze  127:                }
                    128:
1.55      kristaps  129:                /*
1.83      schwarze  130:                 * We might delete the man->last node
                    131:                 * in the post-validation phase.
                    132:                 * Save a pointer to the parent such that
                    133:                 * we know where to continue the iteration.
1.55      kristaps  134:                 */
1.89      schwarze  135:
1.83      schwarze  136:                man->last = n;
                    137:                n = n->parent;
1.115     schwarze  138:                man->last->flags |= NODE_VALID;
1.19      kristaps  139:        }
1.89      schwarze  140:
                    141:        /*
                    142:         * If we ended up at the parent of the node we were
                    143:         * supposed to rewind to, that means the target node
                    144:         * got deleted, so add the next node we parse as a child
                    145:         * of the parent instead of as a sibling of the target.
                    146:         */
                    147:
                    148:        man->next = (man->last == to) ?
1.105     schwarze  149:            ROFF_NEXT_CHILD : ROFF_NEXT_SIBLING;
1.19      kristaps  150: }
1.1       kristaps  151:
1.19      kristaps  152: /*
                    153:  * Rewinding entails ascending the parse tree until a coherent point,
                    154:  * for example, the `SH' macro will close out any intervening `SS'
                    155:  * scopes.  When a scope is closed, it must be validated and actioned.
                    156:  */
1.91      schwarze  157: static void
1.116     schwarze  158: rew_scope(struct roff_man *man, enum roff_tok tok)
1.19      kristaps  159: {
1.102     schwarze  160:        struct roff_node *n;
1.7       kristaps  161:
1.104     schwarze  162:        /* Preserve empty paragraphs before RS. */
                    163:
                    164:        n = man->last;
1.114     schwarze  165:        if (tok == MAN_RS && n->child == NULL &&
1.104     schwarze  166:            (n->tok == MAN_P || n->tok == MAN_PP || n->tok == MAN_LP))
                    167:                return;
                    168:
                    169:        for (;;) {
                    170:                if (n->type == ROFFT_ROOT)
                    171:                        return;
1.115     schwarze  172:                if (n->flags & NODE_VALID) {
1.104     schwarze  173:                        n = n->parent;
                    174:                        continue;
                    175:                }
                    176:                if (n->type != ROFFT_BLOCK) {
                    177:                        if (n->parent->type == ROFFT_ROOT) {
                    178:                                man_unscope(man, n);
                    179:                                return;
                    180:                        } else {
                    181:                                n = n->parent;
                    182:                                continue;
                    183:                        }
                    184:                }
                    185:                if (tok != MAN_SH && (n->tok == MAN_SH ||
                    186:                    (tok != MAN_SS && (n->tok == MAN_SS ||
1.127     schwarze  187:                     man_macro(n->tok)->fp == blk_exp))))
1.91      schwarze  188:                        return;
1.104     schwarze  189:                man_unscope(man, n);
                    190:                n = man->last;
1.6       kristaps  191:        }
1.19      kristaps  192: }
                    193:
1.6       kristaps  194:
1.36      kristaps  195: /*
                    196:  * Close out a generic explicit macro.
                    197:  */
1.91      schwarze  198: void
1.21      kristaps  199: blk_close(MACRO_PROT_ARGS)
                    200: {
1.124     schwarze  201:        enum roff_tok            ctok, ntok;
1.102     schwarze  202:        const struct roff_node  *nn;
1.137     schwarze  203:        char                    *p, *ep;
                    204:        int                      cline, cpos, la, nrew, target;
1.21      kristaps  205:
1.93      schwarze  206:        nrew = 1;
1.21      kristaps  207:        switch (tok) {
1.82      schwarze  208:        case MAN_RE:
1.21      kristaps  209:                ntok = MAN_RS;
1.137     schwarze  210:                la = *pos;
1.93      schwarze  211:                if ( ! man_args(man, line, pos, buf, &p))
                    212:                        break;
                    213:                for (nn = man->last->parent; nn; nn = nn->parent)
1.101     schwarze  214:                        if (nn->tok == ntok && nn->type == ROFFT_BLOCK)
1.93      schwarze  215:                                nrew++;
1.137     schwarze  216:                target = strtol(p, &ep, 10);
                    217:                if (*ep != '\0')
1.135     schwarze  218:                        mandoc_msg(MANDOCERR_ARG_EXCESS, line,
1.137     schwarze  219:                            la + (buf[la] == '"') + (int)(ep - p),
                    220:                            "RE ... %s", ep);
                    221:                free(p);
1.93      schwarze  222:                if (target == 0)
                    223:                        target = 1;
                    224:                nrew -= target;
                    225:                if (nrew < 1) {
1.135     schwarze  226:                        mandoc_msg(MANDOCERR_RE_NOTOPEN,
1.93      schwarze  227:                            line, ppos, "RE %d", target);
                    228:                        return;
                    229:                }
1.128     schwarze  230:                break;
                    231:        case MAN_YS:
                    232:                ntok = MAN_SY;
1.76      schwarze  233:                break;
1.82      schwarze  234:        case MAN_UE:
1.76      schwarze  235:                ntok = MAN_UR;
1.123     schwarze  236:                break;
                    237:        case MAN_ME:
                    238:                ntok = MAN_MT;
1.21      kristaps  239:                break;
                    240:        default:
                    241:                abort();
                    242:        }
                    243:
1.75      schwarze  244:        for (nn = man->last->parent; nn; nn = nn->parent)
1.101     schwarze  245:                if (nn->tok == ntok && nn->type == ROFFT_BLOCK && ! --nrew)
1.21      kristaps  246:                        break;
                    247:
1.91      schwarze  248:        if (nn == NULL) {
1.135     schwarze  249:                mandoc_msg(MANDOCERR_BLK_NOTOPEN,
                    250:                    line, ppos, "%s", roff_name[tok]);
1.104     schwarze  251:                rew_scope(man, MAN_PP);
1.131     schwarze  252:                if (tok == MAN_RE) {
                    253:                        roff_elem_alloc(man, line, ppos, ROFF_br);
                    254:                        man->last->flags |= NODE_LINE |
                    255:                            NODE_VALID | NODE_ENDED;
                    256:                        man->next = ROFF_NEXT_SIBLING;
                    257:                }
1.124     schwarze  258:                return;
                    259:        }
                    260:
                    261:        cline = man->last->line;
                    262:        cpos = man->last->pos;
                    263:        ctok = man->last->tok;
                    264:        man_unscope(man, nn);
                    265:
                    266:        if (tok == MAN_RE && nn->head->aux > 0)
                    267:                roff_setreg(man->roff, "an-margin", nn->head->aux, '-');
                    268:
                    269:        /* Trailing text. */
                    270:
                    271:        if (buf[*pos] != '\0') {
                    272:                roff_word_alloc(man, line, ppos, buf + *pos);
                    273:                man->last->flags |= NODE_DELIMC;
1.130     schwarze  274:                if (mandoc_eos(man->last->string, strlen(man->last->string)))
                    275:                        man->last->flags |= NODE_EOS;
1.124     schwarze  276:        }
                    277:
                    278:        /* Move a trailing paragraph behind the block. */
                    279:
                    280:        if (ctok == MAN_LP || ctok == MAN_PP || ctok == MAN_P) {
                    281:                *pos = strlen(buf);
1.125     schwarze  282:                blk_imp(man, ctok, cline, cpos, pos, buf);
1.129     schwarze  283:        }
                    284:
                    285:        /* Synopsis blocks need an explicit end marker for spacing. */
                    286:
                    287:        if (tok == MAN_YS && man->last == nn) {
                    288:                roff_elem_alloc(man, line, ppos, tok);
                    289:                man_unscope(man, man->last);
1.95      schwarze  290:        }
1.21      kristaps  291: }
                    292:
1.91      schwarze  293: void
1.35      kristaps  294: blk_exp(MACRO_PROT_ARGS)
                    295: {
1.102     schwarze  296:        struct roff_node *head;
1.98      schwarze  297:        char            *p;
1.59      kristaps  298:        int              la;
1.35      kristaps  299:
1.144   ! schwarze  300:        if (tok == MAN_RS) {
1.132     schwarze  301:                rew_scope(man, tok);
1.144   ! schwarze  302:                man->flags |= ROFF_NONOFILL;
        !           303:        }
1.108     schwarze  304:        roff_block_alloc(man, line, ppos, tok);
1.106     schwarze  305:        head = roff_head_alloc(man, line, ppos, tok);
1.35      kristaps  306:
1.98      schwarze  307:        la = *pos;
1.121     schwarze  308:        if (man_args(man, line, pos, buf, &p)) {
1.107     schwarze  309:                roff_word_alloc(man, line, la, p);
1.121     schwarze  310:                if (tok == MAN_RS) {
                    311:                        if (roff_getreg(man->roff, "an-margin") == 0)
                    312:                                roff_setreg(man->roff, "an-margin",
                    313:                                    7 * 24, '=');
                    314:                        if ((head->aux = strtod(p, NULL) * 24.0) > 0)
                    315:                                roff_setreg(man->roff, "an-margin",
                    316:                                    head->aux, '+');
                    317:                }
1.137     schwarze  318:                free(p);
1.121     schwarze  319:        }
1.35      kristaps  320:
1.98      schwarze  321:        if (buf[*pos] != '\0')
1.135     schwarze  322:                mandoc_msg(MANDOCERR_ARG_EXCESS, line, *pos,
                    323:                    "%s ... %s", roff_name[tok], buf + *pos);
1.73      schwarze  324:
1.98      schwarze  325:        man_unscope(man, head);
1.106     schwarze  326:        roff_body_alloc(man, line, ppos, tok);
1.144   ! schwarze  327:        man->flags &= ~ROFF_NONOFILL;
1.35      kristaps  328: }
                    329:
1.19      kristaps  330: /*
1.101     schwarze  331:  * Parse an implicit-block macro.  These contain a ROFFT_HEAD and a
                    332:  * ROFFT_BODY contained within a ROFFT_BLOCK.  Rules for closing out other
1.19      kristaps  333:  * scopes, such as `SH' closing out an `SS', are defined in the rew
                    334:  * routines.
                    335:  */
1.91      schwarze  336: void
1.19      kristaps  337: blk_imp(MACRO_PROT_ARGS)
                    338: {
1.59      kristaps  339:        int              la;
1.19      kristaps  340:        char            *p;
1.102     schwarze  341:        struct roff_node *n;
1.19      kristaps  342:
1.104     schwarze  343:        rew_scope(man, tok);
1.143     schwarze  344:        man->flags |= ROFF_NONOFILL;
1.140     schwarze  345:        if (tok == MAN_SH || tok == MAN_SS)
                    346:                man->flags &= ~ROFF_NOFILL;
                    347:        roff_block_alloc(man, line, ppos, tok);
1.106     schwarze  348:        n = roff_head_alloc(man, line, ppos, tok);
1.25      kristaps  349:
1.19      kristaps  350:        /* Add line arguments. */
1.3       kristaps  351:
1.19      kristaps  352:        for (;;) {
                    353:                la = *pos;
1.75      schwarze  354:                if ( ! man_args(man, line, pos, buf, &p))
1.19      kristaps  355:                        break;
1.107     schwarze  356:                roff_word_alloc(man, line, la, p);
1.137     schwarze  357:                free(p);
1.6       kristaps  358:        }
                    359:
1.99      schwarze  360:        /*
                    361:         * For macros having optional next-line scope,
                    362:         * keep the head open if there were no arguments.
1.133     schwarze  363:         * For `TP' and `TQ', always keep the head open.
1.99      schwarze  364:         */
1.19      kristaps  365:
1.133     schwarze  366:        if (man_macro(tok)->flags & MAN_BSCOPED &&
1.126     schwarze  367:            (tok == MAN_TP || tok == MAN_TQ || n == man->last)) {
1.99      schwarze  368:                man->flags |= MAN_BLINE;
                    369:                return;
1.27      kristaps  370:        }
1.99      schwarze  371:
                    372:        /* Close out the head and open the body. */
                    373:
1.103     schwarze  374:        man_unscope(man, n);
1.106     schwarze  375:        roff_body_alloc(man, line, ppos, tok);
1.143     schwarze  376:        man->flags &= ~ROFF_NONOFILL;
1.4       kristaps  377: }
                    378:
1.91      schwarze  379: void
1.19      kristaps  380: in_line_eoln(MACRO_PROT_ARGS)
1.3       kristaps  381: {
1.59      kristaps  382:        int              la;
1.19      kristaps  383:        char            *p;
1.102     schwarze  384:        struct roff_node *n;
1.3       kristaps  385:
1.108     schwarze  386:        roff_elem_alloc(man, line, ppos, tok);
1.75      schwarze  387:        n = man->last;
1.141     schwarze  388:
                    389:        if (tok == MAN_EX)
                    390:                man->flags |= ROFF_NOFILL;
                    391:        else if (tok == MAN_EE)
                    392:                man->flags &= ~ROFF_NOFILL;
1.3       kristaps  393:
1.19      kristaps  394:        for (;;) {
1.120     schwarze  395:                if (buf[*pos] != '\0' && man->last != n && tok == MAN_PD) {
1.135     schwarze  396:                        mandoc_msg(MANDOCERR_ARG_EXCESS, line, *pos,
                    397:                            "%s ... %s", roff_name[tok], buf + *pos);
1.96      schwarze  398:                        break;
                    399:                }
1.19      kristaps  400:                la = *pos;
1.75      schwarze  401:                if ( ! man_args(man, line, pos, buf, &p))
1.19      kristaps  402:                        break;
1.127     schwarze  403:                if (man_macro(tok)->flags & MAN_JOIN &&
1.101     schwarze  404:                    man->last->type == ROFFT_TEXT)
1.107     schwarze  405:                        roff_word_append(man, p);
1.91      schwarze  406:                else
1.107     schwarze  407:                        roff_word_alloc(man, line, la, p);
1.137     schwarze  408:                free(p);
1.19      kristaps  409:        }
1.78      schwarze  410:
                    411:        /*
1.115     schwarze  412:         * Append NODE_EOS in case the last snipped argument
1.78      schwarze  413:         * ends with a dot, e.g. `.IR syslog (3).'
                    414:         */
                    415:
                    416:        if (n != man->last &&
1.80      schwarze  417:            mandoc_eos(man->last->string, strlen(man->last->string)))
1.115     schwarze  418:                man->last->flags |= NODE_EOS;
1.3       kristaps  419:
1.31      kristaps  420:        /*
1.133     schwarze  421:         * If no arguments are specified and this is MAN_ESCOPED (i.e.,
1.31      kristaps  422:         * next-line scoped), then set our mode to indicate that we're
                    423:         * waiting for terms to load into our context.
                    424:         */
                    425:
1.133     schwarze  426:        if (n == man->last && man_macro(tok)->flags & MAN_ESCOPED) {
1.75      schwarze  427:                man->flags |= MAN_ELINE;
1.91      schwarze  428:                return;
1.31      kristaps  429:        }
1.64      kristaps  430:
1.101     schwarze  431:        assert(man->last->type != ROFFT_ROOT);
1.105     schwarze  432:        man->next = ROFF_NEXT_SIBLING;
1.82      schwarze  433:
1.113     schwarze  434:        /* Rewind our element scope. */
1.3       kristaps  435:
1.75      schwarze  436:        for ( ; man->last; man->last = man->last->parent) {
1.142     schwarze  437:                man->last->flags |= NODE_VALID;
1.75      schwarze  438:                if (man->last == n)
1.19      kristaps  439:                        break;
                    440:        }
1.133     schwarze  441:
                    442:        /* Rewind next-line scoped ancestors, if any. */
                    443:
                    444:        if (man_macro(tok)->flags & MAN_ESCOPED)
                    445:                man_descope(man, line, ppos, NULL);
1.19      kristaps  446: }
1.3       kristaps  447:
1.91      schwarze  448: void
1.109     schwarze  449: man_endparse(struct roff_man *man)
1.19      kristaps  450: {
1.138     schwarze  451:        man_unscope(man, man->meta.first);
1.19      kristaps  452: }
1.3       kristaps  453:
1.60      kristaps  454: static int
1.105     schwarze  455: man_args(struct roff_man *man, int line, int *pos, char *buf, char **v)
1.60      kristaps  456: {
                    457:        char     *start;
                    458:
                    459:        assert(*pos);
                    460:        *v = start = buf + *pos;
                    461:        assert(' ' != *start);
                    462:
                    463:        if ('\0' == *start)
1.112     schwarze  464:                return 0;
1.60      kristaps  465:
1.137     schwarze  466:        *v = roff_getarg(man->roff, v, line, pos);
1.112     schwarze  467:        return 1;
1.60      kristaps  468: }

CVSweb