=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.172 retrieving revision 1.173 diff -c -r1.172 -r1.173 *** src/usr.bin/mandoc/mdoc_validate.c 2014/11/26 19:23:47 1.172 --- src/usr.bin/mandoc/mdoc_validate.c 2014/11/27 16:20:27 1.173 *************** *** 1,4 **** ! /* $OpenBSD: mdoc_validate.c,v 1.172 2014/11/26 19:23:47 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: mdoc_validate.c,v 1.173 2014/11/27 16:20:27 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2014 Ingo Schwarze *************** *** 16,22 **** * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ - #include #ifndef OSNAME #include --- 16,21 ---- *************** *** 71,77 **** static size_t macro2len(enum mdoct); static void rewrite_macro2len(char **); - static int ebool(POST_ARGS); static int berr_ge1(POST_ARGS); static int bwarn_ge1(POST_ARGS); static int ewarn_eq0(POST_ARGS); --- 70,75 ---- *************** *** 121,126 **** --- 119,125 ---- static int post_sh_name(POST_ARGS); static int post_sh_see_also(POST_ARGS); static int post_sh_authors(POST_ARGS); + static int post_sm(POST_ARGS); static int post_st(POST_ARGS); static int post_vt(POST_ARGS); static int pre_an(PRE_ARGS); *************** *** 198,204 **** { NULL, NULL }, /* Bq */ { NULL, NULL }, /* Bsx */ { NULL, post_bx }, /* Bx */ ! { NULL, ebool }, /* Db */ { NULL, NULL }, /* Dc */ { NULL, NULL }, /* Do */ { NULL, NULL }, /* Dq */ --- 197,203 ---- { NULL, NULL }, /* Bq */ { NULL, NULL }, /* Bsx */ { NULL, post_bx }, /* Bx */ ! { pre_obsolete, NULL }, /* Db */ { NULL, NULL }, /* Dc */ { NULL, NULL }, /* Do */ { NULL, NULL }, /* Dq */ *************** *** 225,231 **** { NULL, NULL }, /* Sc */ { NULL, NULL }, /* So */ { NULL, NULL }, /* Sq */ ! { NULL, ebool }, /* Sm */ { NULL, post_hyph }, /* Sx */ { NULL, NULL }, /* Sy */ { NULL, NULL }, /* Tn */ --- 224,230 ---- { NULL, NULL }, /* Sc */ { NULL, NULL }, /* So */ { NULL, NULL }, /* Sq */ ! { NULL, post_sm }, /* Sm */ { NULL, post_hyph }, /* Sx */ { NULL, NULL }, /* Sy */ { NULL, NULL }, /* Tn */ *************** *** 1621,1656 **** } static int ! ebool(struct mdoc *mdoc) { struct mdoc_node *nch; - enum mdoct tok; - tok = mdoc->last->tok; nch = mdoc->last->child; ! if (NULL == nch) { ! if (MDOC_Sm == tok) ! mdoc->flags ^= MDOC_SMOFF; return(1); } ! assert(MDOC_TEXT == nch->type); ! if (0 == strcmp(nch->string, "on")) { ! if (MDOC_Sm == tok) ! mdoc->flags &= ~MDOC_SMOFF; return(1); } ! if (0 == strcmp(nch->string, "off")) { ! if (MDOC_Sm == tok) ! mdoc->flags |= MDOC_SMOFF; return(1); } mandoc_vmsg(MANDOCERR_SM_BAD, mdoc->parse, nch->line, nch->pos, ! "%s %s", mdoc_macronames[tok], nch->string); return(mdoc_node_relink(mdoc, nch)); } --- 1620,1650 ---- } static int ! post_sm(struct mdoc *mdoc) { struct mdoc_node *nch; nch = mdoc->last->child; ! if (nch == NULL) { ! mdoc->flags ^= MDOC_SMOFF; return(1); } ! assert(nch->type == MDOC_TEXT); ! if ( ! strcmp(nch->string, "on")) { ! mdoc->flags &= ~MDOC_SMOFF; return(1); } ! if ( ! strcmp(nch->string, "off")) { ! mdoc->flags |= MDOC_SMOFF; return(1); } mandoc_vmsg(MANDOCERR_SM_BAD, mdoc->parse, nch->line, nch->pos, ! "%s %s", mdoc_macronames[mdoc->last->tok], nch->string); return(mdoc_node_relink(mdoc, nch)); }