summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-16 15:28:35 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-16 15:28:35 +0000
commitb1cb710d98e936ddd40b4e26194b8def7d042c5a (patch)
tree95720003dd79a012b5989df043f524df06878fa9 /main.c
parent792762cbb772aaf51b391b8c492fc1285528dd88 (diff)
downloadmandoc-b1cb710d98e936ddd40b4e26194b8def7d042c5a.tar.gz
Push exit_status into struct curparse alongside file_status.
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/main.c b/main.c
index a5fc12d8..31f53975 100644
--- a/main.c
+++ b/main.c
@@ -77,6 +77,7 @@ enum outt {
};
struct curparse {
+ enum mandoclevel exit_status; /* status of all file parses */
const char *file; /* current file-name */
enum mandoclevel file_status; /* error status of current parse */
int fd; /* current file-descriptor */
@@ -241,7 +242,6 @@ static void version(void) __attribute__((noreturn));
static int woptions(struct curparse *, char *);
static const char *progname;
-static enum mandoclevel exit_status = MANDOCLEVEL_OK;
int
main(int argc, char *argv[])
@@ -260,6 +260,7 @@ main(int argc, char *argv[])
curp.inttype = INTT_AUTO;
curp.outtype = OUTT_ASCII;
curp.wlevel = MANDOCLEVEL_FATAL;
+ curp.exit_status = MANDOCLEVEL_OK;
/* LINTED */
while (-1 != (c = getopt(argc, argv, "m:O:T:VW:")))
@@ -300,7 +301,7 @@ main(int argc, char *argv[])
while (*argv) {
ffile(*argv, &curp);
- if (MANDOCLEVEL_OK != exit_status && curp.wstop)
+ if (MANDOCLEVEL_OK != curp.exit_status && curp.wstop)
break;
++argv;
}
@@ -314,7 +315,7 @@ main(int argc, char *argv[])
if (curp.roff)
roff_free(curp.roff);
- return((int)exit_status);
+ return((int)curp.exit_status);
}
@@ -359,7 +360,7 @@ ffile(const char *file, struct curparse *curp)
if (-1 == (curp->fd = open(curp->file, O_RDONLY, 0))) {
perror(curp->file);
- exit_status = MANDOCLEVEL_SYSERR;
+ curp->exit_status = MANDOCLEVEL_SYSERR;
return;
}
@@ -618,8 +619,8 @@ fdesc(struct curparse *curp)
assert(curp->roff);
roff_reset(curp->roff);
- if (exit_status < curp->file_status)
- exit_status = curp->file_status;
+ if (curp->exit_status < curp->file_status)
+ curp->exit_status = curp->file_status;
return;
}