From fadd7479bf73670e544e340f0f8944858501f7be Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 10 Oct 2015 13:21:18 +0000 Subject: Decide whether to use_pager as early as possible, in preparation for pledge(2); no functional change intended. --- main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 590d136e..574fc64a 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.245 2015/10/06 18:32:19 schwarze Exp $ */ +/* $Id: main.c,v 1.246 2015/10/10 13:21:18 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze @@ -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); -- cgit v1.2.3-56-ge451