summaryrefslogtreecommitdiffstats
path: root/mdoc_action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-15 16:24:37 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-15 16:24:37 +0000
commit2f01ab1363bf6ab718b3fb6370fc6735e3e8bc02 (patch)
treec8023c62b35846d97b0c170d0fc13e02159140a7 /mdoc_action.c
parent6e9d908aceac4cb4aaf9a8d2bdeab9efea064b7b (diff)
downloadmandoc-2f01ab1363bf6ab718b3fb6370fc6735e3e8bc02.tar.gz
LIBRARY can also occur in section 9.
All manual sections (unknown, 3p, 3f, etc.) correctly handled by -mdoc. Useful warning printed if unknown manual section. Checking for manual sections (e.g., LIBRARY) checks only first character, so 3p, 3f, etc. are free.
Diffstat (limited to 'mdoc_action.c')
-rw-r--r--mdoc_action.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/mdoc_action.c b/mdoc_action.c
index 9d2a3420..cb949df6 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -446,17 +446,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;
}
@@ -473,8 +470,6 @@ post_dt(POST_ARGS)
{
struct mdoc_node *nn;
const char *cp;
- char *ep;
- long lval;
if (m->meta.title)
free(m->meta.title);
@@ -484,16 +479,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));
}
@@ -504,8 +499,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));
}
@@ -518,13 +515,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));
@@ -541,6 +538,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);