summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-10 13:21:18 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-10 13:21:18 +0000
commitbb1251368e944c7cc779d718988d241c97fd0e04 (patch)
tree838e000d4d297512f8f719b264f3972f6582e2ce /main.c
parentcdd9965f2080354017315270cbc3dc2da6378df9 (diff)
downloadmandoc-bb1251368e944c7cc779d718988d241c97fd0e04.tar.gz
Decide whether to use_pager as early as possible,
in preparation for pledge(2); no functional change intended.
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/main.c b/main.c
index a1eca5e7..4c7137cf 100644
--- a/main.c
+++ b/main.c
@@ -289,6 +289,11 @@ main(int argc, char *argv[])
}
}
+ if (outmode == OUTMODE_FLN ||
+ outmode == OUTMODE_LST ||
+ !isatty(STDOUT_FILENO))
+ use_pager = 0;
+
/* Parse arguments. */
if (argc > 0) {
@@ -420,9 +425,6 @@ main(int argc, char *argv[])
if (search.argmode == ARG_FILE && ! moptions(&options, auxpaths))
return (int)MANDOCLEVEL_BADARG;
- if (use_pager && ! isatty(STDOUT_FILENO))
- use_pager = 0;
-
curp.mchars = mchars_alloc();
curp.mp = mparse_alloc(options, curp.wlevel, mmsg,
curp.mchars, defos);