Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!hsdndev!bbn.com!jcurran From: jcurran@bbn.com (John Curran) Newsgroups: comp.unix.wizards Subject: Using more as an output filter via popen - pipe buffering Keywords: pipe popen more Message-ID: <64813@bbn.BBN.COM> Date: 23 Jun 91 04:43:34 GMT References: <1743@sranha.sra.co.jp> <1991Jun20.085530.24353@prl.dec.com> <1753@sranha.sra.co.jp> <1991Jun21.141740.15039@prl.dec.com> Sender: news@bbn.com Reply-To: jcurran@BBN.COM (John Curran) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 19 I'm looking for advice on how to utilize "more" from within a program as an output filter. I tried the following code segment: pager = popen("{PAGER-more}","w"); for (...) { putc(ch++,pager) } This works, except that when more displays the output, it is not possible to stop the display via the "q" command. I added a SIGPIPE handler to longjmp and close the pipe, but that did not change the results. I reduced the amount of buffered data by switching to write(fileno(pager),ch,1), but it still does not stop for files over 8K. Am I right in assuming that this is a result of the internal buffering in pipes? Is there a method to force a smaller pipe buffer? Thanks, /John