version 1.279, 2015/02/14 13:23:57 |
version 1.284, 2015/04/02 21:36:50 |
|
|
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
* copyright notice and this permission notice appear in all copies. |
* copyright notice and this permission notice appear in all copies. |
* |
* |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
|
#include <string.h> |
#include <string.h> |
#include <time.h> |
#include <time.h> |
|
|
#include "mdoc.h" |
|
#include "mandoc.h" |
|
#include "mandoc_aux.h" |
#include "mandoc_aux.h" |
#include "libmdoc.h" |
#include "mandoc.h" |
|
#include "roff.h" |
|
#include "mdoc.h" |
#include "libmandoc.h" |
#include "libmandoc.h" |
|
#include "libmdoc.h" |
|
|
/* FIXME: .Bl -diag can't have non-text children in HEAD. */ |
/* FIXME: .Bl -diag can't have non-text children in HEAD. */ |
|
|
Line 297 mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n) |
|
Line 298 mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n) |
|
v_pre p; |
v_pre p; |
|
|
switch (n->type) { |
switch (n->type) { |
case MDOC_TEXT: |
case ROFFT_TEXT: |
if (n->sec != SEC_SYNOPSIS || n->parent->tok != MDOC_Fd) |
if (n->sec != SEC_SYNOPSIS || n->parent->tok != MDOC_Fd) |
check_text(mdoc, n->line, n->pos, n->string); |
check_text(mdoc, n->line, n->pos, n->string); |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case MDOC_TBL: |
case ROFFT_TBL: |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case MDOC_EQN: |
case ROFFT_EQN: |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case MDOC_ROOT: |
case ROFFT_ROOT: |
return; |
return; |
default: |
default: |
break; |
break; |
Line 329 mdoc_valid_post(struct mdoc *mdoc) |
|
Line 330 mdoc_valid_post(struct mdoc *mdoc) |
|
n->flags |= MDOC_VALID | MDOC_ENDED; |
n->flags |= MDOC_VALID | MDOC_ENDED; |
|
|
switch (n->type) { |
switch (n->type) { |
case MDOC_TEXT: |
case ROFFT_TEXT: |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case MDOC_EQN: |
case ROFFT_EQN: |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case MDOC_TBL: |
case ROFFT_TBL: |
break; |
break; |
case MDOC_ROOT: |
case ROFFT_ROOT: |
post_root(mdoc); |
post_root(mdoc); |
break; |
break; |
default: |
default: |
Line 400 pre_display(PRE_ARGS) |
|
Line 401 pre_display(PRE_ARGS) |
|
{ |
{ |
struct mdoc_node *node; |
struct mdoc_node *node; |
|
|
if (MDOC_BLOCK != n->type) |
if (n->type != ROFFT_BLOCK) |
return; |
return; |
|
|
for (node = mdoc->last->parent; node; node = node->parent) |
for (node = mdoc->last->parent; node; node = node->parent) |
if (MDOC_BLOCK == node->type) |
if (node->type == ROFFT_BLOCK) |
if (MDOC_Bd == node->tok) |
if (MDOC_Bd == node->tok) |
break; |
break; |
|
|
Line 422 pre_bl(PRE_ARGS) |
|
Line 423 pre_bl(PRE_ARGS) |
|
enum mdocargt mdoclt; |
enum mdocargt mdoclt; |
enum mdoc_list lt; |
enum mdoc_list lt; |
|
|
if (n->type != MDOC_BLOCK) |
if (n->type != ROFFT_BLOCK) |
return; |
return; |
|
|
/* |
/* |
Line 605 pre_bd(PRE_ARGS) |
|
Line 606 pre_bd(PRE_ARGS) |
|
|
|
pre_literal(mdoc, n); |
pre_literal(mdoc, n); |
|
|
if (n->type != MDOC_BLOCK) |
if (n->type != ROFFT_BLOCK) |
return; |
return; |
|
|
for (i = 0; n->args && i < (int)n->args->argc; i++) { |
for (i = 0; n->args && i < (int)n->args->argc; i++) { |
|
|
pre_obsolete(PRE_ARGS) |
pre_obsolete(PRE_ARGS) |
{ |
{ |
|
|
if (MDOC_ELEM == n->type || MDOC_BLOCK == n->type) |
if (n->type == ROFFT_ELEM || n->type == ROFFT_BLOCK) |
mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse, |
mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse, |
n->line, n->pos, mdoc_macronames[n->tok]); |
n->line, n->pos, mdoc_macronames[n->tok]); |
} |
} |
Line 777 post_bf(POST_ARGS) |
|
Line 778 post_bf(POST_ARGS) |
|
*/ |
*/ |
|
|
np = mdoc->last; |
np = mdoc->last; |
if (MDOC_HEAD != np->type) |
if (np->type != ROFFT_HEAD) |
return; |
return; |
|
|
assert(MDOC_BLOCK == np->parent->type); |
assert(np->parent->type == ROFFT_BLOCK); |
assert(MDOC_Bf == np->parent->tok); |
assert(MDOC_Bf == np->parent->tok); |
|
|
/* Check the number of arguments. */ |
/* Check the number of arguments. */ |
Line 835 post_lb(POST_ARGS) |
|
Line 836 post_lb(POST_ARGS) |
|
char *libname; |
char *libname; |
|
|
n = mdoc->last->child; |
n = mdoc->last->child; |
assert(MDOC_TEXT == n->type); |
assert(n->type == ROFFT_TEXT); |
|
|
if (NULL == (stdlibname = mdoc_a2lib(n->string))) |
if (NULL == (stdlibname = mdoc_a2lib(n->string))) |
mandoc_asprintf(&libname, |
mandoc_asprintf(&libname, |
"library \\(lq%s\\(rq", n->string); |
"library \\(Lq%s\\(Rq", n->string); |
else |
else |
libname = mandoc_strdup(stdlibname); |
libname = mandoc_strdup(stdlibname); |
|
|
Line 890 post_fo(POST_ARGS) |
|
Line 891 post_fo(POST_ARGS) |
|
|
|
n = mdoc->last; |
n = mdoc->last; |
|
|
if (n->type != MDOC_HEAD) |
if (n->type != ROFFT_HEAD) |
return; |
return; |
|
|
if (n->child == NULL) { |
if (n->child == NULL) { |
Line 943 post_vt(POST_ARGS) |
|
Line 944 post_vt(POST_ARGS) |
|
* specifically the BODY, should only have TEXT children. |
* specifically the BODY, should only have TEXT children. |
*/ |
*/ |
|
|
if (MDOC_BODY != mdoc->last->type) |
if (mdoc->last->type != ROFFT_BODY) |
return; |
return; |
|
|
for (n = mdoc->last->child; n; n = n->next) |
for (n = mdoc->last->child; n; n = n->next) |
if (MDOC_TEXT != n->type) |
if (n->type != ROFFT_TEXT) |
mandoc_msg(MANDOCERR_VT_CHILD, mdoc->parse, |
mandoc_msg(MANDOCERR_VT_CHILD, mdoc->parse, |
n->line, n->pos, mdoc_macronames[n->tok]); |
n->line, n->pos, mdoc_macronames[n->tok]); |
} |
} |
Line 981 post_nd(POST_ARGS) |
|
Line 982 post_nd(POST_ARGS) |
|
|
|
n = mdoc->last; |
n = mdoc->last; |
|
|
if (n->type != MDOC_BODY) |
if (n->type != ROFFT_BODY) |
return; |
return; |
|
|
if (n->child == NULL) |
if (n->child == NULL) |
Line 998 post_d1(POST_ARGS) |
|
Line 999 post_d1(POST_ARGS) |
|
|
|
n = mdoc->last; |
n = mdoc->last; |
|
|
if (n->type != MDOC_BODY) |
if (n->type != ROFFT_BODY) |
return; |
return; |
|
|
if (n->child == NULL) |
if (n->child == NULL) |
Line 1015 post_literal(POST_ARGS) |
|
Line 1016 post_literal(POST_ARGS) |
|
|
|
n = mdoc->last; |
n = mdoc->last; |
|
|
if (n->type != MDOC_BODY) |
if (n->type != ROFFT_BODY) |
return; |
return; |
|
|
if (n->child == NULL) |
if (n->child == NULL) |
Line 1086 post_at(POST_ARGS) |
|
Line 1087 post_at(POST_ARGS) |
|
*/ |
*/ |
|
|
n = n->child; |
n = n->child; |
assert(MDOC_TEXT == n->type); |
assert(n->type == ROFFT_TEXT); |
if (NULL == (std_att = mdoc_a2att(n->string))) { |
if (NULL == (std_att = mdoc_a2att(n->string))) { |
mandoc_vmsg(MANDOCERR_AT_BAD, mdoc->parse, |
mandoc_vmsg(MANDOCERR_AT_BAD, mdoc->parse, |
n->line, n->pos, "At %s", n->string); |
n->line, n->pos, "At %s", n->string); |
|
|
post_en(POST_ARGS) |
post_en(POST_ARGS) |
{ |
{ |
|
|
if (MDOC_BLOCK == mdoc->last->type) |
if (mdoc->last->type == ROFFT_BLOCK) |
mdoc->last->norm->Es = mdoc->last_es; |
mdoc->last->norm->Es = mdoc->last_es; |
} |
} |
|
|
Line 1137 post_it(POST_ARGS) |
|
Line 1138 post_it(POST_ARGS) |
|
struct mdoc_node *nbl, *nit, *nch; |
struct mdoc_node *nbl, *nit, *nch; |
|
|
nit = mdoc->last; |
nit = mdoc->last; |
if (nit->type != MDOC_BLOCK) |
if (nit->type != ROFFT_BLOCK) |
return; |
return; |
|
|
nbl = nit->parent->parent; |
nbl = nit->parent->parent; |
Line 1184 post_it(POST_ARGS) |
|
Line 1185 post_it(POST_ARGS) |
|
assert(nit->head->child == NULL); |
assert(nit->head->child == NULL); |
|
|
for (i = 0, nch = nit->child; nch; nch = nch->next) |
for (i = 0, nch = nit->child; nch; nch = nch->next) |
if (nch->type == MDOC_BODY) |
if (nch->type == ROFFT_BODY) |
i++; |
i++; |
|
|
if (i < cols || i > cols + 1) |
if (i < cols || i > cols + 1) |
Line 1298 post_bl_block_tag(POST_ARGS) |
|
Line 1299 post_bl_block_tag(POST_ARGS) |
|
if (MDOC_It != nn->tok) |
if (MDOC_It != nn->tok) |
continue; |
continue; |
|
|
assert(MDOC_BLOCK == nn->type); |
assert(nn->type == ROFFT_BLOCK); |
nn = nn->head->child; |
nn = nn->head->child; |
|
|
if (nn == NULL) |
if (nn == NULL) |
break; |
break; |
|
|
if (MDOC_TEXT == nn->type) { |
if (nn->type == ROFFT_TEXT) { |
sz = strlen(nn->string) + 1; |
sz = strlen(nn->string) + 1; |
break; |
break; |
} |
} |
Line 1412 post_bl(POST_ARGS) |
|
Line 1413 post_bl(POST_ARGS) |
|
|
|
nbody = mdoc->last; |
nbody = mdoc->last; |
switch (nbody->type) { |
switch (nbody->type) { |
case MDOC_BLOCK: |
case ROFFT_BLOCK: |
post_bl_block(mdoc); |
post_bl_block(mdoc); |
return; |
return; |
case MDOC_HEAD: |
case ROFFT_HEAD: |
post_bl_head(mdoc); |
post_bl_head(mdoc); |
return; |
return; |
case MDOC_BODY: |
case ROFFT_BODY: |
break; |
break; |
default: |
default: |
return; |
return; |
Line 1493 post_bk(POST_ARGS) |
|
Line 1494 post_bk(POST_ARGS) |
|
|
|
n = mdoc->last; |
n = mdoc->last; |
|
|
if (n->type == MDOC_BLOCK && n->body->child == NULL) { |
if (n->type == ROFFT_BLOCK && n->body->child == NULL) { |
mandoc_msg(MANDOCERR_BLK_EMPTY, |
mandoc_msg(MANDOCERR_BLK_EMPTY, |
mdoc->parse, n->line, n->pos, "Bk"); |
mdoc->parse, n->line, n->pos, "Bk"); |
mdoc_node_delete(mdoc, n); |
mdoc_node_delete(mdoc, n); |
Line 1512 post_sm(struct mdoc *mdoc) |
|
Line 1513 post_sm(struct mdoc *mdoc) |
|
return; |
return; |
} |
} |
|
|
assert(nch->type == MDOC_TEXT); |
assert(nch->type == ROFFT_TEXT); |
|
|
if ( ! strcmp(nch->string, "on")) { |
if ( ! strcmp(nch->string, "on")) { |
mdoc->flags &= ~MDOC_SMOFF; |
mdoc->flags &= ~MDOC_SMOFF; |
Line 1579 post_st(POST_ARGS) |
|
Line 1580 post_st(POST_ARGS) |
|
n = mdoc->last; |
n = mdoc->last; |
nch = n->child; |
nch = n->child; |
|
|
assert(MDOC_TEXT == nch->type); |
assert(nch->type == ROFFT_TEXT); |
|
|
if (NULL == (p = mdoc_a2st(nch->string))) { |
if (NULL == (p = mdoc_a2st(nch->string))) { |
mandoc_vmsg(MANDOCERR_ST_BAD, mdoc->parse, |
mandoc_vmsg(MANDOCERR_ST_BAD, mdoc->parse, |
Line 1599 post_rs(POST_ARGS) |
|
Line 1600 post_rs(POST_ARGS) |
|
|
|
np = mdoc->last; |
np = mdoc->last; |
|
|
if (np->type != MDOC_BODY) |
if (np->type != ROFFT_BODY) |
return; |
return; |
|
|
if (np->child == NULL) { |
if (np->child == NULL) { |
Line 1692 post_hyph(POST_ARGS) |
|
Line 1693 post_hyph(POST_ARGS) |
|
char *cp; |
char *cp; |
|
|
for (nch = mdoc->last->child; nch != NULL; nch = nch->next) { |
for (nch = mdoc->last->child; nch != NULL; nch = nch->next) { |
if (nch->type != MDOC_TEXT) |
if (nch->type != ROFFT_TEXT) |
continue; |
continue; |
cp = nch->string; |
cp = nch->string; |
if (*cp == '\0') |
if (*cp == '\0') |
Line 1721 post_sh(POST_ARGS) |
|
Line 1722 post_sh(POST_ARGS) |
|
post_ignpar(mdoc); |
post_ignpar(mdoc); |
|
|
switch (mdoc->last->type) { |
switch (mdoc->last->type) { |
case MDOC_HEAD: |
case ROFFT_HEAD: |
post_sh_head(mdoc); |
post_sh_head(mdoc); |
break; |
break; |
case MDOC_BODY: |
case ROFFT_BODY: |
switch (mdoc->lastsec) { |
switch (mdoc->lastsec) { |
case SEC_NAME: |
case SEC_NAME: |
post_sh_name(mdoc); |
post_sh_name(mdoc); |
|
|
post_sh_name(POST_ARGS) |
post_sh_name(POST_ARGS) |
{ |
{ |
struct mdoc_node *n; |
struct mdoc_node *n; |
|
int hasnm, hasnd; |
|
|
/* |
hasnm = hasnd = 0; |
* Warn if the NAME section doesn't contain the `Nm' and `Nd' |
|
* macros (can have multiple `Nm' and one `Nd'). Note that the |
|
* children of the BODY declaration can also be "text". |
|
*/ |
|
|
|
if (NULL == (n = mdoc->last->child)) { |
for (n = mdoc->last->child; n != NULL; n = n->next) { |
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
switch (n->tok) { |
mdoc->last->line, mdoc->last->pos, "empty"); |
case MDOC_Nm: |
return; |
hasnm = 1; |
|
break; |
|
case MDOC_Nd: |
|
hasnd = 1; |
|
if (n->next != NULL) |
|
mandoc_msg(MANDOCERR_NAMESEC_ND, |
|
mdoc->parse, n->line, n->pos, NULL); |
|
break; |
|
case MDOC_MAX: |
|
if (hasnm) |
|
break; |
|
/* FALLTHROUGH */ |
|
default: |
|
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
|
n->line, n->pos, mdoc_macronames[n->tok]); |
|
break; |
|
} |
} |
} |
|
|
for ( ; n && n->next; n = n->next) { |
if ( ! hasnm) |
if (MDOC_ELEM == n->type && MDOC_Nm == n->tok) |
mandoc_msg(MANDOCERR_NAMESEC_NONM, mdoc->parse, |
continue; |
mdoc->last->line, mdoc->last->pos, NULL); |
if (MDOC_TEXT == n->type) |
if ( ! hasnd) |
continue; |
mandoc_msg(MANDOCERR_NAMESEC_NOND, mdoc->parse, |
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
mdoc->last->line, mdoc->last->pos, NULL); |
n->line, n->pos, mdoc_macronames[n->tok]); |
|
} |
|
|
|
assert(n); |
|
if (MDOC_BLOCK == n->type && MDOC_Nd == n->tok) |
|
return; |
|
|
|
mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse, |
|
n->line, n->pos, mdoc_macronames[n->tok]); |
|
} |
} |
|
|
static void |
static void |
Line 1826 post_sh_see_also(POST_ARGS) |
|
Line 1831 post_sh_see_also(POST_ARGS) |
|
lastpunct = "none"; |
lastpunct = "none"; |
continue; |
continue; |
} |
} |
if (n->type != MDOC_TEXT) |
if (n->type != ROFFT_TEXT) |
break; |
break; |
for (name = n->string; *name != '\0'; name++) |
for (name = n->string; *name != '\0'; name++) |
if (isalpha((const unsigned char)*name)) |
if (isalpha((const unsigned char)*name)) |
Line 1985 post_ignpar(POST_ARGS) |
|
Line 1990 post_ignpar(POST_ARGS) |
|
struct mdoc_node *np; |
struct mdoc_node *np; |
|
|
switch (mdoc->last->type) { |
switch (mdoc->last->type) { |
case MDOC_HEAD: |
case ROFFT_HEAD: |
post_hyph(mdoc); |
post_hyph(mdoc); |
return; |
return; |
case MDOC_BODY: |
case ROFFT_BODY: |
break; |
break; |
default: |
default: |
return; |
return; |
Line 2019 pre_par(PRE_ARGS) |
|
Line 2024 pre_par(PRE_ARGS) |
|
|
|
if (NULL == mdoc->last) |
if (NULL == mdoc->last) |
return; |
return; |
if (MDOC_ELEM != n->type && MDOC_BLOCK != n->type) |
if (n->type != ROFFT_ELEM && n->type != ROFFT_BLOCK) |
return; |
return; |
|
|
/* |
/* |
Line 2084 pre_literal(PRE_ARGS) |
|
Line 2089 pre_literal(PRE_ARGS) |
|
|
|
pre_display(mdoc, n); |
pre_display(mdoc, n); |
|
|
if (MDOC_BODY != n->type) |
if (n->type != ROFFT_BODY) |
return; |
return; |
|
|
/* |
/* |
Line 2156 post_dt(POST_ARGS) |
|
Line 2161 post_dt(POST_ARGS) |
|
mdoc->meta.vol = NULL; |
mdoc->meta.vol = NULL; |
mdoc->meta.arch = NULL; |
mdoc->meta.arch = NULL; |
|
|
/* First check that all characters are uppercase. */ |
/* Mandatory first argument: title. */ |
|
|
if (NULL != (nn = n->child)) |
nn = n->child; |
for (p = nn->string; *p; p++) { |
if (nn == NULL || *nn->string == '\0') { |
if (toupper((unsigned char)*p) == *p) |
|
continue; |
|
mandoc_vmsg(MANDOCERR_TITLE_CASE, |
|
mdoc->parse, nn->line, |
|
nn->pos + (p - nn->string), |
|
"Dt %s", nn->string); |
|
break; |
|
} |
|
|
|
/* No argument: msec and arch remain NULL. */ |
|
|
|
if (NULL == (nn = n->child)) { |
|
mandoc_msg(MANDOCERR_DT_NOTITLE, |
mandoc_msg(MANDOCERR_DT_NOTITLE, |
mdoc->parse, n->line, n->pos, "Dt"); |
mdoc->parse, n->line, n->pos, "Dt"); |
mdoc->meta.title = mandoc_strdup("UNTITLED"); |
mdoc->meta.title = mandoc_strdup("UNTITLED"); |
mdoc->meta.vol = mandoc_strdup("LOCAL"); |
} else { |
goto out; |
mdoc->meta.title = mandoc_strdup(nn->string); |
|
|
|
/* Check that all characters are uppercase. */ |
|
|
|
for (p = nn->string; *p != '\0'; p++) |
|
if (islower((unsigned char)*p)) { |
|
mandoc_vmsg(MANDOCERR_TITLE_CASE, |
|
mdoc->parse, nn->line, |
|
nn->pos + (p - nn->string), |
|
"Dt %s", nn->string); |
|
break; |
|
} |
} |
} |
|
|
/* One argument: msec and arch remain NULL. */ |
/* Mandatory second argument: section. */ |
|
|
mdoc->meta.title = mandoc_strdup( |
if (nn != NULL) |
'\0' == nn->string[0] ? "UNTITLED" : nn->string); |
nn = nn->next; |
|
|
if (NULL == (nn = nn->next)) { |
if (nn == NULL) { |
mandoc_vmsg(MANDOCERR_MSEC_MISSING, |
mandoc_vmsg(MANDOCERR_MSEC_MISSING, |
mdoc->parse, n->line, n->pos, |
mdoc->parse, n->line, n->pos, |
"Dt %s", mdoc->meta.title); |
"Dt %s", mdoc->meta.title); |
mdoc->meta.vol = mandoc_strdup("LOCAL"); |
mdoc->meta.vol = mandoc_strdup("LOCAL"); |
goto out; |
goto out; /* msec and arch remain NULL. */ |
} |
} |
|
|
/* Handles: `.Dt TITLE SEC' |
mdoc->meta.msec = mandoc_strdup(nn->string); |
* title = TITLE, |
|
* volume = SEC is msec ? format(msec) : SEC, |
|
* msec = SEC is msec ? atoi(msec) : 0, |
|
* arch = NULL |
|
*/ |
|
|
|
|
/* Infer volume title from section number. */ |
|
|
cp = mandoc_a2msec(nn->string); |
cp = mandoc_a2msec(nn->string); |
if (cp) { |
if (cp == NULL) { |
mdoc->meta.vol = mandoc_strdup(cp); |
|
mdoc->meta.msec = mandoc_strdup(nn->string); |
|
} else { |
|
mandoc_vmsg(MANDOCERR_MSEC_BAD, mdoc->parse, |
mandoc_vmsg(MANDOCERR_MSEC_BAD, mdoc->parse, |
nn->line, nn->pos, "Dt ... %s", nn->string); |
nn->line, nn->pos, "Dt ... %s", nn->string); |
mdoc->meta.vol = mandoc_strdup(nn->string); |
mdoc->meta.vol = mandoc_strdup(nn->string); |
mdoc->meta.msec = mandoc_strdup(nn->string); |
} else |
} |
mdoc->meta.vol = mandoc_strdup(cp); |
|
|
/* Handle an optional architecture */ |
/* Optional third argument: architecture. */ |
|
|
if ((nn = nn->next) != NULL) { |
if ((nn = nn->next) == NULL) |
for (p = nn->string; *p; p++) |
goto out; |
*p = tolower((unsigned char)*p); |
|
mdoc->meta.arch = mandoc_strdup(nn->string); |
|
} |
|
|
|
/* Ignore any subsequent parameters... */ |
for (p = nn->string; *p != '\0'; p++) |
/* FIXME: warn about subsequent parameters. */ |
*p = tolower((unsigned char)*p); |
|
mdoc->meta.arch = mandoc_strdup(nn->string); |
|
|
|
/* Ignore fourth and later arguments. */ |
|
|
|
if ((nn = nn->next) != NULL) |
|
mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse, |
|
nn->line, nn->pos, "Dt ... %s", nn->string); |
|
|
out: |
out: |
mdoc_node_delete(mdoc, n); |
mdoc_node_delete(mdoc, n); |
} |
} |