[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mandoc-source
Subject:    mdocml: Reduce the verbosity of error messages caused by open(2)
From:       schwarze () mdocml ! bsd ! lv
Date:       2014-06-21 22:24:01
Message-ID: 201406212224.s5LMO1UM014091 () krisdoz ! my ! domain
[Download RAW message or body]

Log Message:
-----------
Reduce the verbosity of error messages caused by open(2) failures.
Suggested by and ok jmc@.

Modified Files:
--------------
    mdocml:
        main.c
        read.c

Revision Data
-------------
Index: read.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -Lread.c -Lread.c -u -p -r1.50 -r1.51
--- read.c
+++ read.c
@@ -210,7 +210,7 @@ static	const char * const	mandocerrs[MAN
 	"static buffer exhausted",
 
 	/* system errors */
-	"cannot open file",
+	NULL,
 	"cannot stat file",
 	"cannot read file",
 };
Index: main.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/main.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -Lmain.c -Lmain.c -u -p -r1.176 -r1.177
--- main.c
+++ main.c
@@ -411,14 +411,17 @@ static void
 mmsg(enum mandocerr t, enum mandoclevel lvl,
 		const char *file, int line, int col, const char *msg)
 {
+	const char	*mparse_msg;
 
 	fprintf(stderr, "%s: %s:", progname, file);
 
 	if (line)
 		fprintf(stderr, "%d:%d:", line, col + 1);
 
-	fprintf(stderr, " %s: %s", mparse_strlevel(lvl),
-	    mparse_strerror(t));
+	fprintf(stderr, " %s", mparse_strlevel(lvl));
+
+	if (NULL != (mparse_msg = mparse_strerror(t)))
+		fprintf(stderr, ": %s", mparse_msg);
 
 	if (msg)
 		fprintf(stderr, ": %s", msg);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic