summaryrefslogtreecommitdiffstats
path: root/man.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-10-26 07:11:06 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-10-26 07:11:06 +0000
commite2944aa4f55c6872ee2344ffbd51212c75cffebb (patch)
tree889f93921832424c7c2be1a9a76e97b69de64d1d /man.c
parentae31c624796c0d1f8969261195d13eca22ecca14 (diff)
downloadmandoc-e2944aa4f55c6872ee2344ffbd51212c75cffebb.tar.gz
-man also prints unknown macro (noted by Joerg Sonnenberger).
Diffstat (limited to 'man.c')
-rw-r--r--man.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/man.c b/man.c
index e51ba768..7120f06e 100644
--- a/man.c
+++ b/man.c
@@ -40,7 +40,6 @@ const char *const __man_merrnames[WERRMAX] = {
"expected block head arguments", /* WHEADARGS */
"expected block body arguments", /* WBODYARGS */
"expected empty block head", /* WNHEADARGS */
- "unknown macro", /* WMACRO */
"ill-formed macro", /* WMACROFORM */
"scope open on exit", /* WEXITSCOPE */
"no scope context", /* WNOSCOPE */
@@ -71,6 +70,7 @@ static void man_free1(struct man *);
static int man_alloc1(struct man *);
static int pstring(struct man *, int, int,
const char *, size_t);
+static int macrowarn(struct man *, int, const char *);
#ifdef __linux__
extern size_t strlcpy(char *, const char *, size_t);
@@ -456,6 +456,18 @@ descope:
}
+static int
+macrowarn(struct man *m, int ln, const char *buf)
+{
+ if ( ! (MAN_IGN_MACRO & m->pflags))
+ return(man_verr(m, ln, 0,
+ "unknown macro: %s%s",
+ buf, strlen(buf) > 3 ? "..." : ""));
+ return(man_vwarn(m, ln, 0, "unknown macro: %s%s",
+ buf, strlen(buf) > 3 ? "..." : ""));
+}
+
+
int
man_pmacro(struct man *m, int ln, char *buf)
{
@@ -510,11 +522,7 @@ man_pmacro(struct man *m, int ln, char *buf)
}
if (MAN_MAX == (c = man_hash_find(mac))) {
- if ( ! (MAN_IGN_MACRO & m->pflags)) {
- (void)man_perr(m, ln, ppos, WMACRO);
- goto err;
- }
- if ( ! man_pwarn(m, ln, ppos, WMACRO))
+ if ( ! macrowarn(m, ln, mac))
goto err;
return(1);
}