]> git.cameronkatri.com Git - mandoc.git/blob - mdoc_argv.c
Made unterminated quoted literals be a warning, like groff.
[mandoc.git] / mdoc_argv.c
1 /* $Id: mdoc_argv.c,v 1.18 2009/07/18 18:59:33 kristaps Exp $ */
2 /*
3 * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17 #include <sys/types.h>
18
19 #include <assert.h>
20 #include <ctype.h>
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24
25 #include "libmdoc.h"
26
27 /*
28 * Routines to parse arguments of macros. Arguments follow the syntax
29 * of `-arg [val [valN...]]'. Arguments come in all types: quoted
30 * arguments, multiple arguments per value, no-value arguments, etc.
31 *
32 * There's no limit to the number or arguments that may be allocated.
33 */
34
35 /* FIXME .Bf Li raises "macro-like parameter". */
36
37 #define ARGS_DELIM (1 << 1)
38 #define ARGS_TABSEP (1 << 2)
39
40 #define ARGV_NONE (1 << 0)
41 #define ARGV_SINGLE (1 << 1)
42 #define ARGV_MULTI (1 << 2)
43 #define ARGV_OPT_SINGLE (1 << 3)
44
45 #define MULTI_STEP 5
46
47 static int argv_a2arg(int, const char *);
48 static int args(struct mdoc *, int, int *,
49 char *, int, char **);
50 static int argv(struct mdoc *, int,
51 struct mdoc_argv *, int *, char *);
52 static int argv_single(struct mdoc *, int,
53 struct mdoc_argv *, int *, char *);
54 static int argv_opt_single(struct mdoc *, int,
55 struct mdoc_argv *, int *, char *);
56 static int argv_multi(struct mdoc *, int,
57 struct mdoc_argv *, int *, char *);
58
59 /* Per-argument flags. */
60
61 static int mdoc_argvflags[MDOC_ARG_MAX] = {
62 ARGV_NONE, /* MDOC_Split */
63 ARGV_NONE, /* MDOC_Nosplit */
64 ARGV_NONE, /* MDOC_Ragged */
65 ARGV_NONE, /* MDOC_Unfilled */
66 ARGV_NONE, /* MDOC_Literal */
67 ARGV_NONE, /* MDOC_File */
68 ARGV_SINGLE, /* MDOC_Offset */
69 ARGV_NONE, /* MDOC_Bullet */
70 ARGV_NONE, /* MDOC_Dash */
71 ARGV_NONE, /* MDOC_Hyphen */
72 ARGV_NONE, /* MDOC_Item */
73 ARGV_NONE, /* MDOC_Enum */
74 ARGV_NONE, /* MDOC_Tag */
75 ARGV_NONE, /* MDOC_Diag */
76 ARGV_NONE, /* MDOC_Hang */
77 ARGV_NONE, /* MDOC_Ohang */
78 ARGV_NONE, /* MDOC_Inset */
79 ARGV_MULTI, /* MDOC_Column */
80 ARGV_SINGLE, /* MDOC_Width */
81 ARGV_NONE, /* MDOC_Compact */
82 ARGV_OPT_SINGLE, /* MDOC_Std */
83 ARGV_NONE, /* MDOC_Filled */
84 ARGV_NONE, /* MDOC_Words */
85 ARGV_NONE, /* MDOC_Emphasis */
86 ARGV_NONE, /* MDOC_Symbolic */
87 ARGV_NONE /* MDOC_Symbolic */
88 };
89
90 static int mdoc_argflags[MDOC_MAX] = {
91 0, /* Ap */
92 0, /* Dd */
93 0, /* Dt */
94 0, /* Os */
95 0, /* Sh */
96 0, /* Ss */
97 ARGS_DELIM, /* Pp */
98 ARGS_DELIM, /* D1 */
99 ARGS_DELIM, /* Dl */
100 0, /* Bd */
101 0, /* Ed */
102 0, /* Bl */
103 0, /* El */
104 0, /* It */
105 ARGS_DELIM, /* Ad */
106 ARGS_DELIM, /* An */
107 ARGS_DELIM, /* Ar */
108 0, /* Cd */
109 ARGS_DELIM, /* Cm */
110 ARGS_DELIM, /* Dv */
111 ARGS_DELIM, /* Er */
112 ARGS_DELIM, /* Ev */
113 0, /* Ex */
114 ARGS_DELIM, /* Fa */
115 0, /* Fd */
116 ARGS_DELIM, /* Fl */
117 ARGS_DELIM, /* Fn */
118 ARGS_DELIM, /* Ft */
119 ARGS_DELIM, /* Ic */
120 0, /* In */
121 ARGS_DELIM, /* Li */
122 0, /* Nd */
123 ARGS_DELIM, /* Nm */
124 ARGS_DELIM, /* Op */
125 0, /* Ot */
126 ARGS_DELIM, /* Pa */
127 0, /* Rv */
128 ARGS_DELIM, /* St */
129 ARGS_DELIM, /* Va */
130 ARGS_DELIM, /* Vt */
131 ARGS_DELIM, /* Xr */
132 0, /* %A */
133 0, /* %B */
134 0, /* %D */
135 0, /* %I */
136 0, /* %J */
137 0, /* %N */
138 0, /* %O */
139 0, /* %P */
140 0, /* %R */
141 0, /* %T */
142 0, /* %V */
143 ARGS_DELIM, /* Ac */
144 0, /* Ao */
145 ARGS_DELIM, /* Aq */
146 ARGS_DELIM, /* At */
147 ARGS_DELIM, /* Bc */
148 0, /* Bf */
149 0, /* Bo */
150 ARGS_DELIM, /* Bq */
151 ARGS_DELIM, /* Bsx */
152 ARGS_DELIM, /* Bx */
153 0, /* Db */
154 ARGS_DELIM, /* Dc */
155 0, /* Do */
156 ARGS_DELIM, /* Dq */
157 ARGS_DELIM, /* Ec */
158 0, /* Ef */
159 ARGS_DELIM, /* Em */
160 0, /* Eo */
161 ARGS_DELIM, /* Fx */
162 ARGS_DELIM, /* Ms */
163 ARGS_DELIM, /* No */
164 ARGS_DELIM, /* Ns */
165 ARGS_DELIM, /* Nx */
166 ARGS_DELIM, /* Ox */
167 ARGS_DELIM, /* Pc */
168 ARGS_DELIM, /* Pf */
169 0, /* Po */
170 ARGS_DELIM, /* Pq */
171 ARGS_DELIM, /* Qc */
172 ARGS_DELIM, /* Ql */
173 0, /* Qo */
174 ARGS_DELIM, /* Qq */
175 0, /* Re */
176 0, /* Rs */
177 ARGS_DELIM, /* Sc */
178 0, /* So */
179 ARGS_DELIM, /* Sq */
180 0, /* Sm */
181 ARGS_DELIM, /* Sx */
182 ARGS_DELIM, /* Sy */
183 ARGS_DELIM, /* Tn */
184 ARGS_DELIM, /* Ux */
185 ARGS_DELIM, /* Xc */
186 0, /* Xo */
187 0, /* Fo */
188 0, /* Fc */
189 0, /* Oo */
190 ARGS_DELIM, /* Oc */
191 0, /* Bk */
192 0, /* Ek */
193 0, /* Bt */
194 0, /* Hf */
195 0, /* Fr */
196 0, /* Ud */
197 0, /* Lb */
198 ARGS_DELIM, /* Lp */
199 ARGS_DELIM, /* Lk */
200 ARGS_DELIM, /* Mt */
201 ARGS_DELIM, /* Brq */
202 0, /* Bro */
203 ARGS_DELIM, /* Brc */
204 0, /* %C */
205 0, /* Es */
206 0, /* En */
207 0, /* Dx */
208 0, /* %Q */
209 0, /* br */
210 0, /* sp */
211 };
212
213
214 /*
215 * Parse an argument from line text. This comes in the form of -key
216 * [value0...], which may either have a single mandatory value, at least
217 * one mandatory value, an optional single value, or no value.
218 */
219 int
220 mdoc_argv(struct mdoc *m, int line, int tok,
221 struct mdoc_arg **v, int *pos, char *buf)
222 {
223 char *p, sv;
224 struct mdoc_argv tmp;
225 struct mdoc_arg *arg;
226
227 if (0 == buf[*pos])
228 return(ARGV_EOLN);
229
230 assert(' ' != buf[*pos]);
231
232 /* Parse through to the first unescaped space. */
233
234 p = &buf[++(*pos)];
235
236 assert(*pos > 0);
237
238 /* LINTED */
239 while (buf[*pos]) {
240 if (' ' == buf[*pos])
241 if ('\\' != buf[*pos - 1])
242 break;
243 (*pos)++;
244 }
245
246 /* XXX - save zeroed byte, if not an argument. */
247
248 sv = 0;
249 if (buf[*pos]) {
250 sv = buf[*pos];
251 buf[(*pos)++] = 0;
252 }
253
254 (void)memset(&tmp, 0, sizeof(struct mdoc_argv));
255 tmp.line = line;
256 tmp.pos = *pos;
257
258 /* See if our token accepts the argument. */
259
260 if (MDOC_ARG_MAX == (tmp.arg = argv_a2arg(tok, p))) {
261 /* XXX - restore saved zeroed byte. */
262 if (sv)
263 buf[*pos - 1] = sv;
264 return(ARGV_WORD);
265 }
266
267 while (buf[*pos] && ' ' == buf[*pos])
268 (*pos)++;
269
270 if ( ! argv(m, line, &tmp, pos, buf))
271 return(ARGV_ERROR);
272
273 if (NULL == (arg = *v)) {
274 *v = calloc(1, sizeof(struct mdoc_arg));
275 if (NULL == *v) {
276 (void)mdoc_nerr(m, m->last, EMALLOC);
277 return(ARGV_ERROR);
278 }
279 arg = *v;
280 }
281
282 arg->argc++;
283 arg->argv = realloc(arg->argv, arg->argc *
284 sizeof(struct mdoc_argv));
285
286 if (NULL == arg->argv) {
287 (void)mdoc_nerr(m, m->last, EMALLOC);
288 return(ARGV_ERROR);
289 }
290
291 (void)memcpy(&arg->argv[(int)arg->argc - 1],
292 &tmp, sizeof(struct mdoc_argv));
293
294 return(ARGV_ARG);
295 }
296
297
298 void
299 mdoc_argv_free(struct mdoc_arg *p)
300 {
301 int i, j;
302
303 if (NULL == p)
304 return;
305
306 if (p->refcnt) {
307 --(p->refcnt);
308 if (p->refcnt)
309 return;
310 }
311 assert(p->argc);
312
313 /* LINTED */
314 for (i = 0; i < (int)p->argc; i++) {
315 if (0 == p->argv[i].sz)
316 continue;
317 /* LINTED */
318 for (j = 0; j < (int)p->argv[i].sz; j++)
319 free(p->argv[i].value[j]);
320
321 free(p->argv[i].value);
322 }
323
324 free(p->argv);
325 free(p);
326 }
327
328
329 int
330 mdoc_args(struct mdoc *m, int line,
331 int *pos, char *buf, int tok, char **v)
332 {
333 int fl, c, i;
334 struct mdoc_node *n;
335
336 fl = (0 == tok) ? 0 : mdoc_argflags[tok];
337
338 if (MDOC_It != tok)
339 return(args(m, line, pos, buf, fl, v));
340
341 /*
342 * The `It' macro is a special case, as it acquires parameters from its
343 * parent `Bl' context, specifically, we're concerned with -column.
344 */
345
346 for (n = m->last; n; n = n->parent)
347 if (MDOC_BLOCK == n->type && MDOC_Bl == n->tok)
348 break;
349
350 assert(n);
351 c = (int)(n->args ? n->args->argc : 0);
352 assert(c > 0);
353
354 /* LINTED */
355 for (i = 0; i < c; i++) {
356 if (MDOC_Column != n->args->argv[i].arg)
357 continue;
358 fl |= ARGS_TABSEP;
359 fl &= ~ARGS_DELIM;
360 break;
361 }
362
363 return(args(m, line, pos, buf, fl, v));
364 }
365
366
367 static int
368 args(struct mdoc *m, int line, int *pos,
369 char *buf, int fl, char **v)
370 {
371 int i;
372 char *p, *pp;
373
374 assert(*pos);
375 assert(' ' != buf[*pos]);
376
377 if (0 == buf[*pos])
378 return(ARGS_EOLN);
379
380 /*
381 * If the first character is a delimiter and we're to look for
382 * delimited strings, then pass down the buffer seeing if it
383 * follows the pattern of [[::delim::][ ]+]+.
384 */
385
386 if ((fl & ARGS_DELIM) && mdoc_iscdelim(buf[*pos])) {
387 for (i = *pos; buf[i]; ) {
388 if ( ! mdoc_iscdelim(buf[i]))
389 break;
390 i++;
391 if (0 == buf[i] || ' ' != buf[i])
392 break;
393 i++;
394 while (buf[i] && ' ' == buf[i])
395 i++;
396 }
397
398 /* FIXME: warn about trailing whitespace. */
399
400 if (0 == buf[i]) {
401 *v = &buf[*pos];
402 return(ARGS_PUNCT);
403 }
404 }
405
406 *v = &buf[*pos];
407
408 /*
409 * First handle TABSEP items, restricted to `Bl -column'. This
410 * ignores conventional token parsing and instead uses tabs or
411 * `Ta' macros to separate phrases. Phrases are parsed again
412 * for arguments at a later phase.
413 */
414
415 if (ARGS_TABSEP & fl) {
416 /* Scan ahead to unescaped tab. */
417 p = strchr(*v, '\t');
418
419 /* Scan ahead to unescaped `Ta'. */
420 for (pp = *v; ; pp++) {
421 if (NULL == (pp = strstr(pp, "Ta")))
422 break;
423 if (pp > *v && ' ' != *(pp - 1))
424 continue;
425 if (' ' == *(pp + 2) || 0 == *(pp + 2))
426 break;
427 }
428
429 /* Choose delimiter tab/Ta. */
430 if (p && pp)
431 p = (p < pp ? p : pp);
432 else if ( ! p && pp)
433 p = pp;
434
435 /* Strip delimiter's preceding whitespace. */
436 /* FIXME: escaped whitespace? */
437 if (p && p > *v) {
438 pp = p - 1;
439 while (pp > *v && ' ' == *pp)
440 pp--;
441 if (pp == *v && ' ' == *pp)
442 *pp = 0;
443 else if (' ' == *pp)
444 *(pp + 1) = 0;
445 }
446
447 /* ...in- and proceding whitespace. */
448 if (p && ('\t' != *p)) {
449 *p++ = 0;
450 *p++ = 0;
451 } else if (p)
452 *p++ = 0;
453
454 if (p) {
455 while (' ' == *p)
456 p++;
457 if (0 != *p)
458 *(p - 1) = 0;
459 *pos += (int)(p - *v);
460 }
461
462 /* Some warnings, if applicable. */
463 if (p && 0 == *p)
464 if ( ! mdoc_pwarn(m, line, *pos, ECOLEMPTY))
465 return(ARGS_ERROR);
466 if (p && 0 == *p && p > *v && ' ' == *(p - 1))
467 if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
468 return(ARGS_ERROR);
469
470 /* Non-eoln case returns now. */
471 if (p)
472 return(ARGS_PHRASE);
473
474 /* Configure the eoln case, too. */
475 p = strchr(*v, 0);
476 assert(p);
477
478 if (p > *v && ' ' == *(p - 1))
479 if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
480 return(ARGS_ERROR);
481 *pos += (int)(p - *v);
482
483 return(ARGS_PHRASE);
484 }
485
486 /*
487 * Process a quoted literal. A quote begins with a double-quote
488 * and ends with a double-quote NOT preceded by a double-quote.
489 * Whitespace is NOT involved in literal termination.
490 */
491
492 if ('\"' == buf[*pos]) {
493 *v = &buf[++(*pos)];
494
495 for ( ; buf[*pos]; (*pos)++) {
496 if ('\"' != buf[*pos])
497 continue;
498 if ('\"' != buf[*pos + 1])
499 break;
500 (*pos)++;
501 }
502
503 if (0 == buf[*pos]) {
504 if ( ! mdoc_pwarn(m, line, *pos, EQUOTTERM))
505 return(ARGS_ERROR);
506 return(ARGS_QWORD);
507 }
508
509 buf[(*pos)++] = 0;
510
511 if (0 == buf[*pos])
512 return(ARGS_QWORD);
513
514 while (' ' == buf[*pos])
515 (*pos)++;
516
517 if (0 == buf[*pos])
518 if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
519 return(ARGS_ERROR);
520
521 return(ARGS_QWORD);
522 }
523
524 /*
525 * A non-quoted term progresses until either the end of line or
526 * a non-escaped whitespace.
527 */
528
529 for ( ; buf[*pos]; (*pos)++)
530 if (' ' == buf[*pos] && '\\' != buf[*pos - 1])
531 break;
532
533 if (0 == buf[*pos])
534 return(ARGS_WORD);
535
536 buf[(*pos)++] = 0;
537
538 while (' ' == buf[*pos])
539 (*pos)++;
540
541 if (0 == buf[*pos])
542 if ( ! mdoc_pwarn(m, line, *pos, ETAILWS))
543 return(ARGS_ERROR);
544
545 return(ARGS_WORD);
546 }
547
548
549 static int
550 argv_a2arg(int tok, const char *argv)
551 {
552
553 /*
554 * Parse an argument identifier from its text. XXX - this
555 * should really be table-driven to clarify the code.
556 *
557 * If you add an argument to the list, make sure that you
558 * register it here with its one or more macros!
559 */
560
561 switch (tok) {
562 case (MDOC_An):
563 if (0 == strcmp(argv, "split"))
564 return(MDOC_Split);
565 else if (0 == strcmp(argv, "nosplit"))
566 return(MDOC_Nosplit);
567 break;
568
569 case (MDOC_Bd):
570 if (0 == strcmp(argv, "ragged"))
571 return(MDOC_Ragged);
572 else if (0 == strcmp(argv, "unfilled"))
573 return(MDOC_Unfilled);
574 else if (0 == strcmp(argv, "filled"))
575 return(MDOC_Filled);
576 else if (0 == strcmp(argv, "literal"))
577 return(MDOC_Literal);
578 else if (0 == strcmp(argv, "file"))
579 return(MDOC_File);
580 else if (0 == strcmp(argv, "offset"))
581 return(MDOC_Offset);
582 else if (0 == strcmp(argv, "compact"))
583 return(MDOC_Compact);
584 break;
585
586 case (MDOC_Bf):
587 if (0 == strcmp(argv, "emphasis"))
588 return(MDOC_Emphasis);
589 else if (0 == strcmp(argv, "literal"))
590 return(MDOC_Literal);
591 else if (0 == strcmp(argv, "symbolic"))
592 return(MDOC_Symbolic);
593 break;
594
595 case (MDOC_Bk):
596 if (0 == strcmp(argv, "words"))
597 return(MDOC_Words);
598 break;
599
600 case (MDOC_Bl):
601 if (0 == strcmp(argv, "bullet"))
602 return(MDOC_Bullet);
603 else if (0 == strcmp(argv, "dash"))
604 return(MDOC_Dash);
605 else if (0 == strcmp(argv, "hyphen"))
606 return(MDOC_Hyphen);
607 else if (0 == strcmp(argv, "item"))
608 return(MDOC_Item);
609 else if (0 == strcmp(argv, "enum"))
610 return(MDOC_Enum);
611 else if (0 == strcmp(argv, "tag"))
612 return(MDOC_Tag);
613 else if (0 == strcmp(argv, "diag"))
614 return(MDOC_Diag);
615 else if (0 == strcmp(argv, "hang"))
616 return(MDOC_Hang);
617 else if (0 == strcmp(argv, "ohang"))
618 return(MDOC_Ohang);
619 else if (0 == strcmp(argv, "inset"))
620 return(MDOC_Inset);
621 else if (0 == strcmp(argv, "column"))
622 return(MDOC_Column);
623 else if (0 == strcmp(argv, "width"))
624 return(MDOC_Width);
625 else if (0 == strcmp(argv, "offset"))
626 return(MDOC_Offset);
627 else if (0 == strcmp(argv, "compact"))
628 return(MDOC_Compact);
629 else if (0 == strcmp(argv, "nested"))
630 return(MDOC_Nested);
631 break;
632
633 case (MDOC_Rv):
634 /* FALLTHROUGH */
635 case (MDOC_Ex):
636 if (0 == strcmp(argv, "std"))
637 return(MDOC_Std);
638 break;
639 default:
640 break;
641 }
642
643 return(MDOC_ARG_MAX);
644 }
645
646
647 static int
648 argv_multi(struct mdoc *m, int line,
649 struct mdoc_argv *v, int *pos, char *buf)
650 {
651 int c;
652 char *p;
653
654 for (v->sz = 0; ; v->sz++) {
655 if ('-' == buf[*pos])
656 break;
657 c = args(m, line, pos, buf, 0, &p);
658 if (ARGS_ERROR == c)
659 return(0);
660 else if (ARGS_EOLN == c)
661 break;
662
663 if (0 == v->sz % MULTI_STEP) {
664 v->value = realloc(v->value,
665 (v->sz + MULTI_STEP) * sizeof(char *));
666 if (NULL == v->value) {
667 (void)mdoc_nerr(m, m->last, EMALLOC);
668 return(ARGV_ERROR);
669 }
670 }
671 if (NULL == (v->value[(int)v->sz] = strdup(p)))
672 return(mdoc_nerr(m, m->last, EMALLOC));
673 }
674
675 return(1);
676 }
677
678
679 static int
680 argv_opt_single(struct mdoc *m, int line,
681 struct mdoc_argv *v, int *pos, char *buf)
682 {
683 int c;
684 char *p;
685
686 if ('-' == buf[*pos])
687 return(1);
688
689 c = args(m, line, pos, buf, 0, &p);
690 if (ARGS_ERROR == c)
691 return(0);
692 if (ARGS_EOLN == c)
693 return(1);
694
695 v->sz = 1;
696 if (NULL == (v->value = calloc(1, sizeof(char *))))
697 return(mdoc_nerr(m, m->last, EMALLOC));
698 if (NULL == (v->value[0] = strdup(p)))
699 return(mdoc_nerr(m, m->last, EMALLOC));
700
701 return(1);
702 }
703
704
705 /*
706 * Parse a single, mandatory value from the stream.
707 */
708 static int
709 argv_single(struct mdoc *m, int line,
710 struct mdoc_argv *v, int *pos, char *buf)
711 {
712 int c, ppos;
713 char *p;
714
715 ppos = *pos;
716
717 c = args(m, line, pos, buf, 0, &p);
718 if (ARGS_ERROR == c)
719 return(0);
720 if (ARGS_EOLN == c)
721 return(mdoc_perr(m, line, ppos, EARGVAL));
722
723 v->sz = 1;
724 if (NULL == (v->value = calloc(1, sizeof(char *))))
725 return(mdoc_nerr(m, m->last, EMALLOC));
726 if (NULL == (v->value[0] = strdup(p)))
727 return(mdoc_nerr(m, m->last, EMALLOC));
728
729 return(1);
730 }
731
732
733 /*
734 * Determine rules for parsing arguments. Arguments can either accept
735 * no parameters, an optional single parameter, one parameter, or
736 * multiple parameters.
737 */
738 static int
739 argv(struct mdoc *mdoc, int line,
740 struct mdoc_argv *v, int *pos, char *buf)
741 {
742
743 v->sz = 0;
744 v->value = NULL;
745
746 switch (mdoc_argvflags[v->arg]) {
747 case (ARGV_SINGLE):
748 return(argv_single(mdoc, line, v, pos, buf));
749 case (ARGV_MULTI):
750 return(argv_multi(mdoc, line, v, pos, buf));
751 case (ARGV_OPT_SINGLE):
752 return(argv_opt_single(mdoc, line, v, pos, buf));
753 default:
754 /* ARGV_NONE */
755 break;
756 }
757
758 return(1);
759 }