summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-09 13:04:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-09 13:04:01 +0000
commit3c250f9844dc2759a6887a574ce490316f7d1939 (patch)
treee1d3729c8ebbf735e45a2a9bec594ec0e4fe6da7 /mdoc.c
parentf4bf03d97398f8f37ba7e8df8d5a0e3f1b53520c (diff)
downloadmandoc-3c250f9844dc2759a6887a574ce490316f7d1939.tar.gz
Added "Input Encoding" section to mdoc*.1.VERSION.1.4.4
Newline-escaped lines are concatenated. Added -fign-macro option.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/mdoc.c b/mdoc.c
index 6996e4f2..fffb2a92 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -38,6 +38,7 @@ static int mdoc_node_append(struct mdoc *,
static int parsetext(struct mdoc *, int, char *);
static int parsemacro(struct mdoc *, int, char *);
+static int macrowarn(struct mdoc *, int, const char *);
const char *const __mdoc_macronames[MDOC_MAX] = {
@@ -495,6 +496,19 @@ parsetext(struct mdoc *mdoc, int line, char *buf)
}
+static int
+macrowarn(struct mdoc *m, int ln, const char *buf)
+{
+ if ( ! (MDOC_IGN_MACRO & m->pflags))
+ return(mdoc_perr(m, ln, 1, "unknown macro: %s%s",
+ buf, buf[3] ? "..." : ""));
+ return(mdoc_pwarn(m, ln, 1, WARN_SYNTAX,
+ "unknown macro: %s%s",
+ buf, buf[3] ? "..." : ""));
+}
+
+
+
/*
* Parse a macro line, that is, a line beginning with the control
* character.
@@ -525,14 +539,15 @@ parsemacro(struct mdoc *m, int ln, char *buf)
mac[i - 1] = 0;
if (i == 5 || i <= 2) {
- (void)mdoc_perr(m, ln, 1, "unknown macro: %s%s",
- mac, i == 5 ? "..." : "");
- goto err;
+ if ( ! macrowarn(m, ln, mac))
+ goto err;
+ return(1);
}
if (MDOC_MAX == (c = mdoc_tokhash_find(m->htab, mac))) {
- (void)mdoc_perr(m, ln, 1, "unknown macro: %s", mac);
- goto err;
+ if ( ! macrowarn(m, ln, mac))
+ goto err;
+ return(1);
}
/* The macro is sane. Jump to the next word. */