=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.8 retrieving revision 1.11 diff -u -p -r1.8 -r1.11 --- mandoc/mdoc_validate.c 2009/06/11 10:34:31 1.8 +++ mandoc/mdoc_validate.c 2009/06/17 09:41:00 1.11 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.8 2009/06/11 10:34:31 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.11 2009/06/17 09:41:00 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -53,6 +53,7 @@ enum mwarn { WNOWIDTH, WMISSWIDTH, WESCAPE, + WDEPESC, WDEPCOL, WWRONGMSEC, WSECOOO, @@ -191,7 +192,7 @@ static v_post posts_bf[] = { hwarn_le1, post_bf, NULL static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL }; const struct valids mdoc_valids[MDOC_MAX] = { - { NULL, NULL }, /* \" */ + { NULL, NULL }, /* Ap */ { pres_dd, posts_text }, /* Dd */ { pres_dt, NULL }, /* Dt */ { pres_os, NULL }, /* Os */ @@ -298,9 +299,8 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL }, /* Fr */ { NULL, posts_notext }, /* Ud */ { pres_lb, posts_lb }, /* Lb */ - { NULL, NULL }, /* Ap */ { NULL, posts_pp }, /* Lp */ - { NULL, posts_text }, /* Lk */ + { NULL, NULL }, /* Lk */ { NULL, posts_text }, /* Mt */ { NULL, posts_wline }, /* Brq */ { NULL, NULL }, /* Bro */ @@ -479,6 +479,9 @@ pwarn(struct mdoc *m, int line, int pos, enum mwarn ty case (WESCAPE): p = "invalid escape sequence"; break; + case (WDEPESC): + p = "deprecated special-character escape"; + break; case (WNOLINE): p = "suggested no line arguments"; break; @@ -718,8 +721,6 @@ check_text(struct mdoc *mdoc, int line, int pos, const { size_t c; - /* FIXME: indicate deprecated escapes \*(xx and \*x. */ - for ( ; *p; p++) { if ('\t' == *p) { if ( ! (MDOC_LITERAL & mdoc->flags)) @@ -734,6 +735,10 @@ check_text(struct mdoc *mdoc, int line, int pos, const c = mdoc_isescape(p); if (c) { + /* See if form is deprecated. */ + if ('*' == p[1]) + if ( ! pwarn(mdoc, line, pos, WDEPESC)) + return(0); p += (int)c - 1; continue; } @@ -789,7 +794,7 @@ pre_display(PRE_ARGS) static int pre_bl(PRE_ARGS) { - int pos, type, width, offset; + int pos, col, type, width, offset; if (MDOC_BLOCK != n->type) return(1); @@ -798,7 +803,7 @@ pre_bl(PRE_ARGS) /* Make sure that only one type of list is specified. */ - type = offset = width = -1; + type = offset = width = col = -1; /* LINTED */ for (pos = 0; pos < (int)n->args->argc; pos++) @@ -827,6 +832,7 @@ pre_bl(PRE_ARGS) if (-1 != type) return(nerr(mdoc, n, EMULTILIST)); type = n->args->argv[pos].arg; + col = pos; break; case (MDOC_Width): if (-1 != width) @@ -876,7 +882,8 @@ pre_bl(PRE_ARGS) switch (type) { case (MDOC_Column): - if (0 == n->args->argv[pos].sz) + assert(col >= 0); + if (0 == n->args->argv[col].sz) break; if ( ! nwarn(mdoc, n, WDEPCOL)) return(0);