summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-01-09 17:57:15 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-01-09 17:57:15 +0000
commit6bedbc425f004abba9975ffee4e32e69cae75153 (patch)
tree189e97c4b0f03ed3d458edd6253e9797e77f5ab6 /main.c
parent4558b393d13e93a90e77083bec440b2b2f93b671 (diff)
downloadmandoc-6bedbc425f004abba9975ffee4e32e69cae75153.tar.gz
merge rev. 1.279: make "cat foo.mdoc | man -l" work
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
index 5eab3859..34f8c230 100644
--- a/main.c
+++ b/main.c
@@ -551,10 +551,10 @@ out:
/* Stop here until moved to the foreground. */
- tc_pgid = tcgetpgrp(STDIN_FILENO);
+ tc_pgid = tcgetpgrp(tag_files->ofd);
if (tc_pgid != man_pgid) {
if (tc_pgid == pager_pid) {
- (void)tcsetpgrp(STDIN_FILENO,
+ (void)tcsetpgrp(tag_files->ofd,
man_pgid);
if (signum == SIGTTIN)
continue;
@@ -567,7 +567,7 @@ out:
/* Once in the foreground, activate the pager. */
if (pager_pid) {
- (void)tcsetpgrp(STDIN_FILENO, pager_pid);
+ (void)tcsetpgrp(tag_files->ofd, pager_pid);
kill(pager_pid, SIGCONT);
} else
pager_pid = spawn_pager(tag_files);
@@ -1097,7 +1097,7 @@ spawn_pager(struct tag_files *tag_files)
break;
default:
(void)setpgid(pager_pid, 0);
- (void)tcsetpgrp(STDIN_FILENO, pager_pid);
+ (void)tcsetpgrp(tag_files->ofd, pager_pid);
#if HAVE_PLEDGE
if (pledge("stdio rpath tmppath tty proc", NULL) == -1)
err((int)MANDOCLEVEL_SYSERR, "pledge");
@@ -1115,7 +1115,7 @@ spawn_pager(struct tag_files *tag_files)
/* Do not start the pager before controlling the terminal. */
- while (tcgetpgrp(STDIN_FILENO) != getpid())
+ while (tcgetpgrp(STDOUT_FILENO) != getpid())
nanosleep(&timeout, NULL);
execvp(argv[0], argv);