From b00fcba133e2170f5308eb02bfa9b9b8d7dea0a0 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Mon, 27 Jul 2009 19:43:02 +0000 Subject: main.c using fprintf instead of warnx for parse errors (like cc). Error string is now file:line:col: message. Removed sed from vim -q example in manuals.7. Fixed column reporting (off by one). --- main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 84bccdf5..b8c5aa33 100644 --- a/main.c +++ b/main.c @@ -418,7 +418,7 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp) /* NOTE a parser may not have been assigned, yet. */ if ( ! (man || mdoc)) { - warnx("%s: not a manual", curp->file); + (void)fprintf(stderr, "%s: not a manual", curp->file); return(0); } @@ -639,8 +639,8 @@ merr(void *arg, int line, int col, const char *msg) curp = (struct curparse *)arg; - warnx("%s:%d: error: %s (column %d)", - curp->file, line, msg, col); + (void)fprintf(stderr, "%s:%d:%d: error: %s\n", + curp->file, line, col + 1, msg); return(0); } @@ -656,13 +656,12 @@ mwarn(void *arg, int line, int col, const char *msg) if ( ! (curp->wflags & WARN_WALL)) return(1); - warnx("%s:%d: warning: %s (column %d)", - curp->file, line, msg, col); + (void)fprintf(stderr, "%s:%d:%d: warning: %s\n", + curp->file, line, col + 1, msg); if ( ! (curp->wflags & WARN_WERR)) return(1); - warnx("considering warnings as errors"); return(0); } -- cgit