summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-18 23:34:54 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-18 23:34:54 +0000
commitae0852645c4d11974f281b6094a4f3c98f47be56 (patch)
treeb20421eb174321dc8781085c13c4609dbd2b09b1
parent2ede31567194bba6d6fb98ea76ee669dc67c1d26 (diff)
sync to 1.7.19: improved comment handling
-rw-r--r--usr.bin/mandoc/main.c65
-rw-r--r--usr.bin/mandoc/man.714
-rw-r--r--usr.bin/mandoc/man.c10
-rw-r--r--usr.bin/mandoc/man.h11
-rw-r--r--usr.bin/mandoc/man_action.c5
-rw-r--r--usr.bin/mandoc/man_hash.c4
-rw-r--r--usr.bin/mandoc/man_macro.c5
-rw-r--r--usr.bin/mandoc/man_term.c5
-rw-r--r--usr.bin/mandoc/man_validate.c5
-rw-r--r--usr.bin/mandoc/mdoc.712
-rw-r--r--usr.bin/mandoc/mdoc.c18
-rw-r--r--usr.bin/mandoc/mdoc.h29
-rw-r--r--usr.bin/mandoc/mdoc_action.c5
-rw-r--r--usr.bin/mandoc/mdoc_argv.c5
-rw-r--r--usr.bin/mandoc/mdoc_hash.c4
-rw-r--r--usr.bin/mandoc/mdoc_macro.c7
-rw-r--r--usr.bin/mandoc/mdoc_term.c5
-rw-r--r--usr.bin/mandoc/mdoc_validate.c5
18 files changed, 114 insertions, 100 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index d534f636a2a..d1a7497d04a 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.4 2009/06/18 22:16:56 schwarze Exp $ */
+/* $Id: main.c,v 1.5 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -312,7 +312,7 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp)
size_t sz;
ssize_t ssz;
struct stat st;
- int j, i, pos, lnn;
+ int j, i, pos, lnn, comment;
struct man *man;
struct mdoc *mdoc;
@@ -342,7 +342,7 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp)
/* Fill buf with file blocksize. */
- for (lnn = 0, pos = 0; ; ) {
+ for (lnn = pos = comment = 0; ; ) {
if (-1 == (ssz = read(curp->fd, blk->buf, sz))) {
warn("%s", curp->file);
return(0);
@@ -362,17 +362,34 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp)
}
if ('\n' != blk->buf[i]) {
+ if (comment)
+ continue;
ln->buf[pos++] = blk->buf[i];
+
+ /* Handle in-line `\"' comments. */
+
+ if (1 == pos || '\"' != ln->buf[pos - 1])
+ continue;
+
+ for (j = pos - 2; j >= 0; j--)
+ if ('\\' != ln->buf[j])
+ break;
+
+ if ( ! ((pos - 2 - j) % 2))
+ continue;
+
+ comment = 1;
+ pos -= 2;
continue;
- }
+ }
- /* Check for CPP-escaped newline. */
+ /* Handle escaped `\\n' newlines. */
- if (pos > 0 && '\\' == ln->buf[pos - 1]) {
+ if (pos > 0 && 0 == comment &&
+ '\\' == ln->buf[pos - 1]) {
for (j = pos - 1; j >= 0; j--)
if ('\\' != ln->buf[j])
break;
-
if ( ! ((pos - j) % 2)) {
pos--;
lnn++;
@@ -382,19 +399,16 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp)
ln->buf[pos] = 0;
lnn++;
-
- /*
- * If no manual parser has been assigned, then
- * try to assign one in pset(), which may do
- * nothing at all. After this, parse the manual
- * line accordingly.
- */
+
+ /* If unset, assign parser in pset(). */
if ( ! (man || mdoc) && ! pset(ln->buf,
pos, curp, &man, &mdoc))
return(0);
- pos = 0;
+ pos = comment = 0;
+
+ /* Pass down into parsers. */
if (man && ! man_parseln(man, lnn, ln->buf))
return(0);
@@ -403,7 +417,7 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp)
}
}
- /* Note that a parser may not have been assigned, yet. */
+ /* NOTE a parser may not have been assigned, yet. */
if ( ! (man || mdoc)) {
warnx("%s: not a manual", curp->file);
@@ -415,12 +429,7 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp)
if (man && ! man_endparse(man))
return(0);
- /*
- * If an output device hasn't been allocated, see if we should
- * do so now. Note that not all outtypes have functions, so
- * this switch statement may be superfluous, but it's
- * low-overhead enough not to matter very much.
- */
+ /* If unset, allocate output dev now (if applicable). */
if ( ! (curp->outman && curp->outmdoc)) {
switch (curp->outtype) {
@@ -456,17 +465,23 @@ static int
pset(const char *buf, int pos, struct curparse *curp,
struct man **man, struct mdoc **mdoc)
{
+ int i;
/*
* Try to intuit which kind of manual parser should be used. If
* passed in by command-line (-man, -mdoc), then use that
* explicitly. If passed as -mandoc, then try to guess from the
- * line: either skip comments, use -mdoc when finding `.Dt', or
+ * line: either skip dot-lines, use -mdoc when finding `.Dt', or
* default to -man, which is more lenient.
*/
- if (pos >= 3 && 0 == memcmp(buf, ".\\\"", 3))
- return(1);
+ if (buf[0] == '.') {
+ for (i = 1; buf[i]; i++)
+ if (' ' != buf[i] && '\t' != buf[i])
+ break;
+ if (0 == buf[i])
+ return(1);
+ }
switch (curp->inttype) {
case (INTT_MDOC):
diff --git a/usr.bin/mandoc/man.7 b/usr.bin/mandoc/man.7
index abae8768d9d..be4533a8287 100644
--- a/usr.bin/mandoc/man.7
+++ b/usr.bin/mandoc/man.7
@@ -1,4 +1,4 @@
-.\" $Id: man.7,v 1.2 2009/06/14 23:00:57 schwarze Exp $
+.\" $Id: man.7,v 1.3 2009/06/18 23:34:53 schwarze Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 14 2009 $
+.Dd $Mdocdate: June 18 2009 $
.Dt MAN 7
.Os
.\" SECTION
@@ -70,6 +70,16 @@ escape is common in historical
documents; if encountered at the end of a word, it ensures that the
subsequent word isn't off-set by whitespace.
.\" SUB-SECTION
+.Ss Comments
+Anything following a
+.Sq \e"
+delimiter is considered a comment (unless the
+.Sq \e
+itself has been escaped) and is ignored to the end of line.
+Furthermore, a macro line with only a control character
+.Sq \. ,
+optionally followed by whitespace, is ignored.
+.\" SUB-SECTION
.Ss Special Characters
Special character sequences begin with the escape character
.Sq \e
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index 403b20c0fdb..a1e4578e7ac 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: man.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -24,12 +24,12 @@
#include "libman.h"
const char *const __man_macronames[MAN_MAX] = {
- "\\\"", "TH", "SH", "SS",
+ "br", "TH", "SH", "SS",
"TP", "LP", "PP", "P",
"IP", "HP", "SM", "SB",
"BI", "IB", "BR", "RB",
"R", "B", "I", "IR",
- "RI", "br", "na", "i"
+ "RI", "na", "i"
};
const char * const *man_macronames = __man_macronames;
@@ -324,10 +324,6 @@ man_pmacro(struct man *m, int ln, char *buf)
ppos = i;
- if (buf[i] && '\\' == buf[i])
- if (buf[i + 1] && '\"' == buf[i + 1])
- goto out;
-
/* Copy the first word into a nil-terminated buffer. */
for (j = 0; j < 4; j++, i++) {
diff --git a/usr.bin/mandoc/man.h b/usr.bin/mandoc/man.h
index 8e6af0d3d65..8457a5fcc98 100644
--- a/usr.bin/mandoc/man.h
+++ b/usr.bin/mandoc/man.h
@@ -1,4 +1,4 @@
-/* $Id: man.h,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: man.h,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -19,7 +19,7 @@
#include <time.h>
-#define MAN___ 0
+#define MAN_br 0
#define MAN_TH 1
#define MAN_SH 2
#define MAN_SS 3
@@ -40,10 +40,9 @@
#define MAN_I 18
#define MAN_IR 19
#define MAN_RI 20
-#define MAN_br 21
-#define MAN_na 22
-#define MAN_i 23
-#define MAN_MAX 24
+#define MAN_na 21
+#define MAN_i 22
+#define MAN_MAX 23
enum man_type {
MAN_TEXT,
diff --git a/usr.bin/mandoc/man_action.c b/usr.bin/mandoc/man_action.c
index b7a9e98cc42..24bfb51a6d3 100644
--- a/usr.bin/mandoc/man_action.c
+++ b/usr.bin/mandoc/man_action.c
@@ -1,4 +1,4 @@
-/* $Id: man_action.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: man_action.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -32,7 +32,7 @@ static int post_TH(struct man *);
static time_t man_atotime(const char *);
const struct actions man_actions[MAN_MAX] = {
- { NULL }, /* __ */
+ { NULL }, /* br */
{ post_TH }, /* TH */
{ NULL }, /* SH */
{ NULL }, /* SS */
@@ -53,7 +53,6 @@ const struct actions man_actions[MAN_MAX] = {
{ NULL }, /* I */
{ NULL }, /* IR */
{ NULL }, /* RI */
- { NULL }, /* br */
{ NULL }, /* na */
{ NULL }, /* i */
};
diff --git a/usr.bin/mandoc/man_hash.c b/usr.bin/mandoc/man_hash.c
index 26ef2d24360..f3e6073e0a2 100644
--- a/usr.bin/mandoc/man_hash.c
+++ b/usr.bin/mandoc/man_hash.c
@@ -1,4 +1,4 @@
-/* $Id: man_hash.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: man_hash.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -41,7 +41,7 @@ man_hash_alloc(void)
if (NULL == htab)
return(NULL);
- for (i = 1; i < MAN_MAX; i++) {
+ for (i = 0; i < MAN_MAX; i++) {
x = man_macronames[i][0];
assert((x >= 65 && x <= 90) ||
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index 4c283ab94f2..2f342331aee 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: man_macro.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -28,7 +28,7 @@ static int man_args(struct man *, int,
int *, char *, char **);
static int man_flags[MAN_MAX] = {
- 0, /* __ */
+ 0, /* br */
0, /* TH */
0, /* SH */
0, /* SS */
@@ -49,7 +49,6 @@ static int man_flags[MAN_MAX] = {
FL_NLINE, /* I */
FL_NLINE, /* IR */
FL_NLINE, /* RI */
- 0, /* br */
0, /* na */
FL_NLINE, /* i */
};
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 11864c49186..4aede7a7120 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.5 2009/06/18 21:34:54 schwarze Exp $ */
+/* $Id: man_term.c,v 1.6 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -52,7 +52,7 @@ static void post_SH(DECL_ARGS);
static void post_SS(DECL_ARGS);
static const struct termact termacts[MAN_MAX] = {
- { NULL, NULL }, /* __ */
+ { pre_PP, NULL }, /* br */
{ NULL, NULL }, /* TH */
{ pre_SH, post_SH }, /* SH */
{ pre_SS, post_SS }, /* SS */
@@ -73,7 +73,6 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_I, post_I }, /* I */
{ pre_IR, NULL }, /* IR */
{ pre_RI, NULL }, /* RI */
- { pre_PP, NULL }, /* br */
{ NULL, NULL }, /* na */
{ pre_I, post_I }, /* i */
};
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index c90f84ae559..4f6b53f3fa3 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -48,7 +48,7 @@ static v_post posts_eq0[] = { check_eq0, NULL };
static v_post posts_ge2_le5[] = { check_ge2, check_le5, NULL };
static const struct man_valid man_valids[MAN_MAX] = {
- { NULL }, /* __ */
+ { posts_eq0 }, /* br */
{ posts_ge2_le5 }, /* TH */
{ posts_ge1 }, /* SH */
{ posts_ge1 }, /* SS */
@@ -69,7 +69,6 @@ static const struct man_valid man_valids[MAN_MAX] = {
{ NULL }, /* I */
{ NULL }, /* IR */
{ NULL }, /* RI */
- { posts_eq0 }, /* br */
{ posts_eq0 }, /* na */
{ NULL }, /* i */
};
diff --git a/usr.bin/mandoc/mdoc.7 b/usr.bin/mandoc/mdoc.7
index 8f589a1ce7e..689ed385203 100644
--- a/usr.bin/mandoc/mdoc.7
+++ b/usr.bin/mandoc/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.3 2009/06/18 01:19:02 schwarze Exp $
+.\" $Id: mdoc.7,v 1.4 2009/06/18 23:34:53 schwarze Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -78,6 +78,16 @@ or
.Sq \&.Bd \-unfilled
contexts.
.\" SUB-SECTION
+.Ss Comments
+Anything following a
+.Sq \e"
+delimiter is considered a comment (unless the
+.Sq \e
+itself has been escaped) and is ignored to the end of line.
+Furthermore, a macro line with only a control character
+.Sq \. ,
+optionally followed by whitespace, is ignored.
+.\" SUB-SECTION
.Ss Reserved Characters
Within a macro line, the following characters are reserved:
.Bl -tag -width 12n -offset XXXX -compact
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 71a0631c085..48e68243eb1 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.6 2009/06/18 22:16:56 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.7 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -34,7 +34,7 @@ enum merr {
};
const char *const __mdoc_macronames[MDOC_MAX] = {
- "\\\"", "Dd", "Dt", "Os",
+ "Ap", "Dd", "Dt", "Os",
"Sh", "Ss", "Pp", "D1",
"Dl", "Bd", "Ed", "Bl",
"El", "It", "Ad", "An",
@@ -63,12 +63,12 @@ const char *const __mdoc_macronames[MDOC_MAX] = {
"Tn", "Ux", "Xc", "Xo",
"Fo", "Fc", "Oo", "Oc",
"Bk", "Ek", "Bt", "Hf",
- "Fr", "Ud", "Lb", "Ap",
- "Lp", "Lk", "Mt", "Brq",
+ "Fr", "Ud", "Lb", "Lp",
+ "Lk", "Mt", "Brq", "Bro",
/* LINTED */
- "Bro", "Brc", "\%C", "Es",
+ "Brc", "\%C", "Es", "En",
/* LINTED */
- "En", "Dx", "\%Q"
+ "Dx", "\%Q"
};
const char *const __mdoc_argnames[MDOC_ARG_MAX] = {
@@ -657,7 +657,7 @@ parsemacro(struct mdoc *m, int ln, char *buf)
int i, c;
char mac[5];
- /* Comments and empties are quickly ignored. */
+ /* Empty lines are ignored. */
if (0 == buf[1])
return(1);
@@ -671,10 +671,6 @@ parsemacro(struct mdoc *m, int ln, char *buf)
return(perr(m, ln, 1, ESPACE));
}
- if (buf[1] && '\\' == buf[1])
- if (buf[2] && '\"' == buf[2])
- return(1);
-
/* Copy the first word into a nil-terminated buffer. */
for (i = 1; i < 5; i++) {
diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h
index edaa9efc4e3..f138c9ec21b 100644
--- a/usr.bin/mandoc/mdoc.h
+++ b/usr.bin/mandoc/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.3 2009/06/18 22:16:56 schwarze Exp $ */
+/* $Id: mdoc.h,v 1.4 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -29,7 +29,7 @@
/* What follows is a list of ALL possible macros. */
-#define MDOC___ 0
+#define MDOC_Ap 0
#define MDOC_Dd 1
#define MDOC_Dt 2
#define MDOC_Os 3
@@ -136,19 +136,18 @@
#define MDOC_Fr 104
#define MDOC_Ud 105
#define MDOC_Lb 106
-#define MDOC_Ap 107
-#define MDOC_Lp 108
-#define MDOC_Lk 109
-#define MDOC_Mt 110
-#define MDOC_Brq 111
-#define MDOC_Bro 112
-#define MDOC_Brc 113
-#define MDOC__C 114
-#define MDOC_Es 115
-#define MDOC_En 116
-#define MDOC_Dx 117
-#define MDOC__Q 118
-#define MDOC_MAX 119
+#define MDOC_Lp 107
+#define MDOC_Lk 108
+#define MDOC_Mt 109
+#define MDOC_Brq 110
+#define MDOC_Bro 111
+#define MDOC_Brc 112
+#define MDOC__C 113
+#define MDOC_Es 114
+#define MDOC_En 115
+#define MDOC_Dx 116
+#define MDOC__Q 117
+#define MDOC_MAX 118
/* What follows is a list of ALL possible macro arguments. */
diff --git a/usr.bin/mandoc/mdoc_action.c b/usr.bin/mandoc/mdoc_action.c
index 8cc1377ed8d..3e5a7d0ae56 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.3 2009/06/18 01:19:02 schwarze Exp $ */
+/* $Id: mdoc_action.c,v 1.4 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -71,7 +71,7 @@ static int pre_dl(PRE_ARGS);
#define nerr(m, n, t) perr((m), (n)->line, (n)->pos, (t))
const struct actions mdoc_actions[MDOC_MAX] = {
- { NULL, NULL }, /* \" */
+ { NULL, NULL }, /* Ap */
{ NULL, post_dd }, /* Dd */
{ NULL, post_dt }, /* Dt */
{ NULL, post_os }, /* Os */
@@ -178,7 +178,6 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL, NULL }, /* Fr */
{ NULL, NULL }, /* Ud */
{ NULL, NULL }, /* Lb */
- { NULL, NULL }, /* Ap */
{ NULL, NULL }, /* Lp */
{ NULL, post_lk }, /* Lk */
{ NULL, NULL }, /* Mt */
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c
index 8efcd3e09c3..6b107c1a52a 100644
--- a/usr.bin/mandoc/mdoc_argv.c
+++ b/usr.bin/mandoc/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -105,7 +105,7 @@ static int mdoc_argvflags[MDOC_ARG_MAX] = {
};
static int mdoc_argflags[MDOC_MAX] = {
- 0, /* \" */
+ 0, /* Ap */
0, /* Dd */
0, /* Dt */
0, /* Os */
@@ -212,7 +212,6 @@ static int mdoc_argflags[MDOC_MAX] = {
0, /* Fr */
0, /* Ud */
0, /* Lb */
- 0, /* Ap */
ARGS_DELIM, /* Lp */
ARGS_DELIM | ARGS_QUOTED, /* Lk */
ARGS_DELIM | ARGS_QUOTED, /* Mt */
diff --git a/usr.bin/mandoc/mdoc_hash.c b/usr.bin/mandoc/mdoc_hash.c
index 4f2349aedc4..d501473c3e8 100644
--- a/usr.bin/mandoc/mdoc_hash.c
+++ b/usr.bin/mandoc/mdoc_hash.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_hash.c,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: mdoc_hash.c,v 1.3 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -46,7 +46,7 @@ mdoc_hash_alloc(void)
if (NULL == htab)
return(NULL);
- for (i = 1; i < MDOC_MAX; i++) {
+ for (i = 0; i < MDOC_MAX; i++) {
major = mdoc_macronames[i][0];
assert((major >= 65 && major <= 90) ||
major == 37);
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index 461af57629f..fb50bc1b93f 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.3 2009/06/18 01:19:02 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.4 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -22,8 +22,6 @@
#include "libmdoc.h"
-/* FIXME: .Fl, .Ar, .Cd handling of `|'. */
-
enum mwarn {
WIGNE,
WIMPBRK,
@@ -74,7 +72,7 @@ static int swarn(struct mdoc *, enum mdoc_type, int, int,
/* Central table of library: who gets parsed how. */
const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
- { NULL, 0 }, /* \" */
+ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ap */
{ in_line_eoln, MDOC_PROLOGUE }, /* Dd */
{ in_line_eoln, MDOC_PROLOGUE }, /* Dt */
{ in_line_eoln, MDOC_PROLOGUE }, /* Os */
@@ -181,7 +179,6 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
{ obsolete, 0 }, /* Fr */
{ in_line_eoln, 0 }, /* Ud */
{ in_line_eoln, 0 }, /* Lb */
- { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ap */
{ in_line, 0 }, /* Lp */
{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Lk */
{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Mt */
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index db33006cfe6..fdbd5250567 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.10 2009/06/18 21:50:45 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.11 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -183,7 +183,7 @@ struct termact {
};
static const struct termact termacts[MDOC_MAX] = {
- { NULL, NULL }, /* \" */
+ { termp_ap_pre, NULL }, /* Ap */
{ NULL, NULL }, /* Dd */
{ NULL, NULL }, /* Dt */
{ NULL, NULL }, /* Os */
@@ -290,7 +290,6 @@ static const struct termact termacts[MDOC_MAX] = {
{ NULL, NULL }, /* Fr */
{ termp_ud_pre, NULL }, /* Ud */
{ termp_lb_pre, termp_lb_post }, /* Lb */
- { termp_ap_pre, NULL }, /* Lb */
{ termp_pp_pre, NULL }, /* Pp */
{ termp_lk_pre, NULL }, /* Lk */
{ termp_mt_pre, NULL }, /* Mt */
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index e8a7b48613e..cf65b516a53 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.6 2009/06/18 21:08:29 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.7 2009/06/18 23:34:53 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -191,7 +191,7 @@ static v_post posts_bf[] = { hwarn_le1, post_bf, NULL };
static v_post posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL };
const struct valids mdoc_valids[MDOC_MAX] = {
- { NULL, NULL }, /* \" */
+ { NULL, NULL }, /* Ap */
{ pres_dd, posts_text }, /* Dd */
{ pres_dt, NULL }, /* Dt */
{ pres_os, NULL }, /* Os */
@@ -298,7 +298,6 @@ const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Fr */
{ NULL, posts_notext }, /* Ud */
{ pres_lb, posts_lb }, /* Lb */
- { NULL, NULL }, /* Ap */
{ NULL, posts_pp }, /* Lp */
{ NULL, NULL }, /* Lk */
{ NULL, posts_text }, /* Mt */