* docbook2mdoc: Parsing errors are too easy to miss because they typically
@ 2019-03-26 20:06 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-03-26 20:06 UTC (permalink / raw)
To: source
Log Message:
-----------
Parsing errors are too easy to miss because they typically emit a
one-line error message followed by lengthy formatted output
of what was parsed before the error occurred.
Make parsing errors more conspicious by taking two steps:
1. If there was a parsing error, print a blank line to standard output
before starting formatted output, for better separation.
2. After the formatted output, if there was a parsing error, print
the following to standard error: a blank line, a message that output
is incomplete, and another blank line.
Modified Files:
--------------
docbook2mdoc:
main.c
Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lmain.c -Lmain.c -u -p -r1.1 -r1.2
--- main.c
+++ main.c
@@ -80,9 +80,15 @@ main(int argc, char *argv[])
rc = 1;
if ((parser = parse_alloc(warn)) != NULL) {
if ((tree = parse_file(parser, fd, fname)) != NULL) {
- if ((tree->flags & TREE_FAIL) == 0)
+ if (tree->flags & TREE_FAIL)
+ fputc('\n', stderr);
+ else
rc = 0;
ptree_print(tree);
+ if (tree->flags & TREE_FAIL)
+ fputs("\nThe output is incomplete, see "
+ "the parse error reported above.\n\n",
+ stderr);
pnode_unlink(tree->root);
tree->root = NULL;
}
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-26 20:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 20:06 docbook2mdoc: Parsing errors are too easy to miss because they typically schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).