summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mandoc/mandoc.h4
-rw-r--r--usr.bin/mandoc/mdoc_term.c4
-rw-r--r--usr.bin/mandoc/mdoc_validate.c83
-rw-r--r--usr.bin/mandoc/read.c4
4 files changed, 7 insertions, 88 deletions
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index 7a733fa3d62..c10730d026b 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandoc.h,v 1.151 2016/01/08 02:53:09 schwarze Exp $ */
+/* $OpenBSD: mandoc.h,v 1.152 2016/10/09 18:16:46 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -98,7 +98,7 @@ enum mandocerr {
MANDOCERR_ARG_EMPTY, /* empty argument, using 0n: macro arg */
MANDOCERR_BD_NOTYPE, /* missing display type, using -ragged: Bd */
MANDOCERR_BL_LATETYPE, /* list type is not the first argument: Bl arg */
- MANDOCERR_BL_NOWIDTH, /* missing -width in -tag list, using 8n */
+ MANDOCERR_BL_NOWIDTH, /* missing -width in -tag list, using 6n */
MANDOCERR_EX_NONAME, /* missing utility name, using "": Ex */
MANDOCERR_FO_NOHEAD, /* missing function name, using "": Fo */
MANDOCERR_IT_NOHEAD, /* empty head in list item: Bl -type It */
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 93d3dbc3361..17c4d9513a1 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_term.c,v 1.230 2016/01/08 17:48:04 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.231 2016/10/09 18:16:46 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -629,10 +629,10 @@ termp_it_pre(DECL_ARGS)
width = term_len(p, 2);
break;
case LIST_hang:
+ case LIST_tag:
width = term_len(p, 8);
break;
case LIST_column:
- case LIST_tag:
width = term_len(p, 10);
break;
default:
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index d1d9bb4d7e2..a087a21a470 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.224 2016/08/20 14:43:39 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.225 2016/10/09 18:16:46 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -65,7 +65,6 @@ static void post_bf(POST_ARGS);
static void post_bk(POST_ARGS);
static void post_bl(POST_ARGS);
static void post_bl_block(POST_ARGS);
-static void post_bl_block_tag(POST_ARGS);
static void post_bl_head(POST_ARGS);
static void post_bl_norm(POST_ARGS);
static void post_bx(POST_ARGS);
@@ -1090,22 +1089,7 @@ post_bl_block(POST_ARGS)
post_prevpar(mdoc);
- /*
- * These are fairly complicated, so we've broken them into two
- * functions. post_bl_block_tag() is called when a -tag is
- * specified, but no -width (it must be guessed). The second
- * when a -width is specified (macro indicators must be
- * rewritten into real lengths).
- */
-
n = mdoc->last;
-
- if (n->norm->Bl.type == LIST_tag &&
- n->norm->Bl.width == NULL) {
- post_bl_block_tag(mdoc);
- assert(n->norm->Bl.width != NULL);
- }
-
for (ni = n->body->child; ni != NULL; ni = ni->next) {
if (ni->body == NULL)
continue;
@@ -1163,71 +1147,6 @@ rewrite_macro2len(char **arg)
}
static void
-post_bl_block_tag(POST_ARGS)
-{
- struct roff_node *n, *nn;
- size_t sz, ssz;
- int i;
- char buf[24];
-
- /*
- * Calculate the -width for a `Bl -tag' list if it hasn't been
- * provided. Uses the first head macro. NOTE AGAIN: this is
- * ONLY if the -width argument has NOT been provided. See
- * rewrite_macro2len() for converting the -width string.
- */
-
- sz = 10;
- n = mdoc->last;
-
- for (nn = n->body->child; nn != NULL; nn = nn->next) {
- if (nn->tok != MDOC_It)
- continue;
-
- assert(nn->type == ROFFT_BLOCK);
- nn = nn->head->child;
-
- if (nn == NULL)
- break;
-
- if (nn->type == ROFFT_TEXT) {
- sz = strlen(nn->string) + 1;
- break;
- }
-
- if (0 != (ssz = macro2len(nn->tok)))
- sz = ssz;
-
- break;
- }
-
- /* Defaults to ten ens. */
-
- (void)snprintf(buf, sizeof(buf), "%un", (unsigned int)sz);
-
- /*
- * We have to dynamically add this to the macro's argument list.
- * We're guaranteed that a MDOC_Width doesn't already exist.
- */
-
- assert(n->args != NULL);
- i = (int)(n->args->argc)++;
-
- n->args->argv = mandoc_reallocarray(n->args->argv,
- n->args->argc, sizeof(struct mdoc_argv));
-
- n->args->argv[i].arg = MDOC_Width;
- n->args->argv[i].line = n->line;
- n->args->argv[i].pos = n->pos;
- n->args->argv[i].sz = 1;
- n->args->argv[i].value = mandoc_malloc(sizeof(char *));
- n->args->argv[i].value[0] = mandoc_strdup(buf);
-
- /* Set our width! */
- n->norm->Bl.width = n->args->argv[i].value[0];
-}
-
-static void
post_bl_head(POST_ARGS)
{
struct roff_node *nbl, *nh, *nch, *nnext;
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index 65ecff72194..63d7b20a9ad 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.124 2016/07/19 16:22:34 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.125 2016/10/09 18:16:46 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -136,7 +136,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"empty argument, using 0n",
"missing display type, using -ragged",
"list type is not the first argument",
- "missing -width in -tag list, using 8n",
+ "missing -width in -tag list, using 6n",
"missing utility name, using \"\"",
"missing function name, using \"\"",
"empty head in list item",