diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-06-21 22:24:01 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-06-21 22:24:01 +0000 |
commit | de464cf7824c34781440095d8a6d06c2510d0550 (patch) | |
tree | c2037588fb7f41a8e5742a71fab92b4f95919fa6 | |
parent | fc390ff3f226de8ab205d632e190100023030fef (diff) | |
download | mandoc-de464cf7824c34781440095d8a6d06c2510d0550.tar.gz |
Reduce the verbosity of error messages caused by open(2) failures.
Suggested by and ok jmc@.
-rw-r--r-- | main.c | 7 | ||||
-rw-r--r-- | read.c | 2 |
2 files changed, 6 insertions, 3 deletions
@@ -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); @@ -210,7 +210,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "static buffer exhausted", /* system errors */ - "cannot open file", + NULL, "cannot stat file", "cannot read file", }; |