summaryrefslogtreecommitdiffstats
path: root/mandoc_msg.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-07-14 18:16:13 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-07-14 18:16:13 +0000
commit8cc896a79402294b6337ffe1e4ed4eb10b98a81f (patch)
tree2b9f230fb75a6d3d293c57d5d64b0a0bb132b5bf /mandoc_msg.c
parent1f0bb6771eec829cff55c66f3cff4e6db37e950b (diff)
downloadmandoc-8cc896a79402294b6337ffe1e4ed4eb10b98a81f.tar.gz
If messages are shown and output is printed without a pager, display
a heads-up on stderr at the end because otherwise, users may easily miss the messages: because messages typically occur while parsing, they typically preceed the output. This is most useful with flag combinations like "-c -W all" but may also help in some unusual error scenarios. Inconvenient ordering of output originally pointed out by espie@ for the example situation that /tmp/ is not writeable.
Diffstat (limited to 'mandoc_msg.c')
-rw-r--r--mandoc_msg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mandoc_msg.c b/mandoc_msg.c
index 4299f2b8..15e4de01 100644
--- a/mandoc_msg.c
+++ b/mandoc_msg.c
@@ -355,3 +355,12 @@ mandoc_msg(enum mandocerr t, int line, int col, const char *fmt, ...)
}
fputc('\n', fileptr);
}
+
+void
+mandoc_msg_summary(void)
+{
+ if (fileptr != NULL && rc != MANDOCLEVEL_OK)
+ fprintf(fileptr,
+ "%s: see above the output for %s messages\n",
+ getprogname(), level_name[rc]);
+}