From 66e8f935f05d1018898cee9e0c4ad713fc6b8673 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 19 Jan 2020 16:44:50 +0000 Subject: 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. --- mdoc_validate.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'mdoc_validate.c') 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 - * Copyright (c) 2010-2019 Ingo Schwarze + * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * 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 -- cgit v1.2.3-56-ge451