From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id f1894576; for ; Thu, 27 Nov 2014 11:21:01 -0500 (EST) Date: Thu, 27 Nov 2014 11:21:01 -0500 (EST) Message-Id: <14254861026620810373.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Fix the obsolete .Db (toggle debug mode) macro to ignore its X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Fix the obsolete .Db (toggle debug mode) macro to ignore its arguments and not trigger an assertion when there is more than one argument; the latter found by jsg@ with afl. Modified Files: -------------- mdocml: mdoc.7 mdoc_html.c mdoc_man.c mdoc_term.c mdoc_validate.c Revision Data ------------- Index: mdoc_man.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_man.c,v retrieving revision 1.74 retrieving revision 1.75 diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.74 -r1.75 --- mdoc_man.c +++ mdoc_man.c @@ -84,7 +84,7 @@ static int pre_dl(DECL_ARGS); static int pre_en(DECL_ARGS); static int pre_enc(DECL_ARGS); static int pre_em(DECL_ARGS); -static int pre_es(DECL_ARGS); +static int pre_skip(DECL_ARGS); static int pre_ex(DECL_ARGS); static int pre_fa(DECL_ARGS); static int pre_fd(DECL_ARGS); @@ -183,7 +183,7 @@ static const struct manact manacts[MDOC_ { cond_body, pre_enc, post_enc, "[", "]" }, /* Bq */ { NULL, pre_ux, NULL, "BSD/OS", NULL }, /* Bsx */ { NULL, pre_bx, NULL, NULL, NULL }, /* Bx */ - { NULL, NULL, NULL, NULL, NULL }, /* Db */ + { NULL, pre_skip, NULL, NULL, NULL }, /* Db */ { NULL, NULL, NULL, NULL, NULL }, /* Dc */ { cond_body, pre_enc, post_enc, "\\(lq", "\\(rq" }, /* Do */ { cond_body, pre_enc, post_enc, "\\(lq", "\\(rq" }, /* Dq */ @@ -235,7 +235,7 @@ static const struct manact manacts[MDOC_ { cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */ { NULL, NULL, NULL, NULL, NULL }, /* Brc */ { NULL, NULL, post_percent, NULL, NULL }, /* %C */ - { NULL, pre_es, NULL, NULL, NULL }, /* Es */ + { NULL, pre_skip, NULL, NULL, NULL }, /* Es */ { cond_body, pre_en, post_en, NULL, NULL }, /* En */ { NULL, pre_ux, NULL, "DragonFly", NULL }, /* Dx */ { NULL, NULL, post_percent, NULL, NULL }, /* %Q */ @@ -1132,13 +1132,6 @@ post_eo(DECL_ARGS) } static int -pre_es(DECL_ARGS) -{ - - return(0); -} - -static int pre_fa(DECL_ARGS) { int am_Fa; @@ -1674,6 +1667,13 @@ pre_rv(DECL_ARGS) print_word("is set to indicate the error."); outflags |= MMAN_nl; + return(0); +} + +static int +pre_skip(DECL_ARGS) +{ + return(0); } Index: mdoc_validate.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v retrieving revision 1.256 retrieving revision 1.257 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.256 -r1.257 --- mdoc_validate.c +++ mdoc_validate.c @@ -72,7 +72,6 @@ static enum mdoc_sec a2sec(const char *) 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); @@ -122,6 +121,7 @@ static int post_sh_head(POST_ARGS); 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); @@ -199,7 +199,7 @@ static const struct valids mdoc_valids[M { NULL, NULL }, /* Bq */ { NULL, NULL }, /* Bsx */ { NULL, post_bx }, /* Bx */ - { NULL, ebool }, /* Db */ + { pre_obsolete, NULL }, /* Db */ { NULL, NULL }, /* Dc */ { NULL, NULL }, /* Do */ { NULL, NULL }, /* Dq */ @@ -226,7 +226,7 @@ static const struct valids mdoc_valids[M { NULL, NULL }, /* Sc */ { NULL, NULL }, /* So */ { NULL, NULL }, /* Sq */ - { NULL, ebool }, /* Sm */ + { NULL, post_sm }, /* Sm */ { NULL, post_hyph }, /* Sx */ { NULL, NULL }, /* Sy */ { NULL, NULL }, /* Tn */ @@ -1622,36 +1622,31 @@ post_bk(POST_ARGS) } static int -ebool(struct mdoc *mdoc) +post_sm(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; + if (nch == NULL) { + mdoc->flags ^= MDOC_SMOFF; return(1); } - assert(MDOC_TEXT == nch->type); + assert(nch->type == MDOC_TEXT); - if (0 == strcmp(nch->string, "on")) { - if (MDOC_Sm == tok) - mdoc->flags &= ~MDOC_SMOFF; + if ( ! strcmp(nch->string, "on")) { + mdoc->flags &= ~MDOC_SMOFF; return(1); } - if (0 == strcmp(nch->string, "off")) { - if (MDOC_Sm == tok) - mdoc->flags |= MDOC_SMOFF; + 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[tok], nch->string); + "%s %s", mdoc_macronames[mdoc->last->tok], nch->string); return(mdoc_node_relink(mdoc, nch)); } Index: mdoc_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v retrieving revision 1.293 retrieving revision 1.294 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.293 -r1.294 --- mdoc_term.c +++ mdoc_term.c @@ -91,7 +91,6 @@ static int termp_bt_pre(DECL_ARGS); static int termp_bx_pre(DECL_ARGS); static int termp_cd_pre(DECL_ARGS); static int termp_d1_pre(DECL_ARGS); -static int termp_es_pre(DECL_ARGS); static int termp_ex_pre(DECL_ARGS); static int termp_fa_pre(DECL_ARGS); static int termp_fd_pre(DECL_ARGS); @@ -111,6 +110,7 @@ static int termp_quote_pre(DECL_ARGS); static int termp_rs_pre(DECL_ARGS); static int termp_rv_pre(DECL_ARGS); static int termp_sh_pre(DECL_ARGS); +static int termp_skip_pre(DECL_ARGS); static int termp_sm_pre(DECL_ARGS); static int termp_sp_pre(DECL_ARGS); static int termp_ss_pre(DECL_ARGS); @@ -183,7 +183,7 @@ static const struct termact termacts[MDO { termp_quote_pre, termp_quote_post }, /* Bq */ { termp_xx_pre, NULL }, /* Bsx */ { termp_bx_pre, NULL }, /* Bx */ - { NULL, NULL }, /* Db */ + { termp_skip_pre, NULL }, /* Db */ { NULL, NULL }, /* Dc */ { termp_quote_pre, termp_quote_post }, /* Do */ { termp_quote_pre, termp_quote_post }, /* Dq */ @@ -235,7 +235,7 @@ static const struct termact termacts[MDO { termp_quote_pre, termp_quote_post }, /* Bro */ { NULL, NULL }, /* Brc */ { NULL, termp____post }, /* %C */ - { termp_es_pre, NULL }, /* Es */ + { termp_skip_pre, NULL }, /* Es */ { termp_quote_pre, termp_quote_post }, /* En */ { termp_xx_pre, NULL }, /* Dx */ { NULL, termp____post }, /* %Q */ @@ -1838,7 +1838,7 @@ termp_sp_pre(DECL_ARGS) } static int -termp_es_pre(DECL_ARGS) +termp_skip_pre(DECL_ARGS) { return(0); Index: mdoc.7 =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc.7,v retrieving revision 1.241 retrieving revision 1.242 diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.241 -r1.242 --- mdoc.7 +++ mdoc.7 @@ -1185,13 +1185,12 @@ See also and .Sx \&Dl . .Ss \&Db -Switch debugging mode. -Its syntax is as follows: -.Pp -.D1 Pf \. Sx \&Db Cm on | off -.Pp -This macro is ignored by -.Xr mandoc 1 . +This macro is obsolete. +No replacement is needed. +It is ignored by +.Xr mandoc 1 +and groff including its arguments. +It was formerly used to toggle a debugging mode. .Ss \&Dc Close a .Sx \&Do Index: mdoc_html.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v retrieving revision 1.211 retrieving revision 1.212 diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.211 -r1.212 --- mdoc_html.c +++ mdoc_html.c @@ -183,7 +183,7 @@ static const struct htmlmdoc mdocs[MDOC_ {mdoc_quote_pre, mdoc_quote_post}, /* Bq */ {mdoc_xx_pre, NULL}, /* Bsx */ {mdoc_bx_pre, NULL}, /* Bx */ - {NULL, NULL}, /* Db */ + {mdoc_skip_pre, NULL}, /* Db */ {NULL, NULL}, /* Dc */ {mdoc_quote_pre, mdoc_quote_post}, /* Do */ {mdoc_quote_pre, mdoc_quote_post}, /* Dq */ -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv