=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/main.c,v retrieving revision 1.206 retrieving revision 1.207 diff -c -r1.206 -r1.207 *** src/usr.bin/mandoc/main.c 2018/02/08 01:36:38 1.206 --- src/usr.bin/mandoc/main.c 2018/04/13 19:55:13 1.207 *************** *** 1,7 **** ! /* $OpenBSD: main.c,v 1.206 2018/02/08 01:36:38 tb Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons ! * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any --- 1,7 ---- ! /* $OpenBSD: main.c,v 1.207 2018/04/13 19:55:13 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons ! * Copyright (c) 2010-2012, 2014-2018 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any *************** *** 18,24 **** --- 18,26 ---- */ #include + #include #include /* MACHINE */ + #include #include #include *************** *** 114,119 **** --- 116,122 ---- struct manconf conf; struct mansearch search; struct curparse curp; + struct winsize ws; struct tag_files *tag_files; struct manpage *res, *resp; const char *progname, *sec, *thisarg; *************** *** 291,296 **** --- 294,308 ---- outmode == OUTMODE_LST || !isatty(STDOUT_FILENO)) use_pager = 0; + + if (use_pager && + (conf.output.width == 0 || conf.output.indent == 0) && + ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != -1) { + if (conf.output.width == 0 && ws.ws_col < 79) + conf.output.width = ws.ws_col - 1; + if (conf.output.indent == 0 && ws.ws_col < 66) + conf.output.indent = 3; + } if (!use_pager) if (pledge("stdio rpath", NULL) == -1)