summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--libman.h3
-rw-r--r--libmdoc.h3
-rw-r--r--man.c8
-rw-r--r--mdoc.c22
4 files changed, 25 insertions, 11 deletions
diff --git a/libman.h b/libman.h
index eb6969f6..83dc6da2 100644
--- a/libman.h
+++ b/libman.h
@@ -1,4 +1,4 @@
-/* $Id: libman.h,v 1.30 2010/03/29 10:10:35 kristaps Exp $ */
+/* $Id: libman.h,v 1.31 2010/04/08 07:53:01 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -66,6 +66,7 @@ enum merr {
WROFFNEST,
WROFFSCOPE,
WTITLECASE,
+ WBADCOMMENT,
WERRMAX
};
diff --git a/libmdoc.h b/libmdoc.h
index c6fbbbe5..98058a27 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmdoc.h,v 1.33 2010/04/06 11:33:00 kristaps Exp $ */
+/* $Id: libmdoc.h,v 1.34 2010/04/08 07:53:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -93,6 +93,7 @@ enum merr {
ELIB,
EBADCHILD,
ENOTYPE,
+ EBADCOMMENT,
MERRMAX
};
diff --git a/man.c b/man.c
index b1853d1a..44cc06b1 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.59 2010/03/29 10:10:35 kristaps Exp $ */
+/* $Id: man.c,v 1.60 2010/04/08 07:53:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 fd6efb90..db962970 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.122 2010/04/08 07:06:15 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.123 2010/04/08 07:53:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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];