summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-04-08 07:53:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-04-08 07:53:01 +0000
commitdddfffcee06b6b91e4f189f71f8b4863c54cf798 (patch)
treeb87bed9f41da468269c6f01819f793a0486094d7
parente9ac197eddfe16859b48d764269c476bfd7de49f (diff)
downloadmandoc-dddfffcee06b6b91e4f189f71f8b4863c54cf798.tar.gz
Sync'd mdoc.c's function names with man.c.
Prompted by Ingo and Claus Assman, added warn/ignore for text lines beginning with `\."'.
-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];