summaryrefslogtreecommitdiffstats
path: root/mdoc.c
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 /mdoc.c
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 `\."'.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c20
1 files changed, 13 insertions, 7 deletions
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];