=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.103 retrieving revision 1.106 diff -u -p -r1.103 -r1.106 --- mandoc/main.c 2010/08/20 01:02:07 1.103 +++ mandoc/main.c 2010/09/26 20:22:28 1.106 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.103 2010/08/20 01:02:07 schwarze Exp $ */ +/* $Id: main.c,v 1.106 2010/09/26 20:22:28 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -139,7 +139,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", @@ -165,6 +164,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)", @@ -182,7 +182,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", @@ -231,7 +230,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); @@ -239,11 +238,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(); @@ -279,7 +278,7 @@ main(int argc, char *argv[]) if (curp.roff) roff_free(curp.roff); - return(exit_status); + return((int)exit_status); } @@ -288,7 +287,7 @@ version(void) { (void)printf("%s %s\n", progname, VERSION); - exit(MANDOCLEVEL_OK); + exit((int)MANDOCLEVEL_OK); } @@ -299,7 +298,7 @@ usage(void) (void)fprintf(stderr, "usage: %s [-V] [-foption] " "[-mformat] [-Ooption] [-Toutput] " "[-Werr] [file...]\n", progname); - exit(MANDOCLEVEL_BADARG); + exit((int)MANDOCLEVEL_BADARG); } @@ -329,7 +328,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); } } @@ -551,14 +550,6 @@ fdesc(struct curparse *curp) } } - /* - * With -Wstop and warnings or errors of at least - * the requested level, do not produce output. - */ - - if (MANDOCLEVEL_OK != exit_status && curp->wstop) - goto cleanup; - /* NOTE a parser may not have been assigned, yet. */ if ( ! (man || mdoc)) { @@ -582,6 +573,14 @@ fdesc(struct curparse *curp) goto cleanup; } + /* + * With -Wstop and warnings or errors of at least + * the requested level, do not produce output. + */ + + if (MANDOCLEVEL_OK != exit_status && curp->wstop) + goto cleanup; + /* If unset, allocate output dev now (if applicable). */ if ( ! (curp->outman && curp->outmdoc)) { @@ -809,6 +808,7 @@ mmsg(enum mandocerr t, void *arg, int ln, int col, con level = MANDOCLEVEL_FATAL; while (t < mandoclimits[level]) + /* LINTED */ level--; cp = (struct curparse *)arg;