summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2011-12-04 00:44:19 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2011-12-04 00:44:19 +0000
commitb028a6aacf5ba78b1c2fe9a989bf898b3fcad956 (patch)
tree3d250fca1ad53c5740de70642dbd5be86de160c8
parentbbd859bf3e389b45bba64cb4fed7f63110aea3f7 (diff)
When a man document contains nothing at all except one or more invalid
macros, do not die on an assertion, but show correct error messages. Assertions of meta data validity suggested by joerg@. ok joerg@
-rw-r--r--usr.bin/mandoc/man_html.c7
-rw-r--r--usr.bin/mandoc/man_macro.c3
-rw-r--r--usr.bin/mandoc/man_term.c7
3 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index 4f096d9a9a5..bef778b3cbf 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.44 2011/10/09 22:10:51 schwarze Exp $ */
+/* $Id: man_html.c,v 1.45 2011/12/04 00:44:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -174,6 +174,8 @@ print_man_head(MAN_ARGS)
{
print_gen_head(h);
+ assert(m->title);
+ assert(m->msec);
bufcat_fmt(h, "%s(%s)", m->title, m->msec);
print_otag(h, TAG_TITLE, 0, NULL);
print_text(h, h->buf);
@@ -301,6 +303,8 @@ man_root_pre(MAN_ARGS)
if (m->vol)
(void)strlcat(b, m->vol, BUFSIZ);
+ assert(m->title);
+ assert(m->msec);
snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec);
PAIR_SUMMARY_INIT(&tag[0], "Document Header");
@@ -355,6 +359,7 @@ man_root_post(MAN_ARGS)
PAIR_CLASS_INIT(&tag[0], "foot-date");
print_otag(h, TAG_TD, 1, tag);
+ assert(m->date);
print_text(h, m->date);
print_stagq(h, tt);
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index 05c59a90a1b..f4a28bcc310 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.32 2011/11/05 16:02:18 schwarze Exp $ */
+/* $Id: man_macro.c,v 1.33 2011/12/04 00:44:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -116,7 +116,6 @@ man_unscope(struct man *m, const struct man_node *to,
assert(to);
- assert(MAN_ROOT != m->last->type);
m->next = MAN_NEXT_SIBLING;
/* LINTED */
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index 5112ec009d3..e9e6edcff81 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.79 2011/11/13 15:46:04 schwarze Exp $ */
+/* $Id: man_term.c,v 1.80 2011/12/04 00:44:18 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -959,6 +959,9 @@ print_man_foot(struct termp *p, const void *arg)
const struct man_meta *meta;
meta = (const struct man_meta *)arg;
+ assert(meta->title);
+ assert(meta->msec);
+ assert(meta->date);
term_fontrepl(p, TERMFONT_NONE);
@@ -1009,6 +1012,8 @@ print_man_head(struct termp *p, const void *arg)
const struct man_meta *m;
m = (const struct man_meta *)arg;
+ assert(m->title);
+ assert(m->msec);
/*
* Note that old groff would spit out some spaces before the