summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-06-11 12:07:49 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-06-11 12:07:49 +0000
commit5f01cd9971ff702a524ae0b46f692bf67ec2486e (patch)
treeda8e4de38776c49e96dae23505efa71e3723109a /main.c
parentc788f866d218b1363d95abee27eec8df64a79179 (diff)
downloadmandoc-5f01cd9971ff702a524ae0b46f692bf67ec2486e.tar.gz
Documented some un-clear parts of main.c.
Fixed footer to be new-groff style (OS DATE OS). Removed sanity check from mdoc_term (unnecessary).
Diffstat (limited to 'main.c')
-rw-r--r--main.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/main.c b/main.c
index c7c618ff..aaa757ed 100644
--- a/main.c
+++ b/main.c
@@ -190,6 +190,8 @@ main(int argc, char *argv[])
free(blk.buf);
if (ln.buf)
free(ln.buf);
+
+ /* TODO: have a curp_free routine. */
if (curp.outfree)
(*curp.outfree)(curp.outdata);
if (curp.mdoc)
@@ -231,7 +233,14 @@ man_init(struct curparse *curp)
mancb.man_err = merr;
mancb.man_warn = manwarn;
- pflags = MAN_IGN_MACRO; /* XXX */
+ /*
+ * Default behaviour is to ignore unknown macros. This is
+ * specified in mandoc.1.
+ */
+
+ pflags = MAN_IGN_MACRO;
+
+ /* Override default behaviour... */
if (curp->fflags & NO_IGN_MACRO)
pflags &= ~MAN_IGN_MACRO;
@@ -254,8 +263,16 @@ mdoc_init(struct curparse *curp)
mdoccb.mdoc_err = merr;
mdoccb.mdoc_warn = mdocwarn;
+ /*
+ * Default behaviour is to ignore unknown macros, escape
+ * sequences and characters (very liberal). This is specified
+ * in mandoc.1.
+ */
+
pflags = MDOC_IGN_MACRO | MDOC_IGN_ESCAPE | MDOC_IGN_CHARS;
+ /* Override default behaviour... */
+
if (curp->fflags & IGN_SCOPE)
pflags |= MDOC_IGN_SCOPE;
if (curp->fflags & NO_IGN_ESCAPE)
@@ -363,7 +380,7 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp)
continue;
}
- /* Check for CPP-escaped newline. */
+ /* Check for CPP-escaped newline. */
if (pos > 0 && '\\' == ln->buf[pos - 1]) {
for (j = pos - 1; j >= 0; j--)
@@ -630,9 +647,10 @@ merr(void *arg, int line, int col, const char *msg)
struct curparse *curp;
curp = (struct curparse *)arg;
-
warnx("%s:%d: error: %s (column %d)",
curp->file, line, msg, col);
+
+ /* Always exit on errors... */
return(0);
}
@@ -666,6 +684,11 @@ mdocwarn(void *arg, int line, int col,
if ( ! (curp->wflags & WARN_WERR))
return(1);
+
+ /*
+ * If the -Werror flag is passed in, as in gcc, then all
+ * warnings are considered as errors.
+ */
warnx("%s: considering warnings as errors",
__progname);
@@ -689,6 +712,11 @@ manwarn(void *arg, int line, int col, const char *msg)
if ( ! (curp->wflags & WARN_WERR))
return(1);
+ /*
+ * If the -Werror flag is passed in, as in gcc, then all
+ * warnings are considered as errors.
+ */
+
warnx("%s: considering warnings as errors",
__progname);
return(0);