=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.92 retrieving revision 1.95 diff -u -p -r1.92 -r1.95 --- mandoc/mdoc_term.c 2009/10/18 19:03:37 1.92 +++ mandoc/mdoc_term.c 2009/10/24 05:52:14 1.95 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.92 2009/10/18 19:03:37 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.95 2009/10/24 05:52:14 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -236,6 +236,7 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, termp____post }, /* %Q */ { termp_sp_pre, NULL }, /* br */ { termp_sp_pre, NULL }, /* sp */ + { NULL, termp____post }, /* %U */ }; #ifdef __linux__ @@ -347,8 +348,8 @@ print_node(DECL_ARGS) static void print_foot(DECL_ARGS) { - struct tm *tm; - char *buf, *os; + char buf[DATESIZ]; + char *os; /* * Output the footer in new-groff style, that is, three columns @@ -358,16 +359,11 @@ print_foot(DECL_ARGS) * SYSTEM DATE SYSTEM */ - if (NULL == (buf = malloc(p->rmargin))) - err(EXIT_FAILURE, "malloc"); if (NULL == (os = malloc(p->rmargin))) err(EXIT_FAILURE, "malloc"); - tm = localtime(&m->date); + time2a(m->date, buf, DATESIZ); - if (0 == strftime(buf, p->rmargin, "%B %e, %Y", tm)) - err(EXIT_FAILURE, "strftime"); - (void)strlcpy(os, m->os, p->rmargin); term_vspace(p); @@ -398,7 +394,6 @@ print_foot(DECL_ARGS) p->rmargin = p->maxrmargin; p->flags = 0; - free(buf); free(os); } @@ -494,13 +489,13 @@ arg2width(const struct mdoc_argv *arg, int pos) assert(arg->value[pos]); if ( ! a2roffsu(arg->value[pos], &su, SCALE_MAX)) - SCALE_HS_INIT(&su, strlen(arg->value[pos]) + 2); + SCALE_HS_INIT(&su, strlen(arg->value[pos])); - return(term_hspan(&su)); + /* XXX: pachemu? */ + return(term_hspan(&su) + 2); } -/* FIXME: put in utility file for front-ends. */ static int arg_listtype(const struct mdoc_node *n) { @@ -2011,6 +2006,8 @@ termp_ap_pre(DECL_ARGS) static void termp____post(DECL_ARGS) { + + /* TODO: %U. */ p->flags |= TERMP_NOSPACE; switch (n->tok) {