=================================================================== RCS file: /cvs/mandoc/Attic/mdoc_action.c,v retrieving revision 1.47 retrieving revision 1.52 diff -u -p -r1.47 -r1.52 --- mandoc/Attic/mdoc_action.c 2009/10/30 18:50:11 1.47 +++ mandoc/Attic/mdoc_action.c 2010/04/05 09:03:12 1.52 @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.47 2009/10/30 18:50:11 kristaps Exp $ */ +/* $Id: mdoc_action.c,v 1.52 2010/04/05 09:03:12 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -14,12 +14,15 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifndef OSNAME #include #endif #include -#include #include #include #include @@ -43,10 +46,6 @@ static int concat(struct mdoc *, char *, const struct mdoc_node *, size_t); static inline int order_rs(int); -#ifdef __linux__ -extern size_t strlcat(char *, const char *, size_t); -#endif - static int post_ar(POST_ARGS); static int post_at(POST_ARGS); static int post_bl(POST_ARGS); @@ -421,7 +420,11 @@ post_sh(POST_ARGS) if ( ! concat(m, buf, n->child, BUFSIZ)) return(0); sec = mdoc_atosec(buf); - if (SEC_CUSTOM != sec) + /* + * The first section should always make us move into a non-new + * state. + */ + if (SEC_NONE == m->lastnamed || SEC_CUSTOM != sec) m->lastnamed = sec; /* Some sections only live in certain manual sections. */ @@ -504,7 +507,6 @@ post_dt(POST_ARGS) if (cp) { /* FIXME: where is strtonum!? */ m->meta.vol = mandoc_strdup(cp); - errno = 0; lval = strtol(nn->string, &ep, 10); if (nn->string[0] != '\0' && *ep == '\0') m->meta.msec = (int)lval; @@ -649,7 +651,8 @@ static int post_bl_width(POST_ARGS) { size_t width; - int i, tok; + int i; + enum mdoct tok; char buf[NUMSIZ]; char *p; @@ -820,8 +823,7 @@ post_ar(POST_ARGS) /* - * Parse the date field in `Dd', primarily through mdoc_atotime(). - * FIXME: push mdoc_atotime() into here. + * Parse the date field in `Dd'. */ static int post_dd(POST_ARGS) @@ -831,7 +833,9 @@ post_dd(POST_ARGS) if ( ! concat(m, buf, n->child, DATESIZ)) return(0); - m->meta.date = mdoc_atotime(buf); + m->meta.date = mandoc_a2time + (MTIME_MDOCDATE | MTIME_CANONICAL, buf); + if (0 == m->meta.date) { if ( ! mdoc_nwarn(m, n, EBADDATE)) return(0);