From 23ae8ccb1b52134baac639bb4490d75fd11c858e Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 15 May 2010 15:54:39 +0000 Subject: Removed restriction on integer manual sections in -man. --- TODO | 3 ++- libman.h | 3 +-- man.c | 5 +++-- man.h | 4 ++-- man_action.c | 16 ++++------------ man_html.c | 6 +++--- man_term.c | 4 ++-- man_validate.c | 4 ++-- 8 files changed, 19 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index a7af0955..cb3ae182 100644 --- a/TODO +++ b/TODO @@ -21,8 +21,9 @@ reminded by Ludo Smissaert Mon, 10 May 2010 12:15:11 +0200 also reported by jmc@ earlier -- man(7) .TH should recognize "3p" as a section number +- FIXED man(7) .TH should recognize "3p" as a section number found in usr.bin/pkg_add OpenBSD::Getopt + NEEDS MERGING TO openbsd.org - implement \\ in plain text, identical to \e diff --git a/libman.h b/libman.h index 83dc6da2..7f96b535 100644 --- a/libman.h +++ b/libman.h @@ -1,4 +1,4 @@ -/* $Id: libman.h,v 1.31 2010/04/08 07:53:01 kristaps Exp $ */ +/* $Id: libman.h,v 1.32 2010/05/15 15:54:39 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -45,7 +45,6 @@ struct man { enum merr { WNPRINT = 0, - WMSEC, WDATE, WLNSCOPE, WLNSCOPE2, diff --git a/man.c b/man.c index 28c00c90..8777a39e 100644 --- a/man.c +++ b/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.67 2010/05/15 06:48:13 kristaps Exp $ */ +/* $Id: man.c,v 1.68 2010/05/15 15:54:39 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -32,7 +32,6 @@ const char *const __man_merrnames[WERRMAX] = { "invalid character", /* WNPRINT */ - "invalid manual section", /* WMSEC */ "invalid date format", /* WDATE */ "scope of prior line violated", /* WLNSCOPE */ "over-zealous prior line scope violation", /* WLNSCOPE2 */ @@ -174,6 +173,8 @@ man_free1(struct man *man) free(man->meta.source); if (man->meta.vol) free(man->meta.vol); + if (man->meta.msec) + free(man->meta.msec); } diff --git a/man.h b/man.h index ca61fae2..62c26289 100644 --- a/man.h +++ b/man.h @@ -1,4 +1,4 @@ -/* $Id: man.h,v 1.29 2010/05/12 16:46:28 kristaps Exp $ */ +/* $Id: man.h,v 1.30 2010/05/15 15:54:39 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -74,7 +74,7 @@ enum man_type { }; struct man_meta { - int msec; + char *msec; time_t date; char *vol; char *title; diff --git a/man_action.c b/man_action.c index 1edd6509..9a443dca 100644 --- a/man_action.c +++ b/man_action.c @@ -1,4 +1,4 @@ -/* $Id: man_action.c,v 1.30 2010/03/27 10:04:56 kristaps Exp $ */ +/* $Id: man_action.c,v 1.31 2010/05/15 15:54:39 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -144,8 +144,6 @@ static int post_TH(struct man *m) { struct man_node *n; - char *ep; - long lval; if (m->meta.title) free(m->meta.title); @@ -154,8 +152,8 @@ post_TH(struct man *m) if (m->meta.source) free(m->meta.source); - m->meta.title = m->meta.vol = m->meta.source = NULL; - m->meta.msec = 0; + m->meta.title = m->meta.vol = + m->meta.msec = m->meta.source = NULL; m->meta.date = 0; /* ->TITLE<- MSEC DATE SOURCE VOL */ @@ -168,12 +166,7 @@ post_TH(struct man *m) n = n->next; assert(n); - - lval = strtol(n->string, &ep, 10); - if (n->string[0] != '\0' && *ep == '\0') - m->meta.msec = (int)lval; - else if ( ! man_nwarn(m, n, WMSEC)) - return(0); + m->meta.msec = mandoc_strdup(n->string); /* TITLE MSEC ->DATE<- SOURCE VOL */ @@ -181,7 +174,6 @@ post_TH(struct man *m) if (n) { m->meta.date = mandoc_a2time (MTIME_ISO_8601, n->string); - if (0 == m->meta.date) { if ( ! man_nwarn(m, n, WDATE)) return(0); diff --git a/man_html.c b/man_html.c index add096ca..75900970 100644 --- a/man_html.c +++ b/man_html.c @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.30 2010/03/24 20:10:53 kristaps Exp $ */ +/* $Id: man_html.c,v 1.31 2010/05/15 15:54:39 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -162,7 +162,7 @@ print_man_head(MAN_ARGS) print_gen_head(h); bufinit(h); - buffmt(h, "%s(%d)", m->title, m->msec); + buffmt(h, "%s(%s)", m->title, m->msec); print_otag(h, TAG_TITLE, 0, NULL); print_text(h, h->buf); @@ -267,7 +267,7 @@ man_root_pre(MAN_ARGS) if (m->vol) (void)strlcat(b, m->vol, BUFSIZ); - snprintf(title, BUFSIZ - 1, "%s(%d)", m->title, m->msec); + snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec); PAIR_CLASS_INIT(&tag[0], "header"); bufcat_style(h, "width", "100%"); diff --git a/man_term.c b/man_term.c index fd88e2df..5da984aa 100644 --- a/man_term.c +++ b/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.63 2010/05/12 16:46:28 kristaps Exp $ */ +/* $Id: man_term.c,v 1.64 2010/05/15 15:54:39 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -911,7 +911,7 @@ print_man_head(struct termp *p, const struct man_meta *m) strlcpy(buf, m->vol, BUFSIZ); buflen = strlen(buf); - snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec); + snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec); titlen = strlen(title); p->offset = 0; diff --git a/man_validate.c b/man_validate.c index 2326ea91..ca920646 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.36 2010/05/14 16:19:26 kristaps Exp $ */ +/* $Id: man_validate.c,v 1.37 2010/05/15 15:54:39 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -178,7 +178,7 @@ check_root(CHKARGS) */ m->meta.title = mandoc_strdup("unknown"); m->meta.date = time(NULL); - m->meta.msec = 1; + m->meta.msec = mandoc_strdup("1"); } return(1); -- cgit v1.2.3-56-ge451