summaryrefslogtreecommitdiffstatshomepage
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
commit71214b69722d5e7d403cbd9af32d74abf3ab0359 (patch)
tree32dd7a74ad10bd5c3a4e88c13f364d8a885fee10
parent2ccbf0603ef2d82abd3e4706b84940956cbe2252 (diff)
downloadmandoc-71214b69722d5e7d403cbd9af32d74abf3ab0359.tar.gz
mandoc-71214b69722d5e7d403cbd9af32d74abf3ab0359.tar.zst
mandoc-71214b69722d5e7d403cbd9af32d74abf3ab0359.zip
-man also prints unknown macro (noted by Joerg Sonnenberger).
-rw-r--r--libman.h3
-rw-r--r--man.c22
-rw-r--r--mdoc.c3
3 files changed, 17 insertions, 11 deletions
diff --git a/libman.h b/libman.h
index 0accc35c..3b7c70e9 100644
--- a/libman.h
+++ b/libman.h
@@ -1,4 +1,4 @@
-/* $Id: libman.h,v 1.21 2009/09/16 14:40:56 kristaps Exp $ */
+/* $Id: libman.h,v 1.22 2009/10/26 07:11:06 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -54,7 +54,6 @@ enum merr {
WHEADARGS,
WBODYARGS,
WNHEADARGS,
- WMACRO,
WMACROFORM,
WEXITSCOPE,
WNOSCOPE,
diff --git a/man.c b/man.c
index c9a6afeb..6336f938 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.42 2009/10/24 05:45:04 kristaps Exp $ */
+/* $Id: man.c,v 1.43 2009/10/26 07:11:06 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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);
}
diff --git a/mdoc.c b/mdoc.c
index e4f76c03..773a3507 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.110 2009/10/24 05:52:13 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.111 2009/10/26 07:11:07 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -665,7 +665,6 @@ parsetext(struct mdoc *m, int line, char *buf)
-
static int
macrowarn(struct mdoc *m, int ln, const char *buf)
{