=================================================================== RCS file: /cvs/mandoc/mandoc.c,v retrieving revision 1.101 retrieving revision 1.104 diff -u -p -r1.101 -r1.104 --- mandoc/mandoc.c 2017/06/11 19:37:01 1.101 +++ mandoc/mandoc.c 2018/07/28 18:34:15 1.104 @@ -1,7 +1,7 @@ -/* $Id: mandoc.c,v 1.101 2017/06/11 19:37:01 schwarze Exp $ */ +/* $Id: mandoc.c,v 1.104 2018/07/28 18:34:15 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons - * Copyright (c) 2011-2015, 2017 Ingo Schwarze + * Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -96,6 +96,8 @@ mandoc_escape(const char **end, const char **start, in case ',': case '/': return ESCAPE_IGNORE; + case 'p': + return ESCAPE_BREAK; /* * The \z escape is supposed to output the following @@ -521,6 +523,7 @@ fail: char * mandoc_normdate(struct roff_man *man, char *in, int ln, int pos) { + char *cp; time_t t; /* No date specified: use today's date. */ @@ -533,13 +536,23 @@ mandoc_normdate(struct roff_man *man, char *in, int ln /* Valid mdoc(7) date format. */ if (a2time(&t, "$" "Mdocdate: %b %d %Y $", in) || - a2time(&t, "%b %d, %Y", in)) - return time2a(t); + a2time(&t, "%b %d, %Y", in)) { + cp = time2a(t); + if (t > time(NULL) + 86400) + mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse, + ln, pos, cp); + else if (*in != '$' && strcmp(in, cp) != 0) + mandoc_msg(MANDOCERR_DATE_NORM, man->parse, + ln, pos, cp); + return cp; + } /* In man(7), do not warn about the legacy format. */ if (a2time(&t, "%Y-%m-%d", in) == 0) mandoc_msg(MANDOCERR_DATE_BAD, man->parse, ln, pos, in); + else if (t > time(NULL) + 86400) + mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse, ln, pos, in); else if (man->macroset == MACROSET_MDOC) mandoc_vmsg(MANDOCERR_DATE_LEGACY, man->parse, ln, pos, "Dd %s", in);