summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/man.c22
-rw-r--r--usr.bin/mandoc/man_hash.c12
-rw-r--r--usr.bin/mandoc/man_term.c4
-rw-r--r--usr.bin/mandoc/man_validate.c4
-rw-r--r--usr.bin/mandoc/mdoc.c21
-rw-r--r--usr.bin/mandoc/mdoc_argv.c4
-rw-r--r--usr.bin/mandoc/mdoc_hash.c12
-rw-r--r--usr.bin/mandoc/mdoc_macro.c37
-rw-r--r--usr.bin/mandoc/mdoc_validate.c6
-rw-r--r--usr.bin/mandoc/read.c11
-rw-r--r--usr.bin/mandoc/roff.h3
11 files changed, 68 insertions, 68 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index ba171ea5dc3..52d7497c1d6 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man.c,v 1.106 2015/04/19 13:50:10 schwarze Exp $ */
+/* $OpenBSD: man.c,v 1.107 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -98,7 +98,7 @@ man_word_alloc(struct roff_man *man, int line, int pos, const char *word)
{
struct roff_node *n;
- n = roff_node_alloc(man, line, pos, ROFFT_TEXT, MAN_MAX);
+ n = roff_node_alloc(man, line, pos, ROFFT_TEXT, TOKEN_NONE);
n->string = roff_strdup(man->roff, word);
roff_node_append(man, n);
man_valid_post(man);
@@ -125,7 +125,7 @@ man_addeqn(struct roff_man *man, const struct eqn *ep)
{
struct roff_node *n;
- n = roff_node_alloc(man, ep->ln, ep->pos, ROFFT_EQN, MAN_MAX);
+ n = roff_node_alloc(man, ep->ln, ep->pos, ROFFT_EQN, TOKEN_NONE);
n->eqn = ep;
if (ep->ln > man->last->line)
n->flags |= MAN_LINE;
@@ -139,8 +139,8 @@ man_addspan(struct roff_man *man, const struct tbl_span *sp)
{
struct roff_node *n;
- man_breakscope(man, MAN_MAX);
- n = roff_node_alloc(man, sp->line, 0, ROFFT_TBL, MAN_MAX);
+ man_breakscope(man, TOKEN_NONE);
+ n = roff_node_alloc(man, sp->line, 0, ROFFT_TBL, TOKEN_NONE);
n->span = sp;
roff_node_append(man, n);
man_valid_post(man);
@@ -259,9 +259,9 @@ man_pmacro(struct roff_man *man, int ln, char *buf, int offs)
mac[i] = '\0';
- tok = (i > 0 && i < 4) ? man_hash_find(mac) : MAN_MAX;
+ tok = (i > 0 && i < 4) ? man_hash_find(mac) : TOKEN_NONE;
- if (tok == MAN_MAX) {
+ if (tok == TOKEN_NONE) {
mandoc_msg(MANDOCERR_MACRO, man->parse,
ln, ppos, buf + ppos - 1);
return(1);
@@ -347,7 +347,7 @@ man_breakscope(struct roff_man *man, int tok)
* Delete the element that is being broken.
*/
- if (man->flags & MAN_ELINE && (tok == MAN_MAX ||
+ if (man->flags & MAN_ELINE && (tok == TOKEN_NONE ||
! (man_macros[tok].flags & MAN_NSCOPED))) {
n = man->last;
assert(n->type != ROFFT_TEXT);
@@ -356,7 +356,7 @@ man_breakscope(struct roff_man *man, int tok)
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
n->line, n->pos, "%s breaks %s",
- tok == MAN_MAX ? "TS" : man_macronames[tok],
+ tok == TOKEN_NONE ? "TS" : man_macronames[tok],
man_macronames[n->tok]);
roff_node_delete(man, n);
@@ -369,7 +369,7 @@ man_breakscope(struct roff_man *man, int tok)
* Delete the block that is being broken.
*/
- if (man->flags & MAN_BLINE && (tok == MAN_MAX ||
+ if (man->flags & MAN_BLINE && (tok == TOKEN_NONE ||
man_macros[tok].flags & MAN_BSCOPE)) {
n = man->last;
if (n->type == ROFFT_TEXT)
@@ -384,7 +384,7 @@ man_breakscope(struct roff_man *man, int tok)
mandoc_vmsg(MANDOCERR_BLK_LINE, man->parse,
n->line, n->pos, "%s breaks %s",
- tok == MAN_MAX ? "TS" : man_macronames[tok],
+ tok == TOKEN_NONE ? "TS" : man_macronames[tok],
man_macronames[n->tok]);
roff_node_delete(man, n);
diff --git a/usr.bin/mandoc/man_hash.c b/usr.bin/mandoc/man_hash.c
index 6d6f780cc29..5e6d90020cb 100644
--- a/usr.bin/mandoc/man_hash.c
+++ b/usr.bin/mandoc/man_hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_hash.c,v 1.22 2015/04/18 17:01:28 schwarze Exp $ */
+/* $OpenBSD: man_hash.c,v 1.23 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -55,8 +55,6 @@ man_hash_init(void)
memset(table, UCHAR_MAX, sizeof(table));
- assert(MAN_MAX < UCHAR_MAX);
-
for (i = 0; i < (int)MAN_MAX; i++) {
x = man_macronames[i][0];
@@ -81,20 +79,20 @@ man_hash_find(const char *tmp)
int tok;
if ('\0' == (x = tmp[0]))
- return(MAN_MAX);
+ return(TOKEN_NONE);
if ( ! (isalpha((unsigned char)x)))
- return(MAN_MAX);
+ return(TOKEN_NONE);
HASH_ROW(x);
for (i = 0; i < HASH_DEPTH; i++) {
if (UCHAR_MAX == (y = table[x + i]))
- return(MAN_MAX);
+ return(TOKEN_NONE);
tok = y;
if (0 == strcmp(tmp, man_macronames[tok]))
return(tok);
}
- return(MAN_MAX);
+ return(TOKEN_NONE);
}
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index a0cec2a8ad2..46547750118 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_term.c,v 1.134 2015/04/18 17:50:02 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.135 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -754,7 +754,7 @@ pre_SS(DECL_ARGS)
do {
n = n->prev;
- } while (n != NULL && n->tok != MAN_MAX &&
+ } while (n != NULL && n->tok != TOKEN_NONE &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
break;
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index c5c76b36604..6d5d7be8722 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_validate.c,v 1.89 2015/04/19 13:50:10 schwarze Exp $ */
+/* $OpenBSD: man_validate.c,v 1.90 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -503,7 +503,7 @@ post_vs(CHKARGS)
"%s after %s", man_macronames[n->tok],
man_macronames[n->parent->tok]);
/* FALLTHROUGH */
- case MAN_MAX:
+ case TOKEN_NONE:
/*
* Don't warn about this because it occurs in pod2man
* and would cause considerable (unfixable) warnage.
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 9aa172be462..44890cd3e7b 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc.c,v 1.136 2015/04/19 13:50:10 schwarze Exp $ */
+/* $OpenBSD: mdoc.c,v 1.137 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -34,6 +34,7 @@
#include "libmdoc.h"
const char *const __mdoc_macronames[MDOC_MAX + 1] = {
+ "text",
"Ap", "Dd", "Dt", "Os",
"Sh", "Ss", "Pp", "D1",
"Dl", "Bd", "Ed", "Bl",
@@ -64,8 +65,8 @@ const char *const __mdoc_macronames[MDOC_MAX + 1] = {
"Lk", "Mt", "Brq", "Bro",
"Brc", "%C", "Es", "En",
"Dx", "%Q", "br", "sp",
- "%U", "Ta", "ll", "text",
- };
+ "%U", "Ta", "ll",
+};
const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
"split", "nosplit", "ragged",
@@ -79,7 +80,7 @@ const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
"symbolic", "nested", "centered"
};
-const char * const *mdoc_macronames = __mdoc_macronames;
+const char * const *mdoc_macronames = __mdoc_macronames + 1;
const char * const *mdoc_argnames = __mdoc_argnames;
static int mdoc_ptext(struct roff_man *, int, char *, int);
@@ -98,7 +99,7 @@ mdoc_addeqn(struct roff_man *mdoc, const struct eqn *ep)
{
struct roff_node *n;
- n = roff_node_alloc(mdoc, ep->ln, ep->pos, ROFFT_EQN, MDOC_MAX);
+ n = roff_node_alloc(mdoc, ep->ln, ep->pos, ROFFT_EQN, TOKEN_NONE);
n->eqn = ep;
if (ep->ln > mdoc->last->line)
n->flags |= MDOC_LINE;
@@ -111,7 +112,7 @@ mdoc_addspan(struct roff_man *mdoc, const struct tbl_span *sp)
{
struct roff_node *n;
- n = roff_node_alloc(mdoc, sp->line, 0, ROFFT_TBL, MDOC_MAX);
+ n = roff_node_alloc(mdoc, sp->line, 0, ROFFT_TBL, TOKEN_NONE);
n->span = sp;
roff_node_append(mdoc, n);
mdoc_valid_post(mdoc);
@@ -148,7 +149,7 @@ mdoc_parseln(struct roff_man *mdoc, int ln, char *buf, int offs)
void
mdoc_macro(MACRO_PROT_ARGS)
{
- assert(tok < MDOC_MAX);
+ assert(tok > TOKEN_NONE && tok < MDOC_MAX);
if (mdoc->flags & MDOC_PBODY) {
if (tok == MDOC_Dt) {
@@ -256,7 +257,7 @@ mdoc_word_alloc(struct roff_man *mdoc, int line, int pos, const char *p)
{
struct roff_node *n;
- n = roff_node_alloc(mdoc, line, pos, ROFFT_TEXT, MDOC_MAX);
+ n = roff_node_alloc(mdoc, line, pos, ROFFT_TEXT, TOKEN_NONE);
n->string = roff_strdup(mdoc->roff, p);
roff_node_append(mdoc, n);
mdoc_valid_post(mdoc);
@@ -428,9 +429,9 @@ mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs)
mac[i] = '\0';
- tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : MDOC_MAX;
+ tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : TOKEN_NONE;
- if (tok == MDOC_MAX) {
+ if (tok == TOKEN_NONE) {
mandoc_msg(MANDOCERR_MACRO, mdoc->parse,
ln, sv, buf + sv - 1);
return(1);
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c
index 7dc6f122db6..8f719383e0f 100644
--- a/usr.bin/mandoc/mdoc_argv.c
+++ b/usr.bin/mandoc/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_argv.c,v 1.59 2015/04/18 16:04:40 schwarze Exp $ */
+/* $OpenBSD: mdoc_argv.c,v 1.60 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -420,7 +420,7 @@ mdoc_args(struct roff_man *mdoc, int line, int *pos,
if (v == NULL)
v = &v_local;
- fl = tok == MDOC_MAX ? ARGSFL_NONE : mdocargs[tok].flags;
+ fl = tok == TOKEN_NONE ? ARGSFL_NONE : mdocargs[tok].flags;
if (tok != MDOC_It)
return(args(mdoc, line, pos, buf, fl, v));
diff --git a/usr.bin/mandoc/mdoc_hash.c b/usr.bin/mandoc/mdoc_hash.c
index 3d0ada9d09a..27752438811 100644
--- a/usr.bin/mandoc/mdoc_hash.c
+++ b/usr.bin/mandoc/mdoc_hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_hash.c,v 1.19 2015/04/18 17:01:28 schwarze Exp $ */
+/* $OpenBSD: mdoc_hash.c,v 1.20 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -65,19 +65,19 @@ mdoc_hash_find(const char *p)
int major, i, j;
if (0 == p[0])
- return(MDOC_MAX);
+ return(TOKEN_NONE);
if ( ! isalpha((unsigned char)p[0]) && '%' != p[0])
- return(MDOC_MAX);
+ return(TOKEN_NONE);
if (isalpha((unsigned char)p[1]))
major = 12 * (tolower((unsigned char)p[1]) - 97);
else if ('1' == p[1])
major = 12 * 26;
else
- return(MDOC_MAX);
+ return(TOKEN_NONE);
if (p[2] && p[3])
- return(MDOC_MAX);
+ return(TOKEN_NONE);
for (j = 0; j < 12; j++) {
if (UCHAR_MAX == (i = table[major + j]))
@@ -86,5 +86,5 @@ mdoc_hash_find(const char *p)
return(i);
}
- return(MDOC_MAX);
+ return(TOKEN_NONE);
}
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index 96717ab3d52..51796931688 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_macro.c,v 1.146 2015/04/19 13:50:10 schwarze Exp $ */
+/* $OpenBSD: mdoc_macro.c,v 1.147 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -230,16 +230,16 @@ mdoc_macroend(struct roff_man *mdoc)
/*
* Look up the macro at *p called by "from",
- * or as a line macro if from == MDOC_MAX.
+ * or as a line macro if from == TOKEN_NONE.
*/
static int
lookup(struct roff_man *mdoc, int from, int line, int ppos, const char *p)
{
int res;
- if (from == MDOC_MAX || mdoc_macros[from].flags & MDOC_PARSED) {
+ if (from == TOKEN_NONE || mdoc_macros[from].flags & MDOC_PARSED) {
res = mdoc_hash_find(p);
- if (res != MDOC_MAX) {
+ if (res != TOKEN_NONE) {
if (mdoc_macros[res].flags & MDOC_CALLABLE)
return(res);
if (res != MDOC_br && res != MDOC_sp && res != MDOC_ll)
@@ -247,7 +247,7 @@ lookup(struct roff_man *mdoc, int from, int line, int ppos, const char *p)
mdoc->parse, line, ppos, p);
}
}
- return(MDOC_MAX);
+ return(TOKEN_NONE);
}
/*
@@ -463,7 +463,8 @@ append_delims(struct roff_man *mdoc, int line, int *pos, char *buf)
for (;;) {
la = *pos;
- if (mdoc_args(mdoc, line, pos, buf, MDOC_MAX, &p) == ARGS_EOLN)
+ if (mdoc_args(mdoc, line, pos, buf, TOKEN_NONE, &p) ==
+ ARGS_EOLN)
break;
dword(mdoc, line, la, p, DELIM_MAX, 1);
@@ -496,21 +497,21 @@ macro_or_word(MACRO_PROT_ARGS, int parsed)
int ntok;
p = buf + ppos;
- ntok = MDOC_MAX;
+ ntok = TOKEN_NONE;
if (*p == '"')
p++;
else if (parsed && ! (mdoc->flags & MDOC_PHRASELIT))
ntok = lookup(mdoc, tok, line, ppos, p);
- if (ntok == MDOC_MAX) {
- dword(mdoc, line, ppos, p, DELIM_MAX, tok == MDOC_MAX ||
+ if (ntok == TOKEN_NONE) {
+ dword(mdoc, line, ppos, p, DELIM_MAX, tok == TOKEN_NONE ||
mdoc_macros[tok].flags & MDOC_JOIN);
return(0);
} else {
if (mdoc_macros[tok].fp == in_line_eoln)
rew_elem(mdoc, tok);
mdoc_macro(mdoc, ntok, line, ppos, pos, buf);
- if (tok == MDOC_MAX)
+ if (tok == TOKEN_NONE)
append_delims(mdoc, line, pos, buf);
return(1);
}
@@ -675,10 +676,10 @@ blk_exp_close(MACRO_PROT_ARGS)
if (ac == ARGS_PUNCT || ac == ARGS_EOLN)
break;
- ntok = ac == ARGS_QWORD ? MDOC_MAX :
+ ntok = ac == ARGS_QWORD ? TOKEN_NONE :
lookup(mdoc, tok, line, lastarg, p);
- if (ntok == MDOC_MAX) {
+ if (ntok == TOKEN_NONE) {
dword(mdoc, line, lastarg, p, DELIM_MAX,
MDOC_JOIN & mdoc_macros[tok].flags);
continue;
@@ -779,7 +780,7 @@ in_line(MACRO_PROT_ARGS)
}
ntok = (ac == ARGS_QWORD || (tok == MDOC_Fn && !cnt)) ?
- MDOC_MAX : lookup(mdoc, tok, line, la, p);
+ TOKEN_NONE : lookup(mdoc, tok, line, la, p);
/*
* In this case, we've located a submacro and must
@@ -788,7 +789,7 @@ in_line(MACRO_PROT_ARGS)
* or raise a warning.
*/
- if (ntok != MDOC_MAX) {
+ if (ntok != TOKEN_NONE) {
if (scope)
rew_elem(mdoc, tok);
if (nc && ! cnt) {
@@ -1105,7 +1106,7 @@ blk_full(MACRO_PROT_ARGS)
mdoc->flags |= MDOC_PPHRASE;
if (ac == ARGS_PEND && lac == ARGS_PPHRASE)
mdoc->flags |= MDOC_PPHRASE;
- parse_rest(mdoc, MDOC_MAX, line, &la, buf);
+ parse_rest(mdoc, TOKEN_NONE, line, &la, buf);
mdoc->flags &= ~MDOC_PPHRASE;
continue;
}
@@ -1335,9 +1336,9 @@ in_line_argn(MACRO_PROT_ARGS)
}
ntok = (ac == ARGS_QWORD || (tok == MDOC_Pf && state == 0)) ?
- MDOC_MAX : lookup(mdoc, tok, line, la, p);
+ TOKEN_NONE : lookup(mdoc, tok, line, la, p);
- if (ntok != MDOC_MAX) {
+ if (ntok != TOKEN_NONE) {
if (state >= 0) {
rew_elem(mdoc, tok);
state = -2;
@@ -1471,5 +1472,5 @@ phrase_ta(MACRO_PROT_ARGS)
rew_last(mdoc, body);
roff_body_alloc(mdoc, line, ppos, MDOC_It);
- parse_rest(mdoc, MDOC_MAX, line, pos, buf);
+ parse_rest(mdoc, TOKEN_NONE, line, pos, buf);
}
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 1abcbe5a3d8..459bd11d5dc 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.203 2015/04/19 13:50:10 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.204 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1260,7 +1260,7 @@ rewrite_macro2len(char **arg)
return;
else if ( ! strcmp(*arg, "Ds"))
width = 6;
- else if ((tok = mdoc_hash_find(*arg)) == MDOC_MAX)
+ else if ((tok = mdoc_hash_find(*arg)) == TOKEN_NONE)
return;
else
width = macro2len(tok);
@@ -1756,7 +1756,7 @@ post_sh_name(POST_ARGS)
mandoc_msg(MANDOCERR_NAMESEC_ND,
mdoc->parse, n->line, n->pos, NULL);
break;
- case MDOC_MAX:
+ case TOKEN_NONE:
if (hasnm)
break;
/* FALLTHROUGH */
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index 2e11570c2e5..91dfa194470 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.112 2015/04/18 17:28:08 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.113 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -288,17 +288,17 @@ choose_parser(struct mparse *curp)
curp->man = roff_man_alloc(curp->roff, curp, curp->defos,
curp->options & MPARSE_QUICK ? 1 : 0);
curp->man->macroset = MACROSET_MAN;
- curp->man->first->tok = MDOC_MAX;
+ curp->man->first->tok = TOKEN_NONE;
}
if (format == MPARSE_MDOC) {
mdoc_hash_init();
curp->man->macroset = MACROSET_MDOC;
- curp->man->first->tok = MDOC_MAX;
+ curp->man->first->tok = TOKEN_NONE;
} else {
man_hash_init();
curp->man->macroset = MACROSET_MAN;
- curp->man->first->tok = MAN_MAX;
+ curp->man->first->tok = TOKEN_NONE;
}
}
@@ -871,12 +871,11 @@ mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg,
if (curp->options & MPARSE_MDOC) {
mdoc_hash_init();
curp->man->macroset = MACROSET_MDOC;
- curp->man->first->tok = MDOC_MAX;
} else if (curp->options & MPARSE_MAN) {
man_hash_init();
curp->man->macroset = MACROSET_MAN;
- curp->man->first->tok = MAN_MAX;
}
+ curp->man->first->tok = TOKEN_NONE;
return(curp);
}
diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h
index 03bda5e403f..50ae42abdba 100644
--- a/usr.bin/mandoc/roff.h
+++ b/usr.bin/mandoc/roff.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.h,v 1.14 2015/04/18 16:34:03 schwarze Exp $ */
+/* $OpenBSD: roff.h,v 1.15 2015/04/19 13:59:37 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -97,6 +97,7 @@ struct roff_node {
int line; /* Input file line number. */
int pos; /* Input file column number. */
int tok; /* Request or macro ID. */
+#define TOKEN_NONE (-1) /* No request or macro. */
int flags;
#define MDOC_VALID (1 << 0) /* Has been validated. */
#define MDOC_ENDED (1 << 1) /* Gone past body end mark. */