diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-01-19 16:44:50 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-01-19 16:44:50 +0000 |
commit | 997afdc8d9bfb322c69f12820e5299a5cbca4fba (patch) | |
tree | 458f1731d8143930bf5485c03d1d76303963ca81 /mdoc_validate.c | |
parent | e7053cbde7464907196871161ebc3a69546a11ab (diff) | |
download | mandoc-997afdc8d9bfb322c69f12820e5299a5cbca4fba.tar.gz |
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.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 390667d5..f5f37b9f 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * 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 |