summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-27 19:43:02 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-27 19:43:02 +0000
commit9a6a4eb84af13ded9474fbe8c1363fb2482a3492 (patch)
treed5880b4b475a3ff20bd63bef80818bae6c5970b7
parentb47e561cf549df2f08947057fecfe611e1f25f89 (diff)
downloadmandoc-9a6a4eb84af13ded9474fbe8c1363fb2482a3492.tar.gz
mandoc-9a6a4eb84af13ded9474fbe8c1363fb2482a3492.tar.zst
mandoc-9a6a4eb84af13ded9474fbe8c1363fb2482a3492.zip
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).
-rw-r--r--main.c13
-rw-r--r--manuals.75
-rw-r--r--mdoc.c6
3 files changed, 11 insertions, 13 deletions
diff --git a/main.c b/main.c
index a7b5c4d4..d2d5a869 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.39 2009/07/24 14:00:59 kristaps Exp $ */
+/* $Id: main.c,v 1.40 2009/07/27 19:43:02 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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);
}
diff --git a/manuals.7 b/manuals.7
index 5f7c06a2..47b0b78d 100644
--- a/manuals.7
+++ b/manuals.7
@@ -1,4 +1,4 @@
-.\" $Id: manuals.7,v 1.18 2009/07/27 13:10:08 kristaps Exp $
+.\" $Id: manuals.7,v 1.19 2009/07/27 19:43:02 kristaps Exp $
.\"
.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
.\"
@@ -113,8 +113,7 @@ The quick-fix feature of
is useful for checking over many manuals:
.Bd -literal -offset indent
% mandoc \-Wall \-fstrict \-Tlint \-fign-errors \e
- `find /usr/src \-name \e*\e.[1-9]` 2>&1 | \e
- sed 's!^mandoc: !!' > /tmp/mandoc.errs
+ ./path/to/manuals/* 2>&1 > /tmp/mandoc.errs
% vim -q /tmp/mandoc.errs
.Ed
.Pp
diff --git a/mdoc.c b/mdoc.c
index 67cf61f0..86adead3 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.95 2009/07/20 14:09:38 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.96 2009/07/27 19:43:02 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -657,10 +657,10 @@ static int
macrowarn(struct mdoc *m, int ln, const char *buf)
{
if ( ! (MDOC_IGN_MACRO & m->pflags))
- return(mdoc_verr(m, ln, 1,
+ return(mdoc_verr(m, ln, 0,
"unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
- return(mdoc_vwarn(m, ln, 1, "unknown macro: %s%s",
+ return(mdoc_vwarn(m, ln, 0, "unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
}