=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.103 retrieving revision 1.110 diff -u -p -r1.103 -r1.110 --- mandoc/main.c 2010/08/20 01:02:07 1.103 +++ mandoc/main.c 2010/12/01 10:31:34 1.110 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.103 2010/08/20 01:02:07 schwarze Exp $ */ +/* $Id: main.c,v 1.110 2010/12/01 10:31:34 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -125,21 +125,17 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "out of order prologue", "repeated prologue entry", "list type must come first", - "bad standard", - "bad library", "tab in non-literal context", "bad escape sequence", "unterminated quoted string", "argument requires the width argument", "superfluous width argument", - "ignoring argument", "bad date argument", "bad width argument", "unknown manual section", "section not in conventional manual section", "end of line whitespace", "blocks badly nested", - "scope open on exit", "generic error", @@ -147,9 +143,11 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "bad Boolean value", "child violates parent syntax", "bad AT&T symbol", + "bad standard", "list type repeated", "display type repeated", "argument repeated", + "ignoring argument", "manual name not yet set", "obsolete macro ignored", "empty macro ignored", @@ -161,10 +159,12 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "no text in this context", "bad comment style", "unknown macro will be lost", + "NOT IMPLEMENTED: skipping request", "line scope broken", "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)", @@ -174,6 +174,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "missing font type", "line argument(s) will be lost", "body argument(s) will be lost", + "paragraph macro ignored", "generic fatal error", @@ -182,7 +183,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 +231,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 +239,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 +279,7 @@ main(int argc, char *argv[]) if (curp.roff) roff_free(curp.roff); - return(exit_status); + return((int)exit_status); } @@ -288,7 +288,7 @@ version(void) { (void)printf("%s %s\n", progname, VERSION); - exit(MANDOCLEVEL_OK); + exit((int)MANDOCLEVEL_OK); } @@ -299,7 +299,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 +329,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 +551,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 +574,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 +809,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;