From 4a5b30c7331befaddae3dcb0a0e2180414bbe5ce Mon Sep 17 00:00:00 2001 From: schwarze Date: Sat, 10 Oct 2015 13:20:25 +0000 Subject: [PATCH] Decide whether to use_pager as early as possible, in preparation for pledge(2); no functional change intended. --- usr.bin/mandoc/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index c06cefcfe74..c6d3c745bfd 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.150 2015/10/06 18:30:43 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.151 2015/10/10 13:20:25 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze @@ -279,6 +279,11 @@ main(int argc, char *argv[]) } } + if (outmode == OUTMODE_FLN || + outmode == OUTMODE_LST || + !isatty(STDOUT_FILENO)) + use_pager = 0; + /* Parse arguments. */ if (argc > 0) { @@ -399,9 +404,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); -- 2.20.1