From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 4a23638d for ; Tue, 26 Mar 2019 15:06:47 -0500 (EST) Date: Tue, 26 Mar 2019 15:06:47 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: docbook2mdoc: Parsing errors are too easy to miss because they typically X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: 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