aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-01-19 16:44:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-01-19 16:44:50 +0000
commit66e8f935f05d1018898cee9e0c4ad713fc6b8673 (patch)
tree0e589a7384a81e59e9bb291c205fd9582ad8fd84 /mdoc_validate.c
parent8e1caa4a243aa8682d2c7d4fb644be63c055bb5d (diff)
downloadmandoc-66e8f935f05d1018898cee9e0c4ad713fc6b8673.tar.gz
mandoc-66e8f935f05d1018898cee9e0c4ad713fc6b8673.tar.zst
mandoc-66e8f935f05d1018898cee9e0c4ad713fc6b8673.zip
Align to the new, sane behaviour of the groff_mdoc(7) .Dd macro:
without an argument, use the empty string, and always concatenate all arguments, no matter their number. This allows reducing the number of arguments of mandoc_normdate() and some other simplifications, at the same time polishing some error messages by adding the name of the macro in question.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index c14d4008..4ec79423 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,7 +1,7 @@
-/* $Id: mdoc_validate.c,v 1.375 2019/09/13 19:26:46 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.376 2020/01/19 16:44:50 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2019 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -1909,7 +1909,7 @@ post_root(POST_ARGS)
/* Add missing prologue data. */
if (mdoc->meta.date == NULL)
- mdoc->meta.date = mandoc_normdate(mdoc, NULL, 0, 0);
+ mdoc->meta.date = mandoc_normdate(NULL, NULL);
if (mdoc->meta.title == NULL) {
mandoc_msg(MANDOCERR_DT_NOTITLE, 0, 0, "EOF");
@@ -2507,7 +2507,6 @@ static void
post_dd(POST_ARGS)
{
struct roff_node *n;
- char *datestr;
n = mdoc->last;
n->flags |= NODE_NOPRT;
@@ -2524,10 +2523,10 @@ post_dd(POST_ARGS)
mandoc_msg(MANDOCERR_PROLOG_ORDER,
n->line, n->pos, "Dd after Os");
- datestr = NULL;
- deroff(&datestr, n);
- mdoc->meta.date = mandoc_normdate(mdoc, datestr, n->line, n->pos);
- free(datestr);
+ if (mdoc->quick && n != NULL)
+ mdoc->meta.date = mandoc_strdup("");
+ else
+ mdoc->meta.date = mandoc_normdate(n->child, n);
}
static void