diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-01-08 02:53:13 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-01-08 02:53:13 +0000 |
commit | 88bc2f3d403685eb613237b364c82c0042b74ee5 (patch) | |
tree | 8003e0df848412664c88194e5e2f1b078478ffc0 /main.c | |
parent | 04d39401bf641371ebd7d33949c6022bf67ee762 (diff) | |
download | mandoc-88bc2f3d403685eb613237b364c82c0042b74ee5.tar.gz mandoc-88bc2f3d403685eb613237b364c82c0042b74ee5.tar.zst mandoc-88bc2f3d403685eb613237b364c82c0042b74ee5.zip |
Simplify the mparse_open() interface.
Just return the file descriptor or -1 on error;
there is just one kind of error anyway.
Suggested by Christos Zoulas (NetBSD).
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -1,7 +1,7 @@ -/* $Id: main.c,v 1.261 2016/01/08 02:13:39 schwarze Exp $ */ +/* $Id: main.c,v 1.262 2016/01/08 02:53:13 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -126,7 +126,6 @@ main(int argc, char *argv[]) size_t isec, i, sz; int prio, best_prio; char sec; - enum mandoclevel rctmp; enum outmode outmode; int fd; int show_usage; @@ -459,11 +458,7 @@ main(int argc, char *argv[]) } while (argc > 0) { - rctmp = mparse_open(curp.mp, &fd, - resp != NULL ? resp->file : *argv); - if (rc < rctmp) - rc = rctmp; - + fd = mparse_open(curp.mp, resp != NULL ? resp->file : *argv); if (fd != -1) { if (use_pager) { tag_files = tag_init(); @@ -482,7 +477,8 @@ main(int argc, char *argv[]) if (argc > 1 && curp.outtype <= OUTT_UTF8) ascii_sepline(curp.outdata); - } + } else if (rc < MANDOCLEVEL_ERROR) + rc = MANDOCLEVEL_ERROR; if (MANDOCLEVEL_OK != rc && curp.wstop) break; |