aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-11-27 16:20:31 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-11-27 16:20:31 +0000
commitae5f77f4afb4eacc8500ded5455086d6242ae946 (patch)
treea14a4377b896bcb23d2b71d2b57d9b3c825b0a78
parent63db09932dec56e5bb940db7c81df9660ab0c0d0 (diff)
downloadmandoc-ae5f77f4afb4eacc8500ded5455086d6242ae946.tar.gz
mandoc-ae5f77f4afb4eacc8500ded5455086d6242ae946.tar.zst
mandoc-ae5f77f4afb4eacc8500ded5455086d6242ae946.zip
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.
-rw-r--r--mdoc.717
-rw-r--r--mdoc_html.c4
-rw-r--r--mdoc_man.c22
-rw-r--r--mdoc_term.c10
-rw-r--r--mdoc_validate.c31
5 files changed, 39 insertions, 45 deletions
diff --git a/mdoc.7 b/mdoc.7
index 9f3ca835..e69bb9f7 100644
--- a/mdoc.7
+++ b/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.241 2014/11/16 20:46:21 schwarze Exp $
+.\" $Id: mdoc.7,v 1.242 2014/11/27 16:20:31 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010, 2011, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 16 2014 $
+.Dd $Mdocdate: November 27 2014 $
.Dt MDOC 7
.Os
.Sh NAME
@@ -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
diff --git a/mdoc_html.c b/mdoc_html.c
index eed9b048..ff388f37 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.211 2014/11/19 22:00:37 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.212 2014/11/27 16:20:31 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -183,7 +183,7 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{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 */
diff --git a/mdoc_man.c b/mdoc_man.c
index 75b68e62..33e8b2cb 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.74 2014/11/19 22:00:37 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.75 2014/11/27 16:20:31 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -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_MAX + 1] = {
{ 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_MAX + 1] = {
{ 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;
@@ -1678,6 +1671,13 @@ pre_rv(DECL_ARGS)
}
static int
+pre_skip(DECL_ARGS)
+{
+
+ return(0);
+}
+
+static int
pre_sm(DECL_ARGS)
{
diff --git a/mdoc_term.c b/mdoc_term.c
index f1825ccd..08a32850 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.293 2014/11/25 20:00:01 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.294 2014/11/27 16:20:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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[MDOC_MAX] = {
{ 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[MDOC_MAX] = {
{ 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);
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 28a110da..5707b319 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.256 2014/11/26 19:24:03 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.257 2014/11/27 16:20:31 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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[MDOC_MAX] = {
{ 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[MDOC_MAX] = {
{ 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));
}