summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/main.c20
-rw-r--r--usr.bin/mandoc/mandoc.h5
-rw-r--r--usr.bin/mandoc/mdoc_macro.c14
3 files changed, 17 insertions, 22 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index 4a2159b7d9a..ead36ef2987 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.46 2010/08/20 08:13:03 schwarze Exp $ */
+/* $Id: main.c,v 1.47 2010/09/26 20:19:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -124,7 +124,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"section not in conventional manual section",
"end of line whitespace",
"blocks badly nested",
- "scope open on exit",
"generic error",
@@ -150,6 +149,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"argument count wrong",
"request scope close w/none open",
"scope already open",
+ "scope open on exit",
"macro requires line argument(s)",
"macro requires body argument(s)",
"macro requires argument(s)",
@@ -167,7 +167,6 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"unsupported display type",
"blocks badly nested",
"no such block is open",
- "scope broken, syntax violated",
"line scope broken, syntax violated",
"argument count wrong, violates syntax",
"child violates parent syntax",
@@ -216,7 +215,7 @@ main(int argc, char *argv[])
switch (c) {
case ('m'):
if ( ! moptions(&curp.inttype, optarg))
- return(MANDOCLEVEL_BADARG);
+ return((int)MANDOCLEVEL_BADARG);
break;
case ('O'):
(void)strlcat(curp.outopts, optarg, BUFSIZ);
@@ -224,11 +223,11 @@ main(int argc, char *argv[])
break;
case ('T'):
if ( ! toptions(&curp, optarg))
- return(MANDOCLEVEL_BADARG);
+ return((int)MANDOCLEVEL_BADARG);
break;
case ('W'):
if ( ! woptions(&curp, optarg))
- return(MANDOCLEVEL_BADARG);
+ return((int)MANDOCLEVEL_BADARG);
break;
case ('V'):
version();
@@ -264,7 +263,7 @@ main(int argc, char *argv[])
if (curp.roff)
roff_free(curp.roff);
- return(exit_status);
+ return((int)exit_status);
}
@@ -273,7 +272,7 @@ version(void)
{
(void)printf("%s %s\n", progname, VERSION);
- exit(MANDOCLEVEL_OK);
+ exit((int)MANDOCLEVEL_OK);
}
@@ -284,7 +283,7 @@ usage(void)
(void)fprintf(stderr, "usage: %s [-V] [-foption] "
"[-mformat] [-Ooption] [-Toutput] "
"[-Werr] [file...]\n", progname);
- exit(MANDOCLEVEL_BADARG);
+ exit((int)MANDOCLEVEL_BADARG);
}
@@ -314,7 +313,7 @@ resize_buf(struct buf *buf, size_t initial)
buf->buf = realloc(buf->buf, buf->sz);
if (NULL == buf->buf) {
perror(NULL);
- exit(MANDOCLEVEL_SYSERR);
+ exit((int)MANDOCLEVEL_SYSERR);
}
}
@@ -794,6 +793,7 @@ mmsg(enum mandocerr t, void *arg, int ln, int col, const char *msg)
level = MANDOCLEVEL_FATAL;
while (t < mandoclimits[level])
+ /* LINTED */
level--;
cp = (struct curparse *)arg;
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index ba940077a9c..d9c9f8e05e1 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc.h,v 1.12 2010/08/20 00:53:35 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.13 2010/09/26 20:19:58 schwarze Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -63,7 +63,6 @@ enum mandocerr {
MANDOCERR_SECMSEC, /* section not in conventional manual section */
MANDOCERR_EOLNSPACE, /* end of line whitespace */
MANDOCERR_SCOPENEST, /* blocks badly nested */
- MANDOCERR_SCOPEEXIT, /* scope open on exit */
MANDOCERR_ERROR, /* ===== end of errors ===== */
@@ -89,6 +88,7 @@ enum mandocerr {
MANDOCERR_ARGCOUNT, /* argument count wrong */
MANDOCERR_NOSCOPE, /* no such block is open */
MANDOCERR_SCOPEREP, /* scope already open */
+ MANDOCERR_SCOPEEXIT, /* scope open on exit */
/* FIXME: merge following with MANDOCERR_ARGCOUNT */
MANDOCERR_NOARGS, /* macro requires line argument(s) */
MANDOCERR_NOBODY, /* macro requires body argument(s) */
@@ -108,7 +108,6 @@ enum mandocerr {
MANDOCERR_BADDISP, /* unsupported display type */
MANDOCERR_SCOPEFATAL, /* blocks badly nested */
MANDOCERR_SYNTNOSCOPE, /* no scope to rewind: syntax violated */
- MANDOCERR_SYNTSCOPE, /* scope broken, syntax violated */
MANDOCERR_SYNTLINESCOPE, /* line scope broken, syntax violated */
MANDOCERR_SYNTARGVCOUNT, /* argument count wrong, violates syntax */
MANDOCERR_SYNTCHILD, /* child violates parent syntax */
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index b258157da05..6055ee4dea9 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.55 2010/07/16 00:34:33 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.56 2010/09/26 20:19:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -203,14 +203,10 @@ mdoc_macroend(struct mdoc *m)
n = MDOC_VALID & m->last->flags ? m->last->parent : m->last;
- for ( ; n; n = n->parent) {
- if (MDOC_BLOCK != n->type)
- continue;
- if ( ! (MDOC_EXPLICIT & mdoc_macros[n->tok].flags))
- continue;
- mdoc_nmsg(m, n, MANDOCERR_SYNTSCOPE);
- return(0);
- }
+ for ( ; n; n = n->parent)
+ if (MDOC_BLOCK == n->type &&
+ MDOC_EXPLICIT & mdoc_macros[n->tok].flags)
+ mdoc_nmsg(m, n, MANDOCERR_SCOPEEXIT);
/* Rewind to the first. */