=================================================================== RCS file: /cvs/mandoc/mandoc.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -p -r1.55 -r1.56 --- mandoc/mandoc.c 2011/07/21 23:30:39 1.55 +++ mandoc/mandoc.c 2011/07/24 18:15:14 1.56 @@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.55 2011/07/21 23:30:39 kristaps Exp $ */ +/* $Id: mandoc.c,v 1.56 2011/07/24 18:15:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -542,7 +542,10 @@ a2time(time_t *t, const char *fmt, const char *p) memset(&tm, 0, sizeof(struct tm)); + pp = NULL; +#ifdef HAVE_STRPTIME pp = strptime(p, fmt, &tm); +#endif if (NULL != pp && '\0' == *pp) { *t = mktime(&tm); return(1); @@ -554,12 +557,12 @@ a2time(time_t *t, const char *fmt, const char *p) static char * time2a(time_t t) { - struct tm tm; + struct tm *tm; char *buf, *p; size_t ssz; int isz; - localtime_r(&t, &tm); + tm = localtime(&t); /* * Reserve space: @@ -569,15 +572,15 @@ time2a(time_t t) */ p = buf = mandoc_malloc(10 + 4 + 4 + 1); - if (0 == (ssz = strftime(p, 10 + 1, "%B ", &tm))) + if (0 == (ssz = strftime(p, 10 + 1, "%B ", tm))) goto fail; p += (int)ssz; - if (-1 == (isz = snprintf(p, 4 + 1, "%d, ", tm.tm_mday))) + if (-1 == (isz = snprintf(p, 4 + 1, "%d, ", tm->tm_mday))) goto fail; p += isz; - if (0 == strftime(p, 4 + 1, "%Y", &tm)) + if (0 == strftime(p, 4 + 1, "%Y", tm)) goto fail; return(buf);