diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/libmdoc.h | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.7 | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.h | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_action.c | 38 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_validate.c | 19 |
8 files changed, 43 insertions, 44 deletions
diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h index bc4098db736..cb5388c1f75 100644 --- a/usr.bin/mandoc/libmdoc.h +++ b/usr.bin/mandoc/libmdoc.h @@ -1,4 +1,4 @@ -/* $Id: libmdoc.h,v 1.33 2010/05/15 16:48:12 schwarze Exp $ */ +/* $Id: libmdoc.h,v 1.34 2010/05/15 18:25:50 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -80,7 +80,7 @@ enum merr { ENOLINE, EPROLOOO, EPROLREP, - EBADSEC, + EBADMSEC, EFONT, EBADDATE, ENUMFMT, diff --git a/usr.bin/mandoc/mdoc.7 b/usr.bin/mandoc/mdoc.7 index 03caa9d3b92..9f7ceb93e85 100644 --- a/usr.bin/mandoc/mdoc.7 +++ b/usr.bin/mandoc/mdoc.7 @@ -1,4 +1,4 @@ -.\" $Id: mdoc.7,v 1.30 2010/05/15 16:48:12 schwarze Exp $ +.\" $Id: mdoc.7,v 1.31 2010/05/15 18:25:50 schwarze Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv> .\" @@ -347,7 +347,7 @@ file: \&.Sh NAME \&.Nm foo \&.Nd a description goes here -\&.\e\*q The next is for sections 2 & 3 only. +\&.\e\*q The next is for sections 2, 3, & 9 only. \&.\e\*q .Sh LIBRARY \&. \&.Sh SYNOPSIS @@ -409,7 +409,7 @@ and .Sx \&Nd . .It Em LIBRARY The name of the library containing the documented material, which is -assumed to be a function in a section 2 or 3 manual. +assumed to be a function in a section 2, 3, or 9 manual. The syntax for this is as follows: .Bd -literal -offset indent \&.Lb libarm diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index 99c8b31be28..df6712e1537 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.49 2010/05/15 16:48:12 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.50 2010/05/15 18:25:51 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -64,7 +64,7 @@ const char *const __mdoc_merrnames[MERRMAX] = { "line arguments discouraged", /* ENOLINE */ "prologue macro out of conventional order", /* EPROLOOO */ "prologue macro repeated", /* EPROLREP */ - "invalid section", /* EBADSEC */ + "invalid manual section", /* EBADMSEC */ "invalid font mode", /* EFONT */ "invalid date syntax", /* EBADDATE */ "invalid number format", /* ENUMFMT */ @@ -186,6 +186,8 @@ mdoc_free1(struct mdoc *mdoc) free(mdoc->meta.arch); if (mdoc->meta.vol) free(mdoc->meta.vol); + if (mdoc->meta.msec) + free(mdoc->meta.msec); } diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h index bcd137429e0..31dc068a41f 100644 --- a/usr.bin/mandoc/mdoc.h +++ b/usr.bin/mandoc/mdoc.h @@ -1,4 +1,4 @@ -/* $Id: mdoc.h,v 1.22 2010/05/14 19:52:43 schwarze Exp $ */ +/* $Id: mdoc.h,v 1.23 2010/05/15 18:25:51 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -223,7 +223,7 @@ enum mdoc_sec { /* Information from prologue. */ struct mdoc_meta { - int msec; + char *msec; char *vol; char *arch; time_t date; diff --git a/usr.bin/mandoc/mdoc_action.c b/usr.bin/mandoc/mdoc_action.c index fec0c6cc32f..c3d97413966 100644 --- a/usr.bin/mandoc/mdoc_action.c +++ b/usr.bin/mandoc/mdoc_action.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.34 2010/05/15 16:48:12 schwarze Exp $ */ +/* $Id: mdoc_action.c,v 1.35 2010/05/15 18:25:51 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -442,17 +442,14 @@ post_sh(POST_ARGS) case (SEC_RETURN_VALUES): /* FALLTHROUGH */ case (SEC_ERRORS): - switch (m->meta.msec) { - case (2): - /* FALLTHROUGH */ - case (3): - /* FALLTHROUGH */ - case (9): + assert(m->meta.msec); + if (*m->meta.msec == '2') break; - default: - return(mdoc_nwarn(m, n, EBADSEC)); - } - break; + if (*m->meta.msec == '3') + break; + if (*m->meta.msec == '9') + break; + return(mdoc_nwarn(m, n, EWRONGMSEC)); default: break; } @@ -469,8 +466,6 @@ post_dt(POST_ARGS) { struct mdoc_node *nn; const char *cp; - char *ep; - long lval; if (m->meta.title) free(m->meta.title); @@ -480,16 +475,16 @@ post_dt(POST_ARGS) free(m->meta.arch); m->meta.title = m->meta.vol = m->meta.arch = NULL; - m->meta.msec = 0; - /* Handles: `.Dt' * --> title = unknown, volume = local, msec = 0, arch = NULL */ if (NULL == (nn = n->child)) { /* XXX: make these macro values. */ + /* FIXME: warn about missing values. */ m->meta.title = mandoc_strdup("unknown"); m->meta.vol = mandoc_strdup("local"); + m->meta.msec = mandoc_strdup("1"); return(post_prol(m, n)); } @@ -500,8 +495,10 @@ post_dt(POST_ARGS) m->meta.title = mandoc_strdup(nn->string); if (NULL == (nn = nn->next)) { + /* FIXME: warn about missing msec. */ /* XXX: make this a macro value. */ m->meta.vol = mandoc_strdup("local"); + m->meta.msec = mandoc_strdup("1"); return(post_prol(m, n)); } @@ -514,13 +511,13 @@ post_dt(POST_ARGS) cp = mdoc_a2msec(nn->string); if (cp) { - /* FIXME: where is strtonum!? */ m->meta.vol = mandoc_strdup(cp); - lval = strtol(nn->string, &ep, 10); - if (nn->string[0] != '\0' && *ep == '\0') - m->meta.msec = (int)lval; - } else + m->meta.msec = mandoc_strdup(nn->string); + } else if (mdoc_nwarn(m, n, EBADMSEC)) { m->meta.vol = mandoc_strdup(nn->string); + m->meta.msec = mandoc_strdup(nn->string); + } else + return(0); if (NULL == (nn = nn->next)) return(post_prol(m, n)); @@ -537,6 +534,7 @@ post_dt(POST_ARGS) free(m->meta.vol); m->meta.vol = mandoc_strdup(cp); } else { + /* FIXME: warn about bad arch. */ cp = mdoc_a2arch(nn->string); if (NULL == cp) { free(m->meta.vol); diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 60f1416c8f7..1915d571598 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.14 2010/05/14 19:52:43 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.15 2010/05/15 18:25:51 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -383,7 +383,7 @@ print_mdoc_head(MDOC_ARGS) print_gen_head(h); bufinit(h); - buffmt(h, "%s(%d)", m->title, m->msec); + buffmt(h, "%s(%s)", m->title, m->msec); if (m->arch) { bufcat(h, " ("); @@ -505,7 +505,7 @@ mdoc_root_pre(MDOC_ARGS) } (void)snprintf(title, BUFSIZ - 1, - "%s(%d)", m->title, m->msec); + "%s(%s)", m->title, m->msec); /* XXX: see note in mdoc_root_post() about divs. */ diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index f44374761c4..4c828cd1d7f 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.78 2010/05/14 19:52:43 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.79 2010/05/15 18:25:51 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -422,7 +422,7 @@ print_mdoc_head(DECL_ARGS) strlcat(buf, ")", BUFSIZ); } - snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec); + snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec); p->offset = 0; p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2; diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 239e16f1f9c..079cf795c42 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.53 2010/05/15 16:48:12 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.54 2010/05/15 18:25:51 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -1236,20 +1236,19 @@ post_sh_head(POST_ARGS) /* * Check particular section/manual conventions. LIBRARY can - * only occur in msec 2, 3 (TODO: are there more of these?). + * only occur in manual section 2, 3, and 9. */ switch (sec) { case (SEC_LIBRARY): - switch (mdoc->meta.msec) { - case (2): - /* FALLTHROUGH */ - case (3): + assert(mdoc->meta.msec); + if (*mdoc->meta.msec == '2') break; - default: - return(mdoc_nwarn(mdoc, mdoc->last, EWRONGMSEC)); - } - break; + if (*mdoc->meta.msec == '3') + break; + if (*mdoc->meta.msec == '9') + break; + return(mdoc_nwarn(mdoc, mdoc->last, EWRONGMSEC)); default: break; } |