summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libman.h1
-rw-r--r--libmdoc.h1
-rw-r--r--man.c6
-rw-r--r--mdoc.c20
4 files changed, 21 insertions, 7 deletions
diff --git a/libman.h b/libman.h
index d4b3eb06..1ff650dd 100644
--- a/libman.h
+++ b/libman.h
@@ -66,6 +66,7 @@ enum merr {
WROFFNEST,
WROFFSCOPE,
WTITLECASE,
+ WBADCOMMENT,
WERRMAX
};
diff --git a/libmdoc.h b/libmdoc.h
index 29b11936..d2908fef 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -93,6 +93,7 @@ enum merr {
ELIB,
EBADCHILD,
ENOTYPE,
+ EBADCOMMENT,
MERRMAX
};
diff --git a/man.c b/man.c
index c74ac21e..878963c1 100644
--- a/man.c
+++ b/man.c
@@ -53,6 +53,7 @@ const char *const __man_merrnames[WERRMAX] = {
"invalid nesting of roff declarations", /* WROFFNEST */
"scope in roff instructions broken", /* WROFFSCOPE */
"document title should be uppercase", /* WTITLECASE */
+ "deprecated comment style", /* WBADCOMMENT */
};
const char *const __man_macronames[MAN_MAX] = {
@@ -378,6 +379,11 @@ man_ptext(struct man *m, int line, char *buf)
int i, j;
char sv;
+ /* Ignore bogus comments. */
+
+ if ('\\' == buf[0] && '.' == buf[1] && '\"' == buf[2])
+ return(man_pwarn(m, line, 0, WBADCOMMENT));
+
/* Literal free-form text whitespace is preserved. */
if (MAN_LITERAL & m->flags) {
diff --git a/mdoc.c b/mdoc.c
index 72573f33..10aad780 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -84,6 +84,7 @@ const char *const __mdoc_merrnames[MERRMAX] = {
"no description found for library", /* ELIB */
"bad child for parent context", /* EBADCHILD */
"list arguments preceding type", /* ENOTYPE */
+ "deprecated comment style", /* EBADCOMMENT */
};
const char *const __mdoc_macronames[MDOC_MAX] = {
@@ -150,8 +151,8 @@ static struct mdoc_node *node_alloc(struct mdoc *, int, int,
enum mdoct, enum mdoc_type);
static int node_append(struct mdoc *,
struct mdoc_node *);
-static int parsetext(struct mdoc *, int, char *);
-static int parsemacro(struct mdoc *, int, char *);
+static int mdoc_ptext(struct mdoc *, int, char *);
+static int mdoc_pmacro(struct mdoc *, int, char *);
static int macrowarn(struct mdoc *, int, const char *);
static int pstring(struct mdoc *, int, int,
const char *, size_t);
@@ -280,7 +281,7 @@ mdoc_endparse(struct mdoc *m)
/*
* Main parse routine. Parses a single line -- really just hands off to
- * the macro (parsemacro()) or text parser (parsetext()).
+ * the macro (mdoc_pmacro()) or text parser (mdoc_ptext()).
*/
int
mdoc_parseln(struct mdoc *m, int ln, char *buf)
@@ -289,8 +290,8 @@ mdoc_parseln(struct mdoc *m, int ln, char *buf)
if (MDOC_HALT & m->flags)
return(0);
- return('.' == *buf ? parsemacro(m, ln, buf) :
- parsetext(m, ln, buf));
+ return('.' == *buf ? mdoc_pmacro(m, ln, buf) :
+ mdoc_ptext(m, ln, buf));
}
@@ -630,11 +631,16 @@ mdoc_node_delete(struct mdoc *m, struct mdoc_node *p)
* control character.
*/
static int
-parsetext(struct mdoc *m, int line, char *buf)
+mdoc_ptext(struct mdoc *m, int line, char *buf)
{
int i, j;
char sv;
+ /* Ignore bogus comments. */
+
+ if ('\\' == buf[0] && '.' == buf[1] && '\"' == buf[2])
+ return(mdoc_pwarn(m, line, 0, EBADCOMMENT));
+
if (SEC_NONE == m->lastnamed)
return(mdoc_perr(m, line, 0, ETEXTPROL));
@@ -730,7 +736,7 @@ macrowarn(struct mdoc *m, int ln, const char *buf)
* character.
*/
int
-parsemacro(struct mdoc *m, int ln, char *buf)
+mdoc_pmacro(struct mdoc *m, int ln, char *buf)
{
int i, j, c;
char mac[5];