Annotation of mandoc/mdoc_validate.c, Revision 1.33
1.33 ! kristaps 1: /* $Id: mdoc_validate.c,v 1.32 2009/07/13 07:23:07 kristaps Exp $ */
1.1 kristaps 2: /*
1.7 kristaps 3: * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
1.1 kristaps 4: *
5: * Permission to use, copy, modify, and distribute this software for any
1.5 kristaps 6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
1.1 kristaps 8: *
1.5 kristaps 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.
1.1 kristaps 16: */
17: #include <sys/types.h>
18:
19: #include <assert.h>
20: #include <ctype.h>
21: #include <stdarg.h>
22: #include <stdlib.h>
1.2 kristaps 23: #include <string.h>
1.1 kristaps 24:
25: #include "libmdoc.h"
1.18 kristaps 26: #include "libmandoc.h"
1.1 kristaps 27:
28: /* FIXME: .Bl -diag can't have non-text children in HEAD. */
29: /* TODO: ignoring Pp (it's superfluous in some invocations). */
30:
1.32 kristaps 31: #define PRE_ARGS struct mdoc *mdoc, const struct mdoc_node *n
32: #define POST_ARGS struct mdoc *mdoc
1.1 kristaps 33:
34: typedef int (*v_pre)(PRE_ARGS);
35: typedef int (*v_post)(POST_ARGS);
36:
37: struct valids {
38: v_pre *pre;
39: v_post *post;
40: };
41:
1.32 kristaps 42: static int check_parent(PRE_ARGS, int, enum mdoc_type);
43: static int check_msec(PRE_ARGS, ...);
44: static int check_sec(PRE_ARGS, ...);
45: static int check_stdarg(PRE_ARGS);
46: static int check_text(struct mdoc *, int, int, const char *);
47: static int check_argv(struct mdoc *,
1.1 kristaps 48: const struct mdoc_node *,
49: const struct mdoc_argv *);
1.32 kristaps 50: static int check_args(struct mdoc *,
1.1 kristaps 51: const struct mdoc_node *);
1.32 kristaps 52: static int err_child_lt(struct mdoc *, const char *, int);
53: static int warn_child_lt(struct mdoc *, const char *, int);
54: static int err_child_gt(struct mdoc *, const char *, int);
55: static int warn_child_gt(struct mdoc *, const char *, int);
56: static int err_child_eq(struct mdoc *, const char *, int);
57: static int warn_child_eq(struct mdoc *, const char *, int);
58: static int warn_print(struct mdoc *, int, int);
59: static int warn_count(struct mdoc *, const char *,
1.1 kristaps 60: int, const char *, int);
1.32 kristaps 61: static int err_count(struct mdoc *, const char *,
1.1 kristaps 62: int, const char *, int);
1.32 kristaps 63:
64: #ifdef __linux__
65: extern size_t strlcat(char *, const char *, size_t);
66: #endif
67:
68: static int berr_ge1(POST_ARGS);
69: static int bwarn_ge1(POST_ARGS);
70: static int ebool(POST_ARGS);
71: static int eerr_eq0(POST_ARGS);
72: static int eerr_eq1(POST_ARGS);
73: static int eerr_ge1(POST_ARGS);
74: static int eerr_le2(POST_ARGS);
75: static int ewarn_eq0(POST_ARGS);
76: static int ewarn_ge1(POST_ARGS);
77: static int herr_eq0(POST_ARGS);
78: static int herr_ge1(POST_ARGS);
79: static int hwarn_eq1(POST_ARGS);
80: static int hwarn_le1(POST_ARGS);
81:
82: static int post_an(POST_ARGS);
83: static int post_args(POST_ARGS);
84: static int post_at(POST_ARGS);
85: static int post_bf(POST_ARGS);
86: static int post_bl(POST_ARGS);
87: static int post_bl_head(POST_ARGS);
88: static int post_it(POST_ARGS);
89: static int post_lb(POST_ARGS);
90: static int post_nm(POST_ARGS);
91: static int post_root(POST_ARGS);
92: static int post_sh(POST_ARGS);
93: static int post_sh_body(POST_ARGS);
94: static int post_sh_head(POST_ARGS);
95: static int post_st(POST_ARGS);
96: static int pre_an(PRE_ARGS);
97: static int pre_bd(PRE_ARGS);
98: static int pre_bl(PRE_ARGS);
99: static int pre_cd(PRE_ARGS);
100: static int pre_dd(PRE_ARGS);
101: static int pre_display(PRE_ARGS);
102: static int pre_dt(PRE_ARGS);
103: static int pre_er(PRE_ARGS);
104: static int pre_ex(PRE_ARGS);
105: static int pre_fd(PRE_ARGS);
106: static int pre_it(PRE_ARGS);
107: static int pre_lb(PRE_ARGS);
108: static int pre_os(PRE_ARGS);
109: static int pre_rv(PRE_ARGS);
110: static int pre_sh(PRE_ARGS);
111: static int pre_ss(PRE_ARGS);
112:
113: static v_post posts_an[] = { post_an, NULL };
114: static v_post posts_at[] = { post_at, NULL };
115: static v_post posts_bd[] = { herr_eq0, bwarn_ge1, NULL };
116: static v_post posts_bf[] = { hwarn_le1, post_bf, NULL };
117: static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL };
118: static v_post posts_bool[] = { eerr_eq1, ebool, NULL };
119: static v_post posts_ex[] = { eerr_eq0, post_args, NULL };
120: static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL };
121: static v_post posts_in[] = { eerr_eq1, NULL };
122: static v_post posts_it[] = { post_it, NULL };
123: static v_post posts_lb[] = { eerr_eq1, post_lb, NULL };
124: static v_post posts_nd[] = { berr_ge1, NULL };
125: static v_post posts_nm[] = { post_nm, NULL };
126: static v_post posts_notext[] = { eerr_eq0, NULL };
127: static v_post posts_pf[] = { eerr_eq1, NULL };
128: static v_post posts_pp[] = { ewarn_eq0, NULL };
129: static v_post posts_rv[] = { eerr_eq0, post_args, NULL };
130: static v_post posts_sh[] = { herr_ge1, bwarn_ge1, post_sh, NULL };
131: static v_post posts_ss[] = { herr_ge1, NULL };
132: static v_post posts_st[] = { eerr_eq1, post_st, NULL };
133: static v_post posts_text[] = { eerr_ge1, NULL };
134: static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL };
135: static v_post posts_wtext[] = { ewarn_ge1, NULL };
136: static v_post posts_xr[] = { eerr_ge1, eerr_le2, NULL };
137: static v_pre pres_an[] = { pre_an, NULL };
138: static v_pre pres_bd[] = { pre_display, pre_bd, NULL };
139: static v_pre pres_bl[] = { pre_bl, NULL };
140: static v_pre pres_cd[] = { pre_cd, NULL };
141: static v_pre pres_d1[] = { pre_display, NULL };
142: static v_pre pres_dd[] = { pre_dd, NULL };
143: static v_pre pres_dt[] = { pre_dt, NULL };
144: static v_pre pres_er[] = { pre_er, NULL };
145: static v_pre pres_ex[] = { pre_ex, NULL };
146: static v_pre pres_fd[] = { pre_fd, NULL };
147: static v_pre pres_it[] = { pre_it, NULL };
148: static v_pre pres_lb[] = { pre_lb, NULL };
149: static v_pre pres_os[] = { pre_os, NULL };
150: static v_pre pres_rv[] = { pre_rv, NULL };
151: static v_pre pres_sh[] = { pre_sh, NULL };
152: static v_pre pres_ss[] = { pre_ss, NULL };
1.1 kristaps 153:
154: const struct valids mdoc_valids[MDOC_MAX] = {
1.10 kristaps 155: { NULL, NULL }, /* Ap */
1.1 kristaps 156: { pres_dd, posts_text }, /* Dd */
157: { pres_dt, NULL }, /* Dt */
158: { pres_os, NULL }, /* Os */
159: { pres_sh, posts_sh }, /* Sh */
160: { pres_ss, posts_ss }, /* Ss */
161: { NULL, posts_pp }, /* Pp */
162: { pres_d1, posts_wline }, /* D1 */
163: { pres_d1, posts_wline }, /* Dl */
164: { pres_bd, posts_bd }, /* Bd */
165: { NULL, NULL }, /* Ed */
166: { pres_bl, posts_bl }, /* Bl */
167: { NULL, NULL }, /* El */
168: { pres_it, posts_it }, /* It */
169: { NULL, posts_text }, /* Ad */
170: { pres_an, posts_an }, /* An */
171: { NULL, NULL }, /* Ar */
172: { pres_cd, posts_text }, /* Cd */
173: { NULL, NULL }, /* Cm */
174: { NULL, NULL }, /* Dv */
175: { pres_er, posts_text }, /* Er */
176: { NULL, NULL }, /* Ev */
177: { pres_ex, posts_ex }, /* Ex */
178: { NULL, NULL }, /* Fa */
179: { pres_fd, posts_wtext }, /* Fd */
180: { NULL, NULL }, /* Fl */
181: { NULL, posts_text }, /* Fn */
182: { NULL, posts_wtext }, /* Ft */
183: { NULL, posts_text }, /* Ic */
184: { NULL, posts_in }, /* In */
185: { NULL, NULL }, /* Li */
1.27 kristaps 186: { NULL, posts_nd }, /* Nd */
1.1 kristaps 187: { NULL, posts_nm }, /* Nm */
188: { NULL, posts_wline }, /* Op */
189: { NULL, NULL }, /* Ot */
190: { NULL, NULL }, /* Pa */
191: { pres_rv, posts_rv }, /* Rv */
192: { NULL, posts_st }, /* St */
193: { NULL, NULL }, /* Va */
194: { NULL, posts_text }, /* Vt */
195: { NULL, posts_xr }, /* Xr */
196: { NULL, posts_text }, /* %A */
197: { NULL, posts_text }, /* %B */
198: { NULL, posts_text }, /* %D */
199: { NULL, posts_text }, /* %I */
200: { NULL, posts_text }, /* %J */
201: { NULL, posts_text }, /* %N */
202: { NULL, posts_text }, /* %O */
203: { NULL, posts_text }, /* %P */
204: { NULL, posts_text }, /* %R */
205: { NULL, posts_text }, /* %T */
206: { NULL, posts_text }, /* %V */
207: { NULL, NULL }, /* Ac */
208: { NULL, NULL }, /* Ao */
209: { NULL, posts_wline }, /* Aq */
210: { NULL, posts_at }, /* At */
211: { NULL, NULL }, /* Bc */
212: { NULL, posts_bf }, /* Bf */
213: { NULL, NULL }, /* Bo */
214: { NULL, posts_wline }, /* Bq */
215: { NULL, NULL }, /* Bsx */
216: { NULL, NULL }, /* Bx */
217: { NULL, posts_bool }, /* Db */
218: { NULL, NULL }, /* Dc */
219: { NULL, NULL }, /* Do */
220: { NULL, posts_wline }, /* Dq */
221: { NULL, NULL }, /* Ec */
222: { NULL, NULL }, /* Ef */
223: { NULL, NULL }, /* Em */
224: { NULL, NULL }, /* Eo */
225: { NULL, NULL }, /* Fx */
226: { NULL, posts_text }, /* Ms */
227: { NULL, posts_notext }, /* No */
228: { NULL, posts_notext }, /* Ns */
229: { NULL, NULL }, /* Nx */
230: { NULL, NULL }, /* Ox */
231: { NULL, NULL }, /* Pc */
232: { NULL, posts_pf }, /* Pf */
233: { NULL, NULL }, /* Po */
234: { NULL, posts_wline }, /* Pq */
235: { NULL, NULL }, /* Qc */
236: { NULL, posts_wline }, /* Ql */
237: { NULL, NULL }, /* Qo */
238: { NULL, posts_wline }, /* Qq */
239: { NULL, NULL }, /* Re */
240: { NULL, posts_wline }, /* Rs */
241: { NULL, NULL }, /* Sc */
242: { NULL, NULL }, /* So */
243: { NULL, posts_wline }, /* Sq */
244: { NULL, posts_bool }, /* Sm */
245: { NULL, posts_text }, /* Sx */
246: { NULL, posts_text }, /* Sy */
247: { NULL, posts_text }, /* Tn */
248: { NULL, NULL }, /* Ux */
249: { NULL, NULL }, /* Xc */
250: { NULL, NULL }, /* Xo */
251: { NULL, posts_fo }, /* Fo */
252: { NULL, NULL }, /* Fc */
253: { NULL, NULL }, /* Oo */
254: { NULL, NULL }, /* Oc */
255: { NULL, posts_wline }, /* Bk */
256: { NULL, NULL }, /* Ek */
257: { NULL, posts_notext }, /* Bt */
258: { NULL, NULL }, /* Hf */
259: { NULL, NULL }, /* Fr */
260: { NULL, posts_notext }, /* Ud */
261: { pres_lb, posts_lb }, /* Lb */
262: { NULL, posts_pp }, /* Lp */
1.9 kristaps 263: { NULL, NULL }, /* Lk */
1.1 kristaps 264: { NULL, posts_text }, /* Mt */
265: { NULL, posts_wline }, /* Brq */
266: { NULL, NULL }, /* Bro */
267: { NULL, NULL }, /* Brc */
268: { NULL, posts_text }, /* %C */
269: { NULL, NULL }, /* Es */
270: { NULL, NULL }, /* En */
271: { NULL, NULL }, /* Dx */
272: { NULL, posts_text }, /* %Q */
1.33 ! kristaps 273: { NULL, posts_notext }, /* br */
! 274: { NULL, NULL }, /* sp */
1.1 kristaps 275: };
276:
277:
278: int
1.32 kristaps 279: mdoc_valid_pre(struct mdoc *mdoc, const struct mdoc_node *n)
1.1 kristaps 280: {
281: v_pre *p;
282: int line, pos;
283: const char *tp;
284:
285: if (MDOC_TEXT == n->type) {
286: tp = n->string;
287: line = n->line;
288: pos = n->pos;
289: return(check_text(mdoc, line, pos, tp));
290: }
291:
292: if ( ! check_args(mdoc, n))
293: return(0);
294: if (NULL == mdoc_valids[n->tok].pre)
295: return(1);
296: for (p = mdoc_valids[n->tok].pre; *p; p++)
297: if ( ! (*p)(mdoc, n))
298: return(0);
299: return(1);
300: }
301:
302:
303: int
304: mdoc_valid_post(struct mdoc *mdoc)
305: {
306: v_post *p;
307:
308: if (MDOC_VALID & mdoc->last->flags)
309: return(1);
310: mdoc->last->flags |= MDOC_VALID;
311:
312: if (MDOC_TEXT == mdoc->last->type)
313: return(1);
314: if (MDOC_ROOT == mdoc->last->type)
315: return(post_root(mdoc));
316:
317: if (NULL == mdoc_valids[mdoc->last->tok].post)
318: return(1);
319: for (p = mdoc_valids[mdoc->last->tok].post; *p; p++)
320: if ( ! (*p)(mdoc))
321: return(0);
322:
323: return(1);
324: }
325:
326:
327: static int
1.4 kristaps 328: warn_print(struct mdoc *m, int ln, int pos)
329: {
1.21 kristaps 330:
1.23 kristaps 331: if (MDOC_IGN_CHARS & m->pflags)
332: return(mdoc_pwarn(m, ln, pos, EPRINT));
333: return(mdoc_perr(m, ln, pos, EPRINT));
1.4 kristaps 334: }
335:
1.1 kristaps 336:
337: static inline int
338: warn_count(struct mdoc *m, const char *k,
339: int want, const char *v, int has)
340: {
341:
1.23 kristaps 342: return(mdoc_vwarn(m, m->last->line, m->last->pos,
343: "suggests %s %s %d (has %d)", v, k, want, has));
1.1 kristaps 344: }
345:
346:
347: static inline int
348: err_count(struct mdoc *m, const char *k,
349: int want, const char *v, int has)
350: {
351:
1.23 kristaps 352: return(mdoc_verr(m, m->last->line, m->last->pos,
1.1 kristaps 353: "requires %s %s %d (has %d)", v, k, want, has));
354: }
355:
356:
357: /*
358: * Build these up with macros because they're basically the same check
359: * for different inequalities. Yes, this could be done with functions,
360: * but this is reasonable for now.
361: */
362:
363: #define CHECK_CHILD_DEFN(lvl, name, ineq) \
364: static int \
365: lvl##_child_##name(struct mdoc *mdoc, const char *p, int sz) \
366: { \
1.16 kristaps 367: if (mdoc->last->nchild ineq sz) \
1.1 kristaps 368: return(1); \
1.16 kristaps 369: return(lvl##_count(mdoc, #ineq, sz, p, mdoc->last->nchild)); \
1.1 kristaps 370: }
371:
372: #define CHECK_BODY_DEFN(name, lvl, func, num) \
373: static int \
374: b##lvl##_##name(POST_ARGS) \
375: { \
376: if (MDOC_BODY != mdoc->last->type) \
377: return(1); \
378: return(func(mdoc, "multi-line arguments", (num))); \
379: }
380:
381: #define CHECK_ELEM_DEFN(name, lvl, func, num) \
382: static int \
383: e##lvl##_##name(POST_ARGS) \
384: { \
385: assert(MDOC_ELEM == mdoc->last->type); \
386: return(func(mdoc, "line arguments", (num))); \
387: }
388:
389: #define CHECK_HEAD_DEFN(name, lvl, func, num) \
390: static int \
391: h##lvl##_##name(POST_ARGS) \
392: { \
393: if (MDOC_HEAD != mdoc->last->type) \
394: return(1); \
395: return(func(mdoc, "line arguments", (num))); \
396: }
397:
398:
399: CHECK_CHILD_DEFN(warn, gt, >) /* warn_child_gt() */
400: CHECK_CHILD_DEFN(err, gt, >) /* err_child_gt() */
401: CHECK_CHILD_DEFN(warn, eq, ==) /* warn_child_eq() */
402: CHECK_CHILD_DEFN(err, eq, ==) /* err_child_eq() */
403: CHECK_CHILD_DEFN(err, lt, <) /* err_child_lt() */
404: CHECK_CHILD_DEFN(warn, lt, <) /* warn_child_lt() */
405: CHECK_BODY_DEFN(ge1, warn, warn_child_gt, 0) /* bwarn_ge1() */
1.27 kristaps 406: CHECK_BODY_DEFN(ge1, err, err_child_gt, 0) /* berr_ge1() */
1.1 kristaps 407: CHECK_ELEM_DEFN(eq0, warn, warn_child_eq, 0) /* ewarn_eq0() */
408: CHECK_ELEM_DEFN(ge1, warn, warn_child_gt, 0) /* ewarn_gt1() */
409: CHECK_ELEM_DEFN(eq1, err, err_child_eq, 1) /* eerr_eq1() */
410: CHECK_ELEM_DEFN(le2, err, err_child_lt, 3) /* eerr_le2() */
411: CHECK_ELEM_DEFN(eq0, err, err_child_eq, 0) /* eerr_eq0() */
412: CHECK_ELEM_DEFN(ge1, err, err_child_gt, 0) /* eerr_ge1() */
413: CHECK_HEAD_DEFN(eq0, err, err_child_eq, 0) /* herr_eq0() */
414: CHECK_HEAD_DEFN(le1, warn, warn_child_lt, 2) /* hwarn_le1() */
415: CHECK_HEAD_DEFN(ge1, err, err_child_gt, 0) /* herr_ge1() */
416: CHECK_HEAD_DEFN(eq1, warn, warn_child_eq, 1) /* hwarn_eq1() */
417:
418:
419: static int
420: check_stdarg(PRE_ARGS)
421: {
422:
423: if (n->args && 1 == n->args->argc)
424: if (MDOC_Std == n->args->argv[0].arg)
425: return(1);
1.23 kristaps 426: return(mdoc_nwarn(mdoc, n, EARGVAL));
1.1 kristaps 427: }
428:
429:
430: static int
431: check_sec(PRE_ARGS, ...)
432: {
433: enum mdoc_sec sec;
434: va_list ap;
435:
436: va_start(ap, n);
437:
438: for (;;) {
439: /* LINTED */
440: sec = (enum mdoc_sec)va_arg(ap, int);
441: if (SEC_CUSTOM == sec)
442: break;
443: if (sec != mdoc->lastsec)
444: continue;
445: va_end(ap);
446: return(1);
447: }
448:
449: va_end(ap);
1.23 kristaps 450: return(mdoc_nwarn(mdoc, n, EBADSEC));
1.1 kristaps 451: }
452:
453:
454: static int
455: check_msec(PRE_ARGS, ...)
456: {
457: va_list ap;
458: int msec;
459:
460: va_start(ap, n);
461: for (;;) {
462: /* LINTED */
463: if (0 == (msec = va_arg(ap, int)))
464: break;
465: if (msec != mdoc->meta.msec)
466: continue;
467: va_end(ap);
468: return(1);
469: }
470:
471: va_end(ap);
1.23 kristaps 472: return(mdoc_nwarn(mdoc, n, EBADMSEC));
1.1 kristaps 473: }
474:
475:
476: static int
477: check_args(struct mdoc *m, const struct mdoc_node *n)
478: {
479: int i;
480:
481: if (NULL == n->args)
482: return(1);
483:
484: assert(n->args->argc);
485: for (i = 0; i < (int)n->args->argc; i++)
486: if ( ! check_argv(m, n, &n->args->argv[i]))
487: return(0);
488:
489: return(1);
490: }
491:
492:
493: static int
494: check_argv(struct mdoc *m, const struct mdoc_node *n,
495: const struct mdoc_argv *v)
496: {
497: int i;
498:
499: for (i = 0; i < (int)v->sz; i++)
500: if ( ! check_text(m, v->line, v->pos, v->value[i]))
501: return(0);
502:
503: if (MDOC_Std == v->arg) {
504: /* `Nm' name must be set. */
505: if (v->sz || m->meta.name)
506: return(1);
1.23 kristaps 507: return(mdoc_nerr(m, n, ENAME));
1.1 kristaps 508: }
509:
510: return(1);
511: }
512:
513:
514: static int
515: check_text(struct mdoc *mdoc, int line, int pos, const char *p)
516: {
1.18 kristaps 517: int c;
1.1 kristaps 518:
1.18 kristaps 519: for ( ; *p; p++, pos++) {
1.1 kristaps 520: if ('\t' == *p) {
521: if ( ! (MDOC_LITERAL & mdoc->flags))
1.4 kristaps 522: if ( ! warn_print(mdoc, line, pos))
523: return(0);
1.1 kristaps 524: } else if ( ! isprint((u_char)*p))
1.4 kristaps 525: if ( ! warn_print(mdoc, line, pos))
526: return(0);
1.1 kristaps 527:
528: if ('\\' != *p)
529: continue;
530:
1.18 kristaps 531: c = mandoc_special(p);
1.1 kristaps 532: if (c) {
1.18 kristaps 533: p += c - 1;
534: pos += c - 1;
1.1 kristaps 535: continue;
536: }
537: if ( ! (MDOC_IGN_ESCAPE & mdoc->pflags))
1.23 kristaps 538: return(mdoc_perr(mdoc, line, pos, EESCAPE));
1.32 kristaps 539: if ( ! mdoc_pwarn(mdoc, line, pos, EESCAPE))
1.1 kristaps 540: return(0);
541: }
542:
543: return(1);
544: }
545:
546:
547:
548:
549: static int
550: check_parent(PRE_ARGS, int tok, enum mdoc_type t)
551: {
552:
553: assert(n->parent);
554: if ((MDOC_ROOT == t || tok == n->parent->tok) &&
555: (t == n->parent->type))
556: return(1);
557:
1.23 kristaps 558: return(mdoc_verr(mdoc, n->line, n->pos, "require parent %s",
1.1 kristaps 559: MDOC_ROOT == t ? "<root>" : mdoc_macronames[tok]));
560: }
561:
562:
563:
564: static int
565: pre_display(PRE_ARGS)
566: {
567: struct mdoc_node *node;
568:
569: /* Display elements (`Bd', `D1'...) cannot be nested. */
570:
571: if (MDOC_BLOCK != n->type)
572: return(1);
573:
574: /* LINTED */
575: for (node = mdoc->last->parent; node; node = node->parent)
576: if (MDOC_BLOCK == node->type)
577: if (MDOC_Bd == node->tok)
578: break;
579: if (NULL == node)
580: return(1);
581:
1.23 kristaps 582: return(mdoc_nerr(mdoc, n, ENESTDISP));
1.1 kristaps 583: }
584:
585:
586: static int
587: pre_bl(PRE_ARGS)
588: {
1.15 kristaps 589: int pos, type, width, offset;
1.1 kristaps 590:
591: if (MDOC_BLOCK != n->type)
592: return(1);
593: if (NULL == n->args)
1.23 kristaps 594: return(mdoc_nerr(mdoc, n, ELISTTYPE));
1.1 kristaps 595:
596: /* Make sure that only one type of list is specified. */
597:
1.15 kristaps 598: type = offset = width = -1;
1.1 kristaps 599:
600: /* LINTED */
1.8 kristaps 601: for (pos = 0; pos < (int)n->args->argc; pos++)
602: switch (n->args->argv[pos].arg) {
1.1 kristaps 603: case (MDOC_Bullet):
604: /* FALLTHROUGH */
605: case (MDOC_Dash):
606: /* FALLTHROUGH */
607: case (MDOC_Enum):
608: /* FALLTHROUGH */
609: case (MDOC_Hyphen):
610: /* FALLTHROUGH */
611: case (MDOC_Item):
612: /* FALLTHROUGH */
613: case (MDOC_Tag):
614: /* FALLTHROUGH */
615: case (MDOC_Diag):
616: /* FALLTHROUGH */
617: case (MDOC_Hang):
618: /* FALLTHROUGH */
619: case (MDOC_Ohang):
620: /* FALLTHROUGH */
621: case (MDOC_Inset):
622: /* FALLTHROUGH */
623: case (MDOC_Column):
1.8 kristaps 624: if (-1 != type)
1.23 kristaps 625: return(mdoc_nerr(mdoc, n, EMULTILIST));
1.8 kristaps 626: type = n->args->argv[pos].arg;
627: break;
1.1 kristaps 628: case (MDOC_Width):
1.8 kristaps 629: if (-1 != width)
1.23 kristaps 630: return(mdoc_nerr(mdoc, n, EARGREP));
1.8 kristaps 631: width = n->args->argv[pos].arg;
632: break;
1.1 kristaps 633: case (MDOC_Offset):
1.8 kristaps 634: if (-1 != offset)
1.23 kristaps 635: return(mdoc_nerr(mdoc, n, EARGREP));
1.8 kristaps 636: offset = n->args->argv[pos].arg;
637: break;
1.1 kristaps 638: default:
639: break;
640: }
641:
642: if (-1 == type)
1.23 kristaps 643: return(mdoc_nerr(mdoc, n, ELISTTYPE));
1.1 kristaps 644:
1.8 kristaps 645: /*
646: * Validate the width field. Some list types don't need width
647: * types and should be warned about them. Others should have it
648: * and must also be warned.
649: */
650:
1.1 kristaps 651: switch (type) {
1.8 kristaps 652: case (MDOC_Tag):
1.23 kristaps 653: if (-1 == width && ! mdoc_nwarn(mdoc, n, EMISSWIDTH))
1.8 kristaps 654: return(0);
655: break;
1.1 kristaps 656: case (MDOC_Column):
657: /* FALLTHROUGH */
658: case (MDOC_Diag):
659: /* FALLTHROUGH */
660: case (MDOC_Inset):
661: /* FALLTHROUGH */
662: case (MDOC_Item):
1.23 kristaps 663: if (-1 != width && ! mdoc_nwarn(mdoc, n, ENOWIDTH))
1.8 kristaps 664: return(0);
665: break;
666: default:
667: break;
668: }
669:
1.1 kristaps 670: return(1);
671: }
672:
673:
674: static int
675: pre_bd(PRE_ARGS)
676: {
677: int i, type, err;
678:
679: if (MDOC_BLOCK != n->type)
680: return(1);
681: if (NULL == n->args)
1.23 kristaps 682: return(mdoc_nerr(mdoc, n, EDISPTYPE));
1.1 kristaps 683:
684: /* Make sure that only one type of display is specified. */
685:
686: /* LINTED */
687: for (i = 0, err = type = 0; ! err &&
688: i < (int)n->args->argc; i++)
689: switch (n->args->argv[i].arg) {
690: case (MDOC_Ragged):
691: /* FALLTHROUGH */
692: case (MDOC_Unfilled):
693: /* FALLTHROUGH */
694: case (MDOC_Filled):
695: /* FALLTHROUGH */
696: case (MDOC_Literal):
697: /* FALLTHROUGH */
698: case (MDOC_File):
699: if (0 == type++)
700: break;
1.23 kristaps 701: return(mdoc_nerr(mdoc, n, EMULTIDISP));
1.1 kristaps 702: default:
703: break;
704: }
705:
706: if (type)
707: return(1);
1.23 kristaps 708: return(mdoc_nerr(mdoc, n, EDISPTYPE));
1.1 kristaps 709: }
710:
711:
712: static int
713: pre_ss(PRE_ARGS)
714: {
715:
716: if (MDOC_BLOCK != n->type)
717: return(1);
718: return(check_parent(mdoc, n, MDOC_Sh, MDOC_BODY));
719: }
720:
721:
722: static int
723: pre_sh(PRE_ARGS)
724: {
725:
726: if (MDOC_BLOCK != n->type)
727: return(1);
728: return(check_parent(mdoc, n, -1, MDOC_ROOT));
729: }
730:
731:
732: static int
733: pre_it(PRE_ARGS)
734: {
735:
736: if (MDOC_BLOCK != n->type)
737: return(1);
738: return(check_parent(mdoc, n, MDOC_Bl, MDOC_BODY));
739: }
740:
741:
742: static int
743: pre_an(PRE_ARGS)
744: {
745:
746: if (NULL == n->args || 1 == n->args->argc)
747: return(1);
1.23 kristaps 748: return(mdoc_verr(mdoc, n->line, n->pos,
749: "only one argument allowed"));
1.1 kristaps 750: }
751:
752:
753: static int
754: pre_lb(PRE_ARGS)
755: {
756:
757: return(check_sec(mdoc, n, SEC_LIBRARY, SEC_CUSTOM));
758: }
759:
760:
761: static int
762: pre_rv(PRE_ARGS)
763: {
764:
765: if ( ! check_msec(mdoc, n, 2, 3, 0))
766: return(0);
767: return(check_stdarg(mdoc, n));
768: }
769:
770:
771: static int
772: pre_ex(PRE_ARGS)
773: {
774:
775: if ( ! check_msec(mdoc, n, 1, 6, 8, 0))
776: return(0);
777: return(check_stdarg(mdoc, n));
778: }
779:
780:
781: static int
782: pre_er(PRE_ARGS)
783: {
784:
1.6 kristaps 785: return(check_msec(mdoc, n, 2, 3, 9, 0));
1.1 kristaps 786: }
787:
788:
789: static int
790: pre_cd(PRE_ARGS)
791: {
792:
793: return(check_msec(mdoc, n, 4, 0));
794: }
795:
796:
797: static int
798: pre_dt(PRE_ARGS)
799: {
800:
801: if (0 == mdoc->meta.date || mdoc->meta.os)
1.23 kristaps 802: if ( ! mdoc_nwarn(mdoc, n, EPROLOOO))
1.1 kristaps 803: return(0);
804: if (mdoc->meta.title)
1.23 kristaps 805: if ( ! mdoc_nwarn(mdoc, n, EPROLREP))
1.1 kristaps 806: return(0);
807: return(1);
808: }
809:
810:
811: static int
812: pre_os(PRE_ARGS)
813: {
814:
815: if (NULL == mdoc->meta.title || 0 == mdoc->meta.date)
1.23 kristaps 816: if ( ! mdoc_nwarn(mdoc, n, EPROLOOO))
1.1 kristaps 817: return(0);
818: if (mdoc->meta.os)
1.23 kristaps 819: if ( ! mdoc_nwarn(mdoc, n, EPROLREP))
1.1 kristaps 820: return(0);
821: return(1);
822: }
823:
824:
825: static int
826: pre_dd(PRE_ARGS)
827: {
828:
829: if (mdoc->meta.title || mdoc->meta.os)
1.23 kristaps 830: if ( ! mdoc_nwarn(mdoc, n, EPROLOOO))
1.1 kristaps 831: return(0);
832: if (mdoc->meta.date)
1.23 kristaps 833: if ( ! mdoc_nwarn(mdoc, n, EPROLREP))
1.1 kristaps 834: return(0);
835: return(1);
836: }
837:
838:
839: static int
840: post_bf(POST_ARGS)
841: {
842: char *p;
843: struct mdoc_node *head;
844:
845: if (MDOC_BLOCK != mdoc->last->type)
846: return(1);
847:
848: head = mdoc->last->head;
849:
1.12 kristaps 850: if (mdoc->last->args && head->child)
1.24 kristaps 851: return(mdoc_nerr(mdoc, mdoc->last, ELINE));
1.13 kristaps 852: else if (mdoc->last->args)
853: return(1);
1.12 kristaps 854:
1.13 kristaps 855: if (NULL == head->child || MDOC_TEXT != head->child->type)
1.24 kristaps 856: return(mdoc_nerr(mdoc, mdoc->last, ELINE));
1.1 kristaps 857:
1.13 kristaps 858: p = head->child->string;
1.1 kristaps 859:
1.13 kristaps 860: if (0 == strcmp(p, "Em"))
861: return(1);
862: else if (0 == strcmp(p, "Li"))
863: return(1);
864: else if (0 == strcmp(p, "Sm"))
865: return(1);
1.1 kristaps 866:
1.23 kristaps 867: return(mdoc_nerr(mdoc, head, EFONT));
1.1 kristaps 868: }
869:
870:
871: static int
1.31 kristaps 872: post_lb(POST_ARGS)
873: {
874:
875: if (mdoc_a2lib(mdoc->last->child->string))
876: return(1);
877: return(mdoc_nwarn(mdoc, mdoc->last, ELIB));
878: }
879:
880:
881: static int
1.1 kristaps 882: post_nm(POST_ARGS)
883: {
884:
885: if (mdoc->last->child)
886: return(1);
887: if (mdoc->meta.name)
888: return(1);
1.23 kristaps 889: return(mdoc_nerr(mdoc, mdoc->last, ENAME));
1.1 kristaps 890: }
891:
892:
893: static int
894: post_at(POST_ARGS)
895: {
896:
897: if (NULL == mdoc->last->child)
898: return(1);
899: if (MDOC_TEXT != mdoc->last->child->type)
1.23 kristaps 900: return(mdoc_nerr(mdoc, mdoc->last, EATT));
1.1 kristaps 901: if (mdoc_a2att(mdoc->last->child->string))
902: return(1);
1.23 kristaps 903: return(mdoc_nerr(mdoc, mdoc->last, EATT));
1.1 kristaps 904: }
905:
906:
907: static int
908: post_an(POST_ARGS)
909: {
910:
911: if (mdoc->last->args) {
912: if (NULL == mdoc->last->child)
913: return(1);
1.23 kristaps 914: return(mdoc_nerr(mdoc, mdoc->last, ELINE));
1.1 kristaps 915: }
916:
917: if (mdoc->last->child)
918: return(1);
1.23 kristaps 919: return(mdoc_nerr(mdoc, mdoc->last, ELINE));
1.1 kristaps 920: }
921:
922:
923: static int
924: post_args(POST_ARGS)
925: {
926:
927: if (mdoc->last->args)
928: return(1);
1.23 kristaps 929: return(mdoc_nerr(mdoc, mdoc->last, ELINE));
1.1 kristaps 930: }
931:
932:
933: static int
934: post_it(POST_ARGS)
935: {
936: int type, i, cols;
937: struct mdoc_node *n, *c;
938:
939: if (MDOC_BLOCK != mdoc->last->type)
940: return(1);
941:
942: n = mdoc->last->parent->parent;
943: if (NULL == n->args)
1.23 kristaps 944: return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE));
1.1 kristaps 945:
946: /* Some types require block-head, some not. */
947:
948: /* LINTED */
949: for (cols = type = -1, i = 0; -1 == type &&
950: i < (int)n->args->argc; i++)
951: switch (n->args->argv[i].arg) {
952: case (MDOC_Tag):
953: /* FALLTHROUGH */
954: case (MDOC_Diag):
955: /* FALLTHROUGH */
956: case (MDOC_Hang):
957: /* FALLTHROUGH */
958: case (MDOC_Ohang):
959: /* FALLTHROUGH */
960: case (MDOC_Inset):
961: /* FALLTHROUGH */
962: case (MDOC_Bullet):
963: /* FALLTHROUGH */
964: case (MDOC_Dash):
965: /* FALLTHROUGH */
966: case (MDOC_Enum):
967: /* FALLTHROUGH */
968: case (MDOC_Hyphen):
969: /* FALLTHROUGH */
970: case (MDOC_Item):
971: type = n->args->argv[i].arg;
972: break;
973: case (MDOC_Column):
974: type = n->args->argv[i].arg;
975: cols = (int)n->args->argv[i].sz;
976: break;
977: default:
978: break;
979: }
980:
981: if (-1 == type)
1.23 kristaps 982: return(mdoc_nerr(mdoc, mdoc->last, ELISTTYPE));
1.1 kristaps 983:
984: switch (type) {
985: case (MDOC_Tag):
986: if (NULL == mdoc->last->head->child)
1.23 kristaps 987: if ( ! mdoc_nwarn(mdoc, mdoc->last, ELINE))
1.1 kristaps 988: return(0);
989: break;
990: case (MDOC_Hang):
991: /* FALLTHROUGH */
992: case (MDOC_Ohang):
993: /* FALLTHROUGH */
994: case (MDOC_Inset):
995: /* FALLTHROUGH */
996: case (MDOC_Diag):
997: if (NULL == mdoc->last->head->child)
1.23 kristaps 998: if ( ! mdoc_nwarn(mdoc, mdoc->last, ELINE))
1.1 kristaps 999: return(0);
1000: if (NULL == mdoc->last->body->child)
1.23 kristaps 1001: if ( ! mdoc_nwarn(mdoc, mdoc->last, EMULTILINE))
1.1 kristaps 1002: return(0);
1003: break;
1004: case (MDOC_Bullet):
1005: /* FALLTHROUGH */
1006: case (MDOC_Dash):
1007: /* FALLTHROUGH */
1008: case (MDOC_Enum):
1009: /* FALLTHROUGH */
1010: case (MDOC_Hyphen):
1011: /* FALLTHROUGH */
1012: case (MDOC_Item):
1013: if (mdoc->last->head->child)
1.23 kristaps 1014: if ( ! mdoc_nwarn(mdoc, mdoc->last, ENOLINE))
1.1 kristaps 1015: return(0);
1016: if (NULL == mdoc->last->body->child)
1.23 kristaps 1017: if ( ! mdoc_nwarn(mdoc, mdoc->last, EMULTILINE))
1.1 kristaps 1018: return(0);
1019: break;
1020: case (MDOC_Column):
1021: if (NULL == mdoc->last->head->child)
1.23 kristaps 1022: if ( ! mdoc_nwarn(mdoc, mdoc->last, ELINE))
1.1 kristaps 1023: return(0);
1024: if (mdoc->last->body->child)
1.23 kristaps 1025: if ( ! mdoc_nwarn(mdoc, mdoc->last, ENOMULTILINE))
1.1 kristaps 1026: return(0);
1027: c = mdoc->last->child;
1028: for (i = 0; c && MDOC_HEAD == c->type; c = c->next)
1029: i++;
1030: if (i == cols)
1031: break;
1.23 kristaps 1032: return(mdoc_verr(mdoc, mdoc->last->line, mdoc->last->pos,
1033: "column mismatch (have %d, want %d)",
1034: i, cols));
1.1 kristaps 1035: default:
1036: break;
1037: }
1038:
1039: return(1);
1040: }
1041:
1042:
1043: static int
1.14 kristaps 1044: post_bl_head(POST_ARGS)
1045: {
1046: int i;
1047: const struct mdoc_node *n;
1048:
1049: n = mdoc->last->parent;
1050: assert(n->args);
1051:
1052: for (i = 0; i < (int)n->args->argc; i++)
1053: if (n->args->argv[i].arg == MDOC_Column)
1054: break;
1055:
1056: if (i == (int)n->args->argc)
1057: return(1);
1058:
1059: if (n->args->argv[i].sz && mdoc->last->child)
1.23 kristaps 1060: return(mdoc_nerr(mdoc, n, ECOLMIS));
1.14 kristaps 1061:
1062: return(1);
1063: }
1064:
1065:
1066: static int
1.1 kristaps 1067: post_bl(POST_ARGS)
1068: {
1069: struct mdoc_node *n;
1070:
1.14 kristaps 1071: if (MDOC_HEAD == mdoc->last->type)
1072: return(post_bl_head(mdoc));
1.1 kristaps 1073: if (MDOC_BODY != mdoc->last->type)
1074: return(1);
1075: if (NULL == mdoc->last->child)
1076: return(1);
1077:
1078: /* LINTED */
1079: for (n = mdoc->last->child; n; n = n->next) {
1080: if (MDOC_BLOCK == n->type)
1081: if (MDOC_It == n->tok)
1082: continue;
1.23 kristaps 1083: return(mdoc_verr(mdoc, n->line, n->pos,
1084: "bad child of parent %s",
1.1 kristaps 1085: mdoc_macronames[mdoc->last->tok]));
1086: }
1087:
1088: return(1);
1089: }
1090:
1091:
1092: static int
1093: ebool(struct mdoc *mdoc)
1094: {
1095: struct mdoc_node *n;
1096:
1097: /* LINTED */
1098: for (n = mdoc->last->child; n; n = n->next) {
1099: if (MDOC_TEXT != n->type)
1100: break;
1.2 kristaps 1101: if (0 == strcmp(n->string, "on"))
1.1 kristaps 1102: continue;
1.2 kristaps 1103: if (0 == strcmp(n->string, "off"))
1.1 kristaps 1104: continue;
1105: break;
1106: }
1107:
1108: if (NULL == n)
1109: return(1);
1.23 kristaps 1110: return(mdoc_nerr(mdoc, n, EBOOL));
1.1 kristaps 1111: }
1112:
1113:
1114: static int
1115: post_root(POST_ARGS)
1116: {
1117:
1118: if (NULL == mdoc->first->child)
1.23 kristaps 1119: return(mdoc_nerr(mdoc, mdoc->first, ENODAT));
1.12 kristaps 1120: if ( ! (MDOC_PBODY & mdoc->flags))
1.23 kristaps 1121: return(mdoc_nerr(mdoc, mdoc->first, ENOPROLOGUE));
1.1 kristaps 1122:
1123: if (MDOC_BLOCK != mdoc->first->child->type)
1.23 kristaps 1124: return(mdoc_nerr(mdoc, mdoc->first, ENODAT));
1.1 kristaps 1125: if (MDOC_Sh != mdoc->first->child->tok)
1.23 kristaps 1126: return(mdoc_nerr(mdoc, mdoc->first, ENODAT));
1.1 kristaps 1127:
1128: return(1);
1129: }
1130:
1131:
1132: static int
1133: post_st(POST_ARGS)
1134: {
1135:
1136: if (mdoc_a2st(mdoc->last->child->string))
1137: return(1);
1.30 kristaps 1138: return(mdoc_nerr(mdoc, mdoc->last, EBADSTAND));
1.1 kristaps 1139: }
1140:
1141:
1142: static int
1143: post_sh(POST_ARGS)
1144: {
1145:
1146: if (MDOC_HEAD == mdoc->last->type)
1147: return(post_sh_head(mdoc));
1148: if (MDOC_BODY == mdoc->last->type)
1149: return(post_sh_body(mdoc));
1150:
1151: return(1);
1152: }
1153:
1154:
1155: static int
1156: post_sh_body(POST_ARGS)
1157: {
1158: struct mdoc_node *n;
1159:
1.29 kristaps 1160: if (SEC_NAME != mdoc->lastsec)
1.1 kristaps 1161: return(1);
1162:
1163: /*
1164: * Warn if the NAME section doesn't contain the `Nm' and `Nd'
1165: * macros (can have multiple `Nm' and one `Nd'). Note that the
1166: * children of the BODY declaration can also be "text".
1167: */
1168:
1169: if (NULL == (n = mdoc->last->child))
1.23 kristaps 1170: return(mdoc_nwarn(mdoc, mdoc->last, ENAMESECINC));
1.1 kristaps 1171:
1172: for ( ; n && n->next; n = n->next) {
1173: if (MDOC_ELEM == n->type && MDOC_Nm == n->tok)
1174: continue;
1.28 kristaps 1175: if (MDOC_TEXT == n->type)
1176: continue;
1.23 kristaps 1177: if ( ! mdoc_nwarn(mdoc, mdoc->last, ENAMESECINC))
1.1 kristaps 1178: return(0);
1179: }
1180:
1.27 kristaps 1181: if (MDOC_BLOCK == n->type && MDOC_Nd == n->tok)
1.1 kristaps 1182: return(1);
1.23 kristaps 1183: return(mdoc_nwarn(mdoc, mdoc->last, ENAMESECINC));
1.1 kristaps 1184: }
1185:
1186:
1187: static int
1188: post_sh_head(POST_ARGS)
1189: {
1.2 kristaps 1190: char buf[64];
1191: enum mdoc_sec sec;
1192: const struct mdoc_node *n;
1.1 kristaps 1193:
1194: /*
1195: * Process a new section. Sections are either "named" or
1196: * "custom"; custom sections are user-defined, while named ones
1197: * usually follow a conventional order and may only appear in
1198: * certain manual sections.
1199: */
1200:
1.12 kristaps 1201: buf[0] = 0;
1.1 kristaps 1202:
1.2 kristaps 1203: for (n = mdoc->last->child; n; n = n->next) {
1.12 kristaps 1204: /* XXX - copied from compact(). */
1.2 kristaps 1205: assert(MDOC_TEXT == n->type);
1.12 kristaps 1206:
1.2 kristaps 1207: if (strlcat(buf, n->string, 64) >= 64)
1.23 kristaps 1208: return(mdoc_nerr(mdoc, n, ETOOLONG));
1.2 kristaps 1209: if (NULL == n->next)
1210: continue;
1211: if (strlcat(buf, " ", 64) >= 64)
1.23 kristaps 1212: return(mdoc_nerr(mdoc, n, ETOOLONG));
1.2 kristaps 1213: }
1.1 kristaps 1214:
1215: sec = mdoc_atosec(buf);
1216:
1.12 kristaps 1217: /*
1218: * Check: NAME should always be first, CUSTOM has no roles,
1219: * non-CUSTOM has a conventional order to be followed.
1220: */
1.1 kristaps 1221:
1.12 kristaps 1222: if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)
1.23 kristaps 1223: return(mdoc_nerr(mdoc, mdoc->last, ESECNAME));
1.1 kristaps 1224: if (SEC_CUSTOM == sec)
1225: return(1);
1226: if (sec == mdoc->lastnamed)
1.26 kristaps 1227: if ( ! mdoc_nwarn(mdoc, mdoc->last, ESECREP))
1228: return(0);
1.1 kristaps 1229: if (sec < mdoc->lastnamed)
1.26 kristaps 1230: if ( ! mdoc_nwarn(mdoc, mdoc->last, ESECOOO))
1231: return(0);
1.1 kristaps 1232:
1.12 kristaps 1233: /*
1234: * Check particular section/manual conventions. LIBRARY can
1235: * only occur in msec 2, 3 (TODO: are there more of these?).
1236: */
1.1 kristaps 1237:
1238: switch (sec) {
1239: case (SEC_LIBRARY):
1240: switch (mdoc->meta.msec) {
1241: case (2):
1242: /* FALLTHROUGH */
1243: case (3):
1244: break;
1245: default:
1.23 kristaps 1246: return(mdoc_nwarn(mdoc, mdoc->last, EWRONGMSEC));
1.1 kristaps 1247: }
1248: break;
1249: default:
1250: break;
1251: }
1252:
1253: return(1);
1254: }
1255:
1256:
1257: static int
1258: pre_fd(PRE_ARGS)
1259: {
1260:
1261: return(check_sec(mdoc, n, SEC_SYNOPSIS, SEC_CUSTOM));
1262: }
CVSweb